From 8afd7b12a0bc4d1e686bdad668adbb7497fbed85 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 8 Jun 2026 17:16:26 +0530 Subject: [PATCH 01/11] chore: update Node.js SDK to 26.2.0 --- CHANGELOG.md | 11 + .../update-membership-privacy-policy.md | 3 +- .../project/update-o-auth-2-server.md | 7 +- package-lock.json | 574 +++++++++--------- package.json | 4 +- src/client.ts | 25 +- src/enums/project-key-scopes.ts | 1 + src/inputFile.ts | 2 +- src/models.ts | 48 ++ src/services/account.ts | 49 ++ src/services/activities.ts | 2 + src/services/advisor.ts | 4 + src/services/avatars.ts | 8 + src/services/backups.ts | 12 + src/services/databases.ts | 65 ++ src/services/functions.ts | 22 + src/services/graphql.ts | 2 + src/services/health.ts | 25 + src/services/locale.ts | 8 + src/services/messaging.ts | 54 ++ src/services/organization.ts | 7 + src/services/presences.ts | 4 + src/services/project.ts | 171 +++++- src/services/proxy.ts | 7 + src/services/sites.ts | 22 + src/services/storage.ts | 11 + src/services/tables-db.ts | 65 ++ src/services/teams.ts | 11 + src/services/tokens.ts | 4 + src/services/usage.ts | 2 + src/services/users.ts | 42 ++ src/services/webhooks.ts | 5 + test/client.test.js | 34 ++ test/services/account.test.js | 4 +- test/services/activities.test.js | 4 +- test/services/advisor.test.js | 4 +- test/services/avatars.test.js | 4 +- test/services/backups.test.js | 4 +- test/services/databases.test.js | 4 +- test/services/functions.test.js | 4 +- test/services/graphql.test.js | 4 +- test/services/health.test.js | 4 +- test/services/locale.test.js | 4 +- test/services/messaging.test.js | 4 +- test/services/organization.test.js | 19 +- test/services/presences.test.js | 4 +- test/services/project.test.js | 99 ++- test/services/proxy.test.js | 4 +- test/services/sites.test.js | 4 +- test/services/storage.test.js | 4 +- test/services/tables-d-b.test.js | 4 +- test/services/teams.test.js | 8 +- test/services/tokens.test.js | 4 +- test/services/usage.test.js | 4 +- test/services/users.test.js | 4 +- test/services/webhooks.test.js | 4 +- 56 files changed, 1145 insertions(+), 372 deletions(-) create mode 100644 test/client.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index effca6f..f7617e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## 26.2.0 + +* Added: Device Authorization Grant params (`verificationUrl`, `userCodeLength`, `userCodeFormat`, `deviceCodeDuration`) to `updateOAuth2Server` +* Added: `authorizationDetailsTypes` (RFC 9396) param to `updateOAuth2Server` in `project` +* Added: `userAccessedAt` param to `updateMembershipPrivacyPolicy` in `project` +* Added: email classification attributes (`emailCanonical`, `emailIsFree`, `emailIsDisposable`, `emailIsCorporate`, `emailIsCanonical`) to `User` +* Added: `userAccessedAt` attribute to `Membership` +* Added: `dedicatedDatabases.execute` to `ProjectKeyScopes` +* Updated: Replaced HTTP transport with `undici` for requests and self-signed certs + + ## 26.1.0 * Added: `createSesProvider` and `updateSesProvider` to `messaging` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md index 66eff9f..6fda090 100644 --- a/docs/examples/project/update-membership-privacy-policy.md +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -13,6 +13,7 @@ const result = await project.updateMembershipPrivacyPolicy({ userEmail: false, // optional userPhone: false, // optional userName: false, // optional - userMFA: false // optional + userMFA: false, // optional + userAccessedAt: false // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index d852677..5feef6a 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -12,10 +12,15 @@ const result = await project.updateOAuth2Server({ enabled: false, authorizationUrl: 'https://example.com', scopes: [], // optional + authorizationDetailsTypes: [], // optional accessTokenDuration: 60, // optional refreshTokenDuration: 60, // optional publicAccessTokenDuration: 60, // optional publicRefreshTokenDuration: 60, // optional - confidentialPkce: false // optional + confidentialPkce: false, // optional + verificationUrl: 'https://example.com', // optional + userCodeLength: 6, // optional + userCodeFormat: 'numeric', // optional + deviceCodeDuration: 60 // optional }); ``` diff --git a/package-lock.json b/package-lock.json index a4840dc..2ac1a1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "node-appwrite", - "version": "26.1.0", + "version": "26.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "26.1.0", + "version": "26.2.0", + "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0", - "node-fetch-native-with-agent": "1.7.2" + "undici": "^6.26.0" }, "devDependencies": { "@types/json-bigint": "1.0.4", @@ -19,17 +20,16 @@ "tslib": "2.6.2", "tsup": "^8.5.1", "typescript": "5.4.2" - }, - "license": "BSD-3-Clause" + } }, "node_modules/@babel/code-frame": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", - "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", + "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" }, @@ -38,9 +38,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", - "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", "dev": true, "license": "MIT", "engines": { @@ -48,21 +48,21 @@ } }, "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -79,14 +79,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.29.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", - "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz", + "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.0", - "@babel/types": "^7.29.0", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" @@ -96,14 +96,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -113,9 +113,9 @@ } }, "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", "dev": true, "license": "MIT", "engines": { @@ -123,29 +123,29 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", - "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", - "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.6" + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -155,9 +155,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", - "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", "dev": true, "license": "MIT", "engines": { @@ -165,9 +165,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "dev": true, "license": "MIT", "engines": { @@ -175,9 +175,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "dev": true, "license": "MIT", "engines": { @@ -185,9 +185,9 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", "dev": true, "license": "MIT", "engines": { @@ -195,27 +195,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.29.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", - "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0" + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.29.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz", - "integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.29.0" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -280,13 +280,13 @@ } }, "node_modules/@babel/plugin-syntax-import-attributes": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz", - "integrity": "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.29.7.tgz", + "integrity": "sha512-zGYcYfq/WmZ4V+kBIXQon9dSSc8ircGZqw9ZaNhhGj9nZkeBu1jHLBDQqYYi5WA9uawvA2sIMbry2nCFhf5Djg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.28.6" + "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -322,13 +322,13 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.28.6.tgz", - "integrity": "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.29.7.tgz", + "integrity": "sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.28.6" + "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -448,13 +448,13 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.28.6.tgz", - "integrity": "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.29.7.tgz", + "integrity": "sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.28.6" + "@babel/helper-plugin-utils": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -464,33 +464,33 @@ } }, "node_modules/@babel/template": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", - "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", - "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz", + "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0", + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7", "debug": "^4.3.1" }, "engines": { @@ -498,14 +498,14 @@ } }, "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -978,9 +978,9 @@ } }, "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz", + "integrity": "sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==", "dev": true, "license": "MIT", "engines": { @@ -1330,9 +1330,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.1.tgz", - "integrity": "sha512-d6FinEBLdIiK+1uACUttJKfgZREXrF0Qc2SmLII7W2AD8FfiZ9Wjd+rD/iRuf5s5dWrr1GgwXCvPqOuDquOowA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1344,9 +1344,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.1.tgz", - "integrity": "sha512-YjG/EwIDvvYI1YvYbHvDz/BYHtkY4ygUIXHnTdLhG+hKIQFBiosfWiACWortsKPKU/+dUwQQCKQM3qrDe8c9BA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1358,9 +1358,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.1.tgz", - "integrity": "sha512-mjCpF7GmkRtSJwon+Rq1N8+pI+8l7w5g9Z3vWj4T7abguC4Czwi3Yu/pFaLvA3TTeMVjnu3ctigusqWUfjZzvw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1372,9 +1372,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.1.tgz", - "integrity": "sha512-haZ7hJ1JT4e9hqkoT9R/19XW2QKqjfJVv+i5AGg57S+nLk9lQnJ1F/eZloRO3o9Scy9CM3wQ9l+dkXtcBgN5Ew==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1386,9 +1386,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.1.tgz", - "integrity": "sha512-czw90wpQq3ZsAVBlinZjAYTKduOjTywlG7fEeWKUA7oCmpA8xdTkxZZlwNJKWqILlq0wehoZcJYfBvOyhPTQ6w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1400,9 +1400,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.1.tgz", - "integrity": "sha512-KVB2rqsxTHuBtfOeySEyzEOB7ltlB/ux38iu2rBQzkjbwRVlkhAGIEDiiYnO2kFOkJp+Z7pUXKyrRRFuFUKt+g==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1414,16 +1414,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.1.tgz", - "integrity": "sha512-L+34Qqil+v5uC0zEubW7uByo78WOCIrBvci69E7sFASRl0X7b/MB6Cqd1lky/CtcSVTydWa2WZwFuWexjS5o6g==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1431,16 +1428,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.1.tgz", - "integrity": "sha512-n83O8rt4v34hgFzlkb1ycniJh7IR5RCIqt6mz1VRJD6pmhRi0CXdmfnLu9dIUS6buzh60IvACM842Ffb3xd6Gg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1448,16 +1442,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.1.tgz", - "integrity": "sha512-Nql7sTeAzhTAja3QXeAI48+/+GjBJ+QmAH13snn0AJSNL50JsDqotyudHyMbO2RbJkskbMbFJfIJKWA6R1LCJQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1465,16 +1456,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.1.tgz", - "integrity": "sha512-+pUymDhd0ys9GcKZPPWlFiZ67sTWV5UU6zOJat02M1+PiuSGDziyRuI/pPue3hoUwm2uGfxdL+trT6Z9rxnlMA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1482,16 +1470,13 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.1.tgz", - "integrity": "sha512-VSvgvQeIcsEvY4bKDHEDWcpW4Yw7BtlKG1GUT4FzBUlEKQK0rWHYBqQt6Fm2taXS+1bXvJT6kICu5ZwqKCnvlQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1499,16 +1484,13 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.1.tgz", - "integrity": "sha512-4LqhUomJqwe641gsPp6xLfhqWMbQV04KtPp7/dIp0nzPxAkNY1AbwL5W0MQpcalLYk07vaW9Kp1PBhdpZYYcEw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1516,16 +1498,13 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.1.tgz", - "integrity": "sha512-tLQQ9aPvkBxOc/EUT6j3pyeMD6Hb8QF2BTBnCQWP/uu1lhc9AIrIjKnLYMEroIz/JvtGYgI9dF3AxHZNaEH0rw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1533,16 +1512,13 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.1.tgz", - "integrity": "sha512-RMxFhJwc9fSXP6PqmAz4cbv3kAyvD1etJFjTx4ONqFP9DkTkXsAMU4v3Vyc5BgzC+anz7nS/9tp4obsKfqkDHg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1550,16 +1526,13 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.1.tgz", - "integrity": "sha512-QKgFl+Yc1eEk6MmOBfRHYF6lTxiiiV3/z/BRrbSiW2I7AFTXoBFvdMEyglohPj//2mZS4hDOqeB0H1ACh3sBbg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1567,16 +1540,13 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.1.tgz", - "integrity": "sha512-RAjXjP/8c6ZtzatZcA1RaQr6O1TRhzC+adn8YZDnChliZHviqIjmvFwHcxi4JKPSDAt6Uhf/7vqcBzQJy0PDJg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1584,16 +1554,13 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.1.tgz", - "integrity": "sha512-wcuocpaOlaL1COBYiA89O6yfjlp3RwKDeTIA0hM7OpmhR1Bjo9j31G1uQVpDlTvwxGn2nQs65fBFL5UFd76FcQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1601,16 +1568,13 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.1.tgz", - "integrity": "sha512-77PpsFQUCOiZR9+LQEFg9GClyfkNXj1MP6wRnzYs0EeWbPcHs02AXu4xuUbM1zhwn3wqaizle3AEYg5aeoohhg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1618,16 +1582,13 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.1.tgz", - "integrity": "sha512-5cIATbk5vynAjqqmyBjlciMJl1+R/CwX9oLk/EyiFXDWd95KpHdrOJT//rnUl4cUcskrd0jCCw3wpZnhIHdD9w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1635,9 +1596,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.1.tgz", - "integrity": "sha512-cl0w09WsCi17mcmWqqglez9Gk8isgeWvoUZ3WiJFYSR3zjBQc2J5/ihSjpl+VLjPqjQ/1hJRcqBfLjssREQILw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1649,9 +1610,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.1.tgz", - "integrity": "sha512-4Cv23ZrONRbNtbZa37mLSueXUCtN7MXccChtKpUnQNgF010rjrjfHx3QxkS2PI7LqGT5xXyYs1a7LbzAwT0iCA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1663,9 +1624,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.1.tgz", - "integrity": "sha512-i1okWYkA4FJICtr7KpYzFpRTHgy5jdDbZiWfvny21iIKky5YExiDXP+zbXzm3dUcFpkEeYNHgQ5fuG236JPq0g==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1677,9 +1638,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.1.tgz", - "integrity": "sha512-u09m3CuwLzShA0EYKMNiFgcjjzwqtUMLmuCJLeZWjjOYA3IT2Di09KaxGBTP9xVztWyIWjVdsB2E9goMjZvTQg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1691,9 +1652,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.1.tgz", - "integrity": "sha512-k+600V9Zl1CM7eZxJgMyTUzmrmhB/0XZnF4pRypKAlAgxmedUA+1v9R+XOFv56W4SlHEzfeMtzujLJD22Uz5zg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1705,9 +1666,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.1.tgz", - "integrity": "sha512-lWMnixq/QzxyhTV6NjQJ4SFo1J6PvOX8vUx5Wb4bBPsEb+8xZ89Bz6kOXpfXj9ak9AHTQVQzlgzBEc1SyM27xQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1791,9 +1752,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true, "license": "MIT" }, @@ -2085,9 +2046,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.10.12", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.12.tgz", - "integrity": "sha512-qyq26DxfY4awP2gIRXhhLWfwzwI+N5Nxk6iQi8EFizIaWIjqicQTE4sLnZZVdeKPRcVNoJOkkpfzoIYuvCKaIQ==", + "version": "2.10.34", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.34.tgz", + "integrity": "sha512-IMDedajPifLnHNY0X9n8hKxRTQ6/eTHwr5bDo04WnuqxyKw6LYtQywCuuqPZwhl3aBXMvQpJov42GLCwRRdQzw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2107,9 +2068,9 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz", + "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==", "dev": true, "license": "MIT", "dependencies": { @@ -2228,9 +2189,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001782", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001782.tgz", - "integrity": "sha512-dZcaJLJeDMh4rELYFw1tvSn1bhZWYFOt468FcbHHxx/Z/dFidd1I6ciyFdi3iwfQCyOjqo9upF6lGQYtMiJWxw==", + "version": "1.0.30001797", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001797.tgz", + "integrity": "sha512-l8xKG+gwAIExZGl9FrF7KUwuOmk6wbEPC9Xoy/RtnWv1XG0Q4LFlagaLpUv3Kiza3W/wm27zy0yWJEieYKAP6w==", "dev": true, "funding": [ { @@ -2509,9 +2470,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.329", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.329.tgz", - "integrity": "sha512-/4t+AS1l4S3ZC0Ja7PHFIWeBIxGA3QGqV8/yKsP36v7NcyUCl+bIcmw6s5zVuMIECWwBrAK/6QLzTmbJChBboQ==", + "version": "1.5.368", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.368.tgz", + "integrity": "sha512-7RckJJK4uESJF9PxvfMWd3TGqIiieUTG4HxnKaKuIpGbcr+r2ZEB3g2gAhCP3Fqm42vJSzLfgab9eva/C4/XVw==", "dev": true, "license": "ISC" }, @@ -2545,6 +2506,16 @@ "is-arrayish": "^0.2.1" } }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/esbuild": { "version": "0.27.7", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", @@ -2853,9 +2824,9 @@ } }, "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", "dev": true, "license": "MIT", "dependencies": { @@ -2939,13 +2910,13 @@ "license": "MIT" }, "node_modules/is-core-module": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", "dev": true, "license": "MIT", "dependencies": { - "hasown": "^2.0.2" + "hasown": "^2.0.3" }, "engines": { "node": ">= 0.4" @@ -3032,9 +3003,9 @@ } }, "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", + "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", "dev": true, "license": "ISC", "bin": { @@ -3571,9 +3542,9 @@ } }, "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", + "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", "dev": true, "license": "ISC", "bin": { @@ -3857,9 +3828,9 @@ } }, "node_modules/make-dir/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", + "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", "dev": true, "license": "ISC", "bin": { @@ -3962,12 +3933,6 @@ "dev": true, "license": "MIT" }, - "node_modules/node-fetch-native-with-agent": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-fetch-native-with-agent/-/node-fetch-native-with-agent-1.7.2.tgz", - "integrity": "sha512-5MaOOCuJEvcckoz7/tjdx1M6OusOY6Xc5f459IaruGStWnKzlI1qpNgaAwmn4LmFYcsSlj+jBMk84wmmRxfk5g==", - "license": "MIT" - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -3976,11 +3941,14 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.36", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.36.tgz", - "integrity": "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==", + "version": "2.0.47", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz", + "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=18" + } }, "node_modules/normalize-path": { "version": "3.0.0", @@ -4348,12 +4316,13 @@ } }, "node_modules/resolve": { - "version": "1.22.11", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", - "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "version": "1.22.12", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", + "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", "dev": true, "license": "MIT", "dependencies": { + "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" @@ -4402,13 +4371,13 @@ } }, "node_modules/rollup": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz", - "integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "dev": true, "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -4418,31 +4387,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.60.1", - "@rollup/rollup-android-arm64": "4.60.1", - "@rollup/rollup-darwin-arm64": "4.60.1", - "@rollup/rollup-darwin-x64": "4.60.1", - "@rollup/rollup-freebsd-arm64": "4.60.1", - "@rollup/rollup-freebsd-x64": "4.60.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.60.1", - "@rollup/rollup-linux-arm-musleabihf": "4.60.1", - "@rollup/rollup-linux-arm64-gnu": "4.60.1", - "@rollup/rollup-linux-arm64-musl": "4.60.1", - "@rollup/rollup-linux-loong64-gnu": "4.60.1", - "@rollup/rollup-linux-loong64-musl": "4.60.1", - "@rollup/rollup-linux-ppc64-gnu": "4.60.1", - "@rollup/rollup-linux-ppc64-musl": "4.60.1", - "@rollup/rollup-linux-riscv64-gnu": "4.60.1", - "@rollup/rollup-linux-riscv64-musl": "4.60.1", - "@rollup/rollup-linux-s390x-gnu": "4.60.1", - "@rollup/rollup-linux-x64-gnu": "4.60.1", - "@rollup/rollup-linux-x64-musl": "4.60.1", - "@rollup/rollup-openbsd-x64": "4.60.1", - "@rollup/rollup-openharmony-arm64": "4.60.1", - "@rollup/rollup-win32-arm64-msvc": "4.60.1", - "@rollup/rollup-win32-ia32-msvc": "4.60.1", - "@rollup/rollup-win32-x64-gnu": "4.60.1", - "@rollup/rollup-win32-x64-msvc": "4.60.1", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, @@ -4714,14 +4683,14 @@ "license": "MIT" }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "dev": true, "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -4906,12 +4875,21 @@ } }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "dev": true, "license": "MIT" }, + "node_modules/undici": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.26.0.tgz", + "integrity": "sha512-4yqz8a3n5HmGTlsbADNtr/dJlhkh/55Rq798G6ibiULcXbDtaLpTl1pvdqcbFfeoj3iSi52lePFM7h9H21cw/A==", + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", diff --git a/package.json b/package.json index c72d435..581a191 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "26.1.0", + "version": "26.2.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", @@ -52,6 +52,6 @@ }, "dependencies": { "json-bigint": "1.0.0", - "node-fetch-native-with-agent": "1.7.2" + "undici": "^6.26.0" } } diff --git a/src/client.ts b/src/client.ts index f5e360e..5bc4e36 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,5 +1,4 @@ -import { fetch, FormData, File } from 'node-fetch-native-with-agent'; -import { createAgent } from 'node-fetch-native-with-agent/agent'; +import { fetch, FormData, File, Agent, type RequestInit } from 'undici'; import { Models } from './models'; import { InputFile } from './inputFile'; import JSONbigModule from 'json-bigint'; @@ -74,7 +73,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/26.1.0'; + let ua = 'AppwriteNodeJSSDK/26.2.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -108,6 +107,7 @@ function getUserAgent() { class Client { static CHUNK_SIZE = 1024 * 1024 * 5; + private selfSignedAgent?: Agent; config = { endpoint: 'https://cloud.appwrite.io/v1', @@ -128,7 +128,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '26.1.0', + 'x-sdk-version': '26.2.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.9.5', }; @@ -170,6 +170,11 @@ class Client { this.config.selfSigned = selfSigned; + if (!selfSigned && this.selfSignedAgent) { + this.selfSignedAgent.destroy(); + this.selfSignedAgent = undefined; + } + return this; } @@ -359,9 +364,19 @@ class Client { let options: RequestInit = { method, headers, - ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }), }; + if (this.config.selfSigned) { + if (!this.selfSignedAgent) { + this.selfSignedAgent = new Agent({ + connect: { + rejectUnauthorized: false, + }, + }); + } + options.dispatcher = this.selfSignedAgent; + } + if (method === 'GET') { for (const [key, value] of Object.entries(Client.flatten(params))) { url.searchParams.append(key, value); diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts index 47125dd..927acf8 100644 --- a/src/enums/project-key-scopes.ts +++ b/src/enums/project-key-scopes.ts @@ -89,6 +89,7 @@ export enum ProjectKeyScopes { ArchivesWrite = 'archives.write', RestorationsRead = 'restorations.read', RestorationsWrite = 'restorations.write', + DedicatedDatabasesExecute = 'dedicatedDatabases.execute', DomainsRead = 'domains.read', DomainsWrite = 'domains.write', EventsRead = 'events.read', diff --git a/src/inputFile.ts b/src/inputFile.ts index 94afbe2..0545928 100644 --- a/src/inputFile.ts +++ b/src/inputFile.ts @@ -1,4 +1,4 @@ -import { File } from "node-fetch-native-with-agent"; +import { File } from "undici"; type FsPromises = { stat: (path: string) => Promise<{ size: number }>; diff --git a/src/models.ts b/src/models.ts index e081344..2c72952 100644 --- a/src/models.ts +++ b/src/models.ts @@ -2925,6 +2925,26 @@ export namespace Models { * Email verification status. */ emailVerification: boolean; + /** + * Canonical form of the user email address. + */ + emailCanonical?: string; + /** + * Whether the user email is from a free email provider. + */ + emailIsFree?: boolean; + /** + * Whether the user email is from a disposable email provider. + */ + emailIsDisposable?: boolean; + /** + * Whether the user email is from a corporate domain. + */ + emailIsCorporate?: boolean; + /** + * Whether the user email is in its canonical form. + */ + emailIsCanonical?: boolean; /** * Phone verification status. */ @@ -3576,6 +3596,10 @@ export namespace Models { * 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; + /** + * Most recent access date in ISO 8601 format. Show this attribute by toggling membership privacy in the Console. + */ + userAccessedAt: string; /** * User list of roles */ @@ -4264,6 +4288,10 @@ export namespace Models { * OAuth2 server allowed scopes */ oAuth2ServerScopes: string[]; + /** + * OAuth2 server accepted RFC 9396 authorization_details types + */ + oAuth2ServerAuthorizationDetailsTypes: string[]; /** * OAuth2 server access token duration in seconds for confidential clients */ @@ -4284,6 +4312,22 @@ export namespace Models { * When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. */ oAuth2ServerConfidentialPkce: boolean; + /** + * URL to your application page where users enter the device flow user code. Empty when the Device Authorization Grant is not configured. + */ + oAuth2ServerVerificationUrl: string; + /** + * Number of characters in the device flow user code, excluding the formatting separator. + */ + oAuth2ServerUserCodeLength: number; + /** + * Character set for device flow user codes: `numeric`, `alphabetic`, or `alphanumeric`. + */ + oAuth2ServerUserCodeFormat: string; + /** + * Lifetime in seconds of device flow device codes and user codes. + */ + oAuth2ServerDeviceCodeDuration: number; /** * OAuth2 server discovery URL */ @@ -5662,6 +5706,10 @@ export namespace Models { * Whether user MFA status is visible in memberships. */ userMFA: boolean; + /** + * Whether user last access time is visible in memberships. + */ + userAccessedAt: boolean; } /** diff --git a/src/services/account.ts b/src/services/account.ts index 4519e3f..474bfba 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -27,6 +27,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -111,6 +112,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -182,6 +184,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -242,6 +245,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -348,6 +352,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -408,6 +413,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -464,6 +470,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -518,6 +525,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -571,6 +579,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -636,6 +645,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -700,6 +710,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -864,6 +875,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -920,6 +932,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -988,6 +1001,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1055,6 +1069,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1080,6 +1095,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1104,6 +1120,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1129,6 +1146,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1153,6 +1171,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1179,6 +1198,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1204,6 +1224,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1230,6 +1251,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1255,6 +1277,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1311,6 +1334,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1375,6 +1399,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1442,6 +1467,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1466,6 +1492,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1522,6 +1549,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1589,6 +1617,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1670,6 +1699,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1694,6 +1724,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1744,6 +1775,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1815,6 +1847,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1883,6 +1916,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1951,6 +1985,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2018,6 +2053,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2070,6 +2106,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -2123,6 +2160,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2201,6 +2239,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2281,6 +2320,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2368,6 +2408,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2450,6 +2491,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'text/html', } return this.client.redirect( @@ -2521,6 +2563,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2583,6 +2626,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2646,6 +2690,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2713,6 +2758,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2781,6 +2827,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2806,6 +2853,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2873,6 +2921,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/activities.ts b/src/services/activities.ts index 0e86ab7..10b8062 100644 --- a/src/services/activities.ts +++ b/src/services/activities.ts @@ -52,6 +52,7 @@ export class Activities { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -106,6 +107,7 @@ export class Activities { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/advisor.ts b/src/services/advisor.ts index 2264c57..c735c29 100644 --- a/src/services/advisor.ts +++ b/src/services/advisor.ts @@ -62,6 +62,7 @@ export class Advisor { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -116,6 +117,7 @@ export class Advisor { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -240,6 +242,7 @@ export class Advisor { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -302,6 +305,7 @@ export class Advisor { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 2297c78..0e71d1a 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -85,6 +85,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } return this.client.call( @@ -166,6 +167,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } return this.client.call( @@ -226,6 +228,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } return this.client.call( @@ -307,6 +310,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } return this.client.call( @@ -386,6 +390,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } return this.client.call( @@ -471,6 +476,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } return this.client.call( @@ -551,6 +557,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } return this.client.call( @@ -749,6 +756,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } return this.client.call( diff --git a/src/services/backups.ts b/src/services/backups.ts index ea371f1..098db6d 100644 --- a/src/services/backups.ts +++ b/src/services/backups.ts @@ -53,6 +53,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -117,6 +118,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -169,6 +171,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -222,6 +225,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -274,6 +278,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -382,6 +387,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -434,6 +440,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -516,6 +523,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -569,6 +577,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -650,6 +659,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -702,6 +712,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -754,6 +765,7 @@ export class Backups { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/databases.ts b/src/services/databases.ts index 8f3b589..8107a94 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -72,6 +72,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -149,6 +150,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -201,6 +203,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -254,6 +257,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -306,6 +310,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -374,6 +379,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -488,6 +494,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -541,6 +548,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -610,6 +618,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -739,6 +748,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -849,6 +859,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -910,6 +921,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1007,6 +1019,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1144,6 +1157,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1256,6 +1270,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1368,6 +1383,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1466,6 +1482,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1562,6 +1579,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1658,6 +1676,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1754,6 +1773,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1852,6 +1872,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1950,6 +1971,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2058,6 +2080,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2166,6 +2189,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2278,6 +2302,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2390,6 +2415,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2502,6 +2528,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2614,6 +2641,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2712,6 +2740,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2810,6 +2839,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2899,6 +2929,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2992,6 +3023,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3096,6 +3128,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3193,6 +3226,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3297,6 +3331,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3394,6 +3429,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3483,6 +3519,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3576,6 +3613,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3665,6 +3703,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3758,6 +3797,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3870,6 +3910,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3955,6 +3996,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4070,6 +4112,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4175,6 +4218,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4279,6 +4323,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4376,6 +4421,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4474,6 +4520,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4572,6 +4619,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4686,6 +4734,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4790,6 +4839,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4858,6 +4908,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5016,6 +5067,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5112,6 +5164,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5191,6 +5244,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5272,6 +5326,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5355,6 +5410,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5431,6 +5487,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5513,6 +5570,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5603,6 +5661,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5693,6 +5752,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5866,6 +5926,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5963,6 +6024,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6038,6 +6100,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -6146,6 +6209,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6214,6 +6278,7 @@ export class Databases { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/functions.ts b/src/services/functions.ts index 9941b3c..1a0fb93 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -74,6 +74,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -284,6 +285,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -308,6 +310,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -332,6 +335,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -384,6 +388,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -588,6 +593,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -705,6 +711,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -779,6 +786,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -878,6 +886,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', + 'accept': 'application/json', } return this.client.chunkedUpload( @@ -950,6 +959,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1065,6 +1075,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1150,6 +1161,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1210,6 +1222,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1338,6 +1351,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } return this.client.call( @@ -1400,6 +1414,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1467,6 +1482,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1563,6 +1579,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1623,6 +1640,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1751,6 +1769,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1842,6 +1861,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1902,6 +1922,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1984,6 +2005,7 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/graphql.ts b/src/services/graphql.ts index 1dd39ff..741f45f 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -57,6 +57,7 @@ export class Graphql { 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -114,6 +115,7 @@ export class Graphql { 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/health.ts b/src/services/health.ts index 2100916..6b8ceda 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -25,6 +25,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -49,6 +50,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -74,6 +76,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -98,6 +101,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -150,6 +154,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -212,6 +217,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -236,6 +242,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -260,6 +267,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -314,6 +322,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -366,6 +375,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -418,6 +428,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -478,6 +489,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -530,6 +542,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -592,6 +605,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -644,6 +658,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -696,6 +711,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -748,6 +764,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -800,6 +817,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -852,6 +870,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -904,6 +923,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -956,6 +976,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1008,6 +1029,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1032,6 +1054,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1056,6 +1079,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1080,6 +1104,7 @@ export class Health { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/locale.ts b/src/services/locale.ts index c5abcf9..56b45d2 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -26,6 +26,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -50,6 +51,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -74,6 +76,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -98,6 +101,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -122,6 +126,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -146,6 +151,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -170,6 +176,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -194,6 +201,7 @@ export class Locale { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/messaging.ts b/src/services/messaging.ts index cddcf90..a1c719a 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -69,6 +69,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -209,6 +210,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -342,6 +344,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -525,6 +528,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -707,6 +711,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -810,6 +815,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -912,6 +918,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1011,6 +1018,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1109,6 +1117,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1163,6 +1172,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1283,6 +1293,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1350,6 +1361,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1417,6 +1429,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1527,6 +1540,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1636,6 +1650,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1740,6 +1755,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1843,6 +1859,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1925,6 +1942,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2006,6 +2024,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2082,6 +2101,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2157,6 +2177,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2280,6 +2301,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2397,6 +2419,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2492,6 +2515,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2581,6 +2605,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2690,6 +2715,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2793,6 +2819,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2902,6 +2929,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3005,6 +3033,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3128,6 +3157,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3245,6 +3275,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3400,6 +3431,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3554,6 +3586,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3700,6 +3733,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3845,6 +3879,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3940,6 +3975,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4029,6 +4065,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4124,6 +4161,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4213,6 +4251,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4308,6 +4347,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4397,6 +4437,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4492,6 +4533,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4581,6 +4623,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4635,6 +4678,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -4755,6 +4799,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -4822,6 +4867,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -4889,6 +4935,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -4963,6 +5010,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5017,6 +5065,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5087,6 +5136,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5207,6 +5257,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5281,6 +5332,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5355,6 +5407,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5417,6 +5470,7 @@ export class Messaging { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/organization.ts b/src/services/organization.ts index a3b4545..c28cc7b 100644 --- a/src/services/organization.ts +++ b/src/services/organization.ts @@ -62,6 +62,7 @@ export class Organization { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -146,6 +147,7 @@ export class Organization { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -198,6 +200,7 @@ export class Organization { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -279,6 +282,7 @@ export class Organization { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -399,6 +403,7 @@ export class Organization { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -473,6 +478,7 @@ export class Organization { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -589,6 +595,7 @@ export class Organization { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/presences.ts b/src/services/presences.ts index 939aa92..51fb984 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -69,6 +69,7 @@ export class Presences { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -123,6 +124,7 @@ export class Presences { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -220,6 +222,7 @@ export class Presences { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -321,6 +324,7 @@ export class Presences { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/project.ts b/src/services/project.ts index decbca9..45207af 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -123,6 +123,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -183,6 +184,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -271,6 +273,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -342,6 +345,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -394,6 +398,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -475,6 +480,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -584,6 +590,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -644,6 +651,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -711,6 +719,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -763,6 +772,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -827,6 +837,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -940,6 +951,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -956,60 +968,80 @@ export class Project { * @param {boolean} params.enabled - Enable or disable the OAuth2 server. * @param {string} params.authorizationUrl - URL to your application with consent screen. * @param {string[]} params.scopes - List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. + * @param {string[]} params.authorizationDetailsTypes - List of accepted `authorization_details` types. Maximum of 100 types are allowed, each up to 128 characters long. * @param {number} params.accessTokenDuration - Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. * @param {number} params.refreshTokenDuration - Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. * @param {number} params.publicAccessTokenDuration - Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. * @param {number} params.publicRefreshTokenDuration - Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. * @param {boolean} params.confidentialPkce - When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + * @param {string} params.verificationUrl - URL to your application page where users enter the device flow user code. Required to enable the Device Authorization Grant. + * @param {number} params.userCodeLength - Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. + * @param {string} params.userCodeFormat - Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. + * @param {number} params.deviceCodeDuration - Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean }): Promise; + updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number }): Promise; /** * Update the OAuth2 server (OIDC provider) configuration. * * @param {boolean} enabled - Enable or disable the OAuth2 server. * @param {string} authorizationUrl - URL to your application with consent screen. * @param {string[]} scopes - List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. + * @param {string[]} authorizationDetailsTypes - List of accepted `authorization_details` types. Maximum of 100 types are allowed, each up to 128 characters long. * @param {number} accessTokenDuration - Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. * @param {number} refreshTokenDuration - Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. * @param {number} publicAccessTokenDuration - Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. * @param {number} publicRefreshTokenDuration - Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. * @param {boolean} confidentialPkce - When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. + * @param {string} verificationUrl - URL to your application page where users enter the device flow user code. Required to enable the Device Authorization Grant. + * @param {number} userCodeLength - Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. + * @param {string} userCodeFormat - Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. + * @param {number} deviceCodeDuration - Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean): Promise; + updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number): Promise; updateOAuth2Server( - paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean } | boolean, - ...rest: [(string)?, (string[])?, (number)?, (number)?, (number)?, (number)?, (boolean)?] + paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number } | boolean, + ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?] ): Promise { - let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean }; + let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean }; + params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number }; } else { params = { enabled: paramsOrFirst as boolean, authorizationUrl: rest[0] as string, scopes: rest[1] as string[], - accessTokenDuration: rest[2] as number, - refreshTokenDuration: rest[3] as number, - publicAccessTokenDuration: rest[4] as number, - publicRefreshTokenDuration: rest[5] as number, - confidentialPkce: rest[6] as boolean + authorizationDetailsTypes: rest[2] as string[], + accessTokenDuration: rest[3] as number, + refreshTokenDuration: rest[4] as number, + publicAccessTokenDuration: rest[5] as number, + publicRefreshTokenDuration: rest[6] as number, + confidentialPkce: rest[7] as boolean, + verificationUrl: rest[8] as string, + userCodeLength: rest[9] as number, + userCodeFormat: rest[10] as string, + deviceCodeDuration: rest[11] as number }; } const enabled = params.enabled; const authorizationUrl = params.authorizationUrl; const scopes = params.scopes; + const authorizationDetailsTypes = params.authorizationDetailsTypes; const accessTokenDuration = params.accessTokenDuration; const refreshTokenDuration = params.refreshTokenDuration; const publicAccessTokenDuration = params.publicAccessTokenDuration; const publicRefreshTokenDuration = params.publicRefreshTokenDuration; const confidentialPkce = params.confidentialPkce; + const verificationUrl = params.verificationUrl; + const userCodeLength = params.userCodeLength; + const userCodeFormat = params.userCodeFormat; + const deviceCodeDuration = params.deviceCodeDuration; if (typeof enabled === 'undefined') { throw new AppwriteException('Missing required parameter: "enabled"'); @@ -1029,6 +1061,9 @@ export class Project { if (typeof scopes !== 'undefined') { payload['scopes'] = scopes; } + if (typeof authorizationDetailsTypes !== 'undefined') { + payload['authorizationDetailsTypes'] = authorizationDetailsTypes; + } if (typeof accessTokenDuration !== 'undefined') { payload['accessTokenDuration'] = accessTokenDuration; } @@ -1044,11 +1079,24 @@ export class Project { if (typeof confidentialPkce !== 'undefined') { payload['confidentialPkce'] = confidentialPkce; } + if (typeof verificationUrl !== 'undefined') { + payload['verificationUrl'] = verificationUrl; + } + if (typeof userCodeLength !== 'undefined') { + payload['userCodeLength'] = userCodeLength; + } + if (typeof userCodeFormat !== 'undefined') { + payload['userCodeFormat'] = userCodeFormat; + } + if (typeof deviceCodeDuration !== 'undefined') { + payload['deviceCodeDuration'] = deviceCodeDuration; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1117,6 +1165,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1199,6 +1248,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1274,6 +1324,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1349,6 +1400,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1417,6 +1469,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1485,6 +1538,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1553,6 +1607,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1621,6 +1676,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1689,6 +1745,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1757,6 +1814,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1825,6 +1883,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1893,6 +1952,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1961,6 +2021,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2029,6 +2090,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2097,6 +2159,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2172,6 +2235,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2240,6 +2304,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2315,6 +2380,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2390,6 +2456,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2472,6 +2539,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2540,6 +2608,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2608,6 +2677,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2683,6 +2753,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2751,6 +2822,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2847,6 +2919,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2929,6 +3002,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2997,6 +3071,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3065,6 +3140,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3133,6 +3209,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3201,6 +3278,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3269,6 +3347,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3337,6 +3416,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3405,6 +3485,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3473,6 +3554,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3541,6 +3623,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3609,6 +3692,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3677,6 +3761,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3745,6 +3830,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3813,6 +3899,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3881,6 +3968,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3949,6 +4037,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4017,6 +4106,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4069,6 +4159,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -4129,6 +4220,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -4206,6 +4298,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4280,6 +4373,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4357,6 +4451,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4431,6 +4526,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4508,6 +4604,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4582,6 +4679,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4659,6 +4757,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4733,6 +4832,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4810,6 +4910,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4884,6 +4985,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4936,6 +5038,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5049,6 +5152,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5105,6 +5209,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5161,6 +5266,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5217,6 +5323,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5235,10 +5342,11 @@ export class Project { * @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. + * @param {boolean} params.userAccessedAt - Set to true if you want make user last access time visible to all team members, or false to hide it. * @throws {AppwriteException} * @returns {Promise} */ - updateMembershipPrivacyPolicy(params?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }): Promise; + updateMembershipPrivacyPolicy(params?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean }): Promise; /** * 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.. * @@ -5247,26 +5355,28 @@ export class Project { * @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. + * @param {boolean} userAccessedAt - Set to true if you want make user last access time visible to all team members, or false to hide it. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMembershipPrivacyPolicy(userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean): Promise; + updateMembershipPrivacyPolicy(userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean): Promise; updateMembershipPrivacyPolicy( - paramsOrFirst?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean } | boolean, - ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?] + paramsOrFirst?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean } | boolean, + ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?, (boolean)?] ): Promise { - let params: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; + let params: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; + params = (paramsOrFirst || {}) as { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: 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 + userMFA: rest[3] as boolean, + userAccessedAt: rest[4] as boolean }; } @@ -5275,6 +5385,7 @@ export class Project { const userPhone = params.userPhone; const userName = params.userName; const userMFA = params.userMFA; + const userAccessedAt = params.userAccessedAt; const apiPath = '/project/policies/membership-privacy'; @@ -5294,11 +5405,15 @@ export class Project { if (typeof userMFA !== 'undefined') { payload['userMFA'] = userMFA; } + if (typeof userAccessedAt !== 'undefined') { + payload['userAccessedAt'] = userAccessedAt; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5355,6 +5470,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5415,6 +5531,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5471,6 +5588,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5553,6 +5671,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5609,6 +5728,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5665,6 +5785,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5721,6 +5842,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5777,6 +5899,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5833,6 +5956,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5885,6 +6009,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5949,6 +6074,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6013,6 +6139,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6130,6 +6257,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6246,6 +6374,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -6352,6 +6481,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6412,6 +6542,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -6472,6 +6603,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -6556,6 +6688,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6608,6 +6741,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -6683,6 +6817,7 @@ export class Project { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/proxy.ts b/src/services/proxy.ts index b5a90b5..b2c53fa 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -62,6 +62,7 @@ export class Proxy { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -122,6 +123,7 @@ export class Proxy { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -200,6 +202,7 @@ export class Proxy { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -301,6 +304,7 @@ export class Proxy { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -379,6 +383,7 @@ export class Proxy { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -431,6 +436,7 @@ export class Proxy { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -537,6 +543,7 @@ export class Proxy { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/sites.ts b/src/services/sites.ts index 6d6cdce..0de414a 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -74,6 +74,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -294,6 +295,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -318,6 +320,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -342,6 +345,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -394,6 +398,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -608,6 +613,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -725,6 +731,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -799,6 +806,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -894,6 +902,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', + 'accept': 'application/json', } return this.client.chunkedUpload( @@ -959,6 +968,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1074,6 +1084,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1159,6 +1170,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1219,6 +1231,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1347,6 +1360,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } return this.client.call( @@ -1409,6 +1423,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1476,6 +1491,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1536,6 +1552,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1597,6 +1614,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1664,6 +1682,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1755,6 +1774,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1815,6 +1835,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1897,6 +1918,7 @@ export class Sites { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/storage.ts b/src/services/storage.ts index e9b4d62..f4ae7a0 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -71,6 +71,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -201,6 +202,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -253,6 +255,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -380,6 +383,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -507,6 +511,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -605,6 +610,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', + 'accept': 'application/json', } return this.client.chunkedUpload( @@ -666,6 +672,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -741,6 +748,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -869,6 +877,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } return this.client.call( @@ -1014,6 +1023,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } return this.client.call( @@ -1082,6 +1092,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } return this.client.call( diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 811cd77..aa4248f 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -71,6 +71,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -147,6 +148,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -199,6 +201,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -252,6 +255,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -304,6 +308,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -372,6 +377,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -486,6 +492,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -538,6 +545,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -606,6 +614,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -733,6 +742,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -842,6 +852,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -902,6 +913,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -998,6 +1010,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1133,6 +1146,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1244,6 +1258,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1355,6 +1370,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1452,6 +1468,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1547,6 +1564,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1642,6 +1660,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1737,6 +1756,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1834,6 +1854,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1931,6 +1952,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2036,6 +2058,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2143,6 +2166,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2254,6 +2278,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2365,6 +2390,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2476,6 +2502,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2587,6 +2614,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2684,6 +2712,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2781,6 +2810,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2869,6 +2899,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2961,6 +2992,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3065,6 +3097,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3162,6 +3195,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3266,6 +3300,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3363,6 +3398,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3451,6 +3487,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3543,6 +3580,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3631,6 +3669,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3723,6 +3762,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3834,6 +3874,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3949,6 +3990,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4054,6 +4096,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4158,6 +4201,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4255,6 +4299,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4352,6 +4397,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4449,6 +4495,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4563,6 +4610,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4667,6 +4715,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4734,6 +4783,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -4886,6 +4936,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -4960,6 +5011,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5067,6 +5119,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5134,6 +5187,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5290,6 +5344,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5385,6 +5440,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5463,6 +5519,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5543,6 +5600,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5625,6 +5683,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5700,6 +5759,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5781,6 +5841,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5870,6 +5931,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5959,6 +6021,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6130,6 +6193,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6226,6 +6290,7 @@ export class TablesDB { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/teams.ts b/src/services/teams.ts index 9c298cb..3a77c58 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -67,6 +67,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -141,6 +142,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -193,6 +195,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -257,6 +260,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -384,6 +388,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -497,6 +502,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -557,6 +563,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -630,6 +637,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -778,6 +786,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -830,6 +839,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -894,6 +904,7 @@ export class Teams { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/tokens.ts b/src/services/tokens.ts index 368d4a1..18b0fed 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -74,6 +74,7 @@ export class Tokens { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -142,6 +143,7 @@ export class Tokens { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -194,6 +196,7 @@ export class Tokens { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -255,6 +258,7 @@ export class Tokens { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/usage.ts b/src/services/usage.ts index 43499c7..f7d485e 100644 --- a/src/services/usage.ts +++ b/src/services/usage.ts @@ -60,6 +60,7 @@ export class Usage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -120,6 +121,7 @@ export class Usage { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/users.ts b/src/services/users.ts index 61f85f9..44a107a 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -70,6 +70,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -155,6 +156,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -239,6 +241,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -323,6 +326,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -390,6 +394,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -527,6 +532,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -611,6 +617,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -745,6 +752,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -859,6 +867,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -950,6 +959,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1002,6 +1012,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1119,6 +1130,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1185,6 +1197,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1253,6 +1266,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1321,6 +1335,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1388,6 +1403,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1462,6 +1478,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1527,6 +1544,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1591,6 +1609,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1767,6 +1786,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1819,6 +1839,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1872,6 +1893,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1924,6 +1946,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1978,6 +2001,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2031,6 +2055,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2085,6 +2110,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2138,6 +2164,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2202,6 +2229,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2266,6 +2294,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2330,6 +2359,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2382,6 +2412,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -2446,6 +2477,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2506,6 +2538,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -2563,6 +2596,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2741,6 +2775,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2808,6 +2843,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -2906,6 +2942,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2966,6 +3003,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -3048,6 +3086,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3179,6 +3218,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3243,6 +3283,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3307,6 +3348,7 @@ export class Users { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts index f73792e..cf096f8 100644 --- a/src/services/webhooks.ts +++ b/src/services/webhooks.ts @@ -60,6 +60,7 @@ export class Webhooks { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -182,6 +183,7 @@ export class Webhooks { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -234,6 +236,7 @@ export class Webhooks { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -346,6 +349,7 @@ export class Webhooks { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -460,6 +464,7 @@ export class Webhooks { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( diff --git a/test/client.test.js b/test/client.test.js new file mode 100644 index 0000000..0e10914 --- /dev/null +++ b/test/client.test.js @@ -0,0 +1,34 @@ +const { Client } = require("../dist/client"); +const { fetch: mockedFetch, Response, Dispatcher } = require("undici"); + +jest.mock("undici", () => ({ ...jest.requireActual("undici"), fetch: jest.fn() })); + +describe("Client", () => { + beforeEach(() => { + mockedFetch.mockReset(); + mockedFetch.mockImplementation(() => Response.json({ ok: true })); + }); + + test("does not include a dispatcher by default", async () => { + const client = new Client(); + + await client.call("GET", new URL("https://cloud.appwrite.io/v1/health")); + + expect(mockedFetch).toHaveBeenCalledTimes(1); + expect(mockedFetch.mock.calls[0][1]).not.toHaveProperty("dispatcher"); + }); + + test("includes a dispatcher for self-signed requests", async () => { + const client = new Client(); + client.setSelfSigned(true); + + try { + await client.call("GET", new URL("https://self-hosted.example/v1/health")); + + expect(mockedFetch).toHaveBeenCalledTimes(1); + expect(mockedFetch.mock.calls[0][1].dispatcher).toBeInstanceOf(Dispatcher); + } finally { + client.setSelfSigned(false); + } + }); +}); diff --git a/test/services/account.test.js b/test/services/account.test.js index a9bbd59..f13cbde 100644 --- a/test/services/account.test.js +++ b/test/services/account.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Account } = require("../../dist/services/account"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Account', () => { const client = new Client(); diff --git a/test/services/activities.test.js b/test/services/activities.test.js index 08d0d90..e7c258a 100644 --- a/test/services/activities.test.js +++ b/test/services/activities.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Activities } = require("../../dist/services/activities"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Activities', () => { const client = new Client(); diff --git a/test/services/advisor.test.js b/test/services/advisor.test.js index 5160f13..401e34a 100644 --- a/test/services/advisor.test.js +++ b/test/services/advisor.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Advisor } = require("../../dist/services/advisor"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Advisor', () => { const client = new Client(); diff --git a/test/services/avatars.test.js b/test/services/avatars.test.js index ea4f379..56da275 100644 --- a/test/services/avatars.test.js +++ b/test/services/avatars.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Avatars } = require("../../dist/services/avatars"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Avatars', () => { const client = new Client(); diff --git a/test/services/backups.test.js b/test/services/backups.test.js index c888402..a5e5599 100644 --- a/test/services/backups.test.js +++ b/test/services/backups.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Backups } = require("../../dist/services/backups"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Backups', () => { const client = new Client(); diff --git a/test/services/databases.test.js b/test/services/databases.test.js index 241f44f..2b20a4f 100644 --- a/test/services/databases.test.js +++ b/test/services/databases.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Databases } = require("../../dist/services/databases"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Databases', () => { const client = new Client(); diff --git a/test/services/functions.test.js b/test/services/functions.test.js index 02dd3d2..e805931 100644 --- a/test/services/functions.test.js +++ b/test/services/functions.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Functions } = require("../../dist/services/functions"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Functions', () => { const client = new Client(); diff --git a/test/services/graphql.test.js b/test/services/graphql.test.js index da7e49b..6f2577d 100644 --- a/test/services/graphql.test.js +++ b/test/services/graphql.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Graphql } = require("../../dist/services/graphql"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Graphql', () => { const client = new Client(); diff --git a/test/services/health.test.js b/test/services/health.test.js index afbf5fa..3e306fe 100644 --- a/test/services/health.test.js +++ b/test/services/health.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Health } = require("../../dist/services/health"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Health', () => { const client = new Client(); diff --git a/test/services/locale.test.js b/test/services/locale.test.js index 51ef111..675b715 100644 --- a/test/services/locale.test.js +++ b/test/services/locale.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Locale } = require("../../dist/services/locale"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Locale', () => { const client = new Client(); diff --git a/test/services/messaging.test.js b/test/services/messaging.test.js index 3951633..1a08800 100644 --- a/test/services/messaging.test.js +++ b/test/services/messaging.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Messaging } = require("../../dist/services/messaging"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Messaging', () => { const client = new Client(); diff --git a/test/services/organization.test.js b/test/services/organization.test.js index f5bf2d2..a2a6a29 100644 --- a/test/services/organization.test.js +++ b/test/services/organization.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Organization } = require("../../dist/services/organization"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Organization', () => { const client = new Client(); @@ -158,11 +158,16 @@ describe('Organization', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -208,11 +213,16 @@ describe('Organization', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -257,11 +267,16 @@ describe('Organization', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); diff --git a/test/services/presences.test.js b/test/services/presences.test.js index e6e25bb..5f570cc 100644 --- a/test/services/presences.test.js +++ b/test/services/presences.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Presences } = require("../../dist/services/presences"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Presences', () => { const client = new Client(); diff --git a/test/services/project.test.js b/test/services/project.test.js index 6d825d4..d644e0d 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Project } = require("../../dist/services/project"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Project', () => { const client = new Client(); @@ -41,11 +41,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -102,11 +107,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -278,11 +288,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -427,11 +442,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1510,11 +1530,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1559,11 +1584,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1608,11 +1638,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1657,11 +1692,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1705,11 +1745,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1754,11 +1799,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1803,11 +1853,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1871,11 +1926,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1920,11 +1980,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1969,11 +2034,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -2018,11 +2088,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -2067,11 +2142,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -2132,11 +2212,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -2182,11 +2267,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -2232,11 +2322,16 @@ describe('Project', () => { 'oAuth2ServerEnabled': true, 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', 'oAuth2ServerScopes': [], + 'oAuth2ServerAuthorizationDetailsTypes': [], 'oAuth2ServerAccessTokenDuration': 3600, 'oAuth2ServerRefreshTokenDuration': 86400, 'oAuth2ServerPublicAccessTokenDuration': 3600, 'oAuth2ServerPublicRefreshTokenDuration': 2592000, 'oAuth2ServerConfidentialPkce': true, + 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', + 'oAuth2ServerUserCodeLength': 8, + 'oAuth2ServerUserCodeFormat': 'alphanumeric', + 'oAuth2ServerDeviceCodeDuration': 600, 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; mockedFetch.mockImplementation(() => Response.json(data)); diff --git a/test/services/proxy.test.js b/test/services/proxy.test.js index 05a556f..57aa087 100644 --- a/test/services/proxy.test.js +++ b/test/services/proxy.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Proxy } = require("../../dist/services/proxy"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Proxy', () => { const client = new Client(); diff --git a/test/services/sites.test.js b/test/services/sites.test.js index 64525f1..402a5d5 100644 --- a/test/services/sites.test.js +++ b/test/services/sites.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Sites } = require("../../dist/services/sites"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Sites', () => { const client = new Client(); diff --git a/test/services/storage.test.js b/test/services/storage.test.js index 5b28529..ce79f08 100644 --- a/test/services/storage.test.js +++ b/test/services/storage.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Storage } = require("../../dist/services/storage"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Storage', () => { const client = new Client(); diff --git a/test/services/tables-d-b.test.js b/test/services/tables-d-b.test.js index 5c89adc..513c5b7 100644 --- a/test/services/tables-d-b.test.js +++ b/test/services/tables-d-b.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { TablesDB } = require("../../dist/services/tables-db"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('TablesDB', () => { const client = new Client(); diff --git a/test/services/teams.test.js b/test/services/teams.test.js index dcb4055..0054c3e 100644 --- a/test/services/teams.test.js +++ b/test/services/teams.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Teams } = require("../../dist/services/teams"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Teams', () => { const client = new Client(); @@ -132,6 +132,7 @@ describe('Teams', () => { 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, 'mfa': true, + 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', 'roles': [],}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -161,6 +162,7 @@ describe('Teams', () => { 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, 'mfa': true, + 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', 'roles': [],}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -190,6 +192,7 @@ describe('Teams', () => { 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, 'mfa': true, + 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', 'roles': [],}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -235,6 +238,7 @@ describe('Teams', () => { 'joined': '2020-10-15T06:38:00.000+00:00', 'confirm': true, 'mfa': true, + 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', 'roles': [],}; mockedFetch.mockImplementation(() => Response.json(data)); diff --git a/test/services/tokens.test.js b/test/services/tokens.test.js index 000f188..491ddbf 100644 --- a/test/services/tokens.test.js +++ b/test/services/tokens.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Tokens } = require("../../dist/services/tokens"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Tokens', () => { const client = new Client(); diff --git a/test/services/usage.test.js b/test/services/usage.test.js index 0d0428f..44efb8e 100644 --- a/test/services/usage.test.js +++ b/test/services/usage.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Usage } = require("../../dist/services/usage"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Usage', () => { const client = new Client(); diff --git a/test/services/users.test.js b/test/services/users.test.js index cb5441a..7513e57 100644 --- a/test/services/users.test.js +++ b/test/services/users.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Users } = require("../../dist/services/users"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Users', () => { const client = new Client(); diff --git a/test/services/webhooks.test.js b/test/services/webhooks.test.js index 01e7abd..7fb1338 100644 --- a/test/services/webhooks.test.js +++ b/test/services/webhooks.test.js @@ -2,8 +2,8 @@ const { Client } = require("../../dist/client"); const { InputFile } = require("../../dist/inputFile"); const { Webhooks } = require("../../dist/services/webhooks"); -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); describe('Webhooks', () => { const client = new Client(); From 8177977a50a0ca788190ccb89cf662c4dbc47ceb Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 13 Jul 2026 10:47:06 +0530 Subject: [PATCH 02/11] chore: update Node.js SDK to 27.0.0 --- .github/workflows/publish.yml | 3 +- CHANGELOG.md | 18 + docs/examples/account/create.md | 2 +- docs/examples/account/update-password.md | 4 +- docs/examples/account/update-recovery.md | 2 +- docs/examples/backups/create-restoration.md | 3 +- .../functions/get-deployment-download.md | 3 +- .../examples/functions/list-specifications.md | 4 +- docs/examples/health/get-audits-db.md | 12 - docs/examples/health/get-cache.md | 12 - docs/examples/health/get-db.md | 12 - docs/examples/health/get-failed-jobs.md | 15 - docs/examples/health/get-pub-sub.md | 12 - docs/examples/health/get-queue-databases.md | 15 - docs/examples/health/get-queue-deletes.md | 14 - docs/examples/health/get-queue-functions.md | 14 - docs/examples/health/get-queue-logs.md | 14 - docs/examples/health/get-queue-mails.md | 14 - docs/examples/health/get-queue-messaging.md | 14 - docs/examples/health/get-queue-migrations.md | 14 - .../health/get-queue-stats-resources.md | 14 - docs/examples/health/get-queue-usage.md | 14 - docs/examples/health/get-queue-webhooks.md | 14 - docs/examples/health/get-storage-local.md | 12 - docs/examples/health/get-storage.md | 12 - docs/examples/health/get-time.md | 12 - .../messaging/create-smtp-provider.md | 2 +- docs/examples/messaging/list-provider-logs.md | 16 - .../messaging/list-subscriber-logs.md | 16 - docs/examples/messaging/list-topic-logs.md | 16 - .../messaging/update-smtp-provider.md | 2 +- .../organization/create-membership.md | 19 + .../delete-membership.md} | 6 +- .../delete.md} | 4 +- .../get-membership.md} | 6 +- docs/examples/{health => organization}/get.md | 4 +- .../list-memberships.md} | 6 +- .../organization/update-membership.md | 15 + .../update.md} | 6 +- .../update-deny-corporate-email-policy.md} | 6 +- .../update-o-auth-2-appwrite.md} | 9 +- docs/examples/project/update-o-auth-2-oidc.md | 2 + .../project/update-o-auth-2-server.md | 3 +- docs/examples/project/update-smtp.md | 2 +- docs/examples/sites/list-specifications.md | 4 +- docs/examples/tablesdb/create.md | 3 +- docs/examples/usage/list-events.md | 15 - docs/examples/usage/list-gauges.md | 15 - docs/examples/users/create.md | 2 +- docs/examples/users/update-password.md | 2 +- docs/examples/webhooks/create.md | 2 +- docs/examples/webhooks/update.md | 2 +- package-lock.json | 3197 ++++++++++------- package.json | 16 +- src/client.ts | 26 +- src/enums/billing-plan-group.ts | 5 + src/enums/database-status.ts | 5 + src/enums/health-antivirus-status.ts | 5 - src/enums/health-check-status.ts | 4 - src/enums/health-queue-name.ts | 15 - src/enums/o-auth-2-oidc-prompt.ts | 6 + src/enums/o-auth-provider.ts | 1 + src/enums/organization-key-scopes.ts | 4 + src/enums/project-key-scopes.ts | 8 +- src/enums/project-o-auth-2-oidc-prompt.ts | 6 + src/enums/project-o-auth-provider-id.ts | 1 + src/enums/project-policy-id.ts | 1 + src/enums/project-service-id.ts | 1 + src/index.ts | 9 +- src/models.ts | 1233 +++++-- src/query.ts | 30 + src/services/account.ts | 26 +- src/services/activities.ts | 2 +- src/services/advisor.ts | 8 +- src/services/avatars.ts | 6 +- src/services/backups.ts | 39 +- src/services/databases.ts | 256 +- src/services/functions.ts | 103 +- src/services/health.ts | 1117 ------ src/services/messaging.ts | 334 +- src/services/organization.ts | 463 ++- src/services/presences.ts | 8 +- src/services/project.ts | 250 +- src/services/proxy.ts | 6 +- src/services/sites.ts | 72 +- src/services/storage.ts | 22 +- src/services/tables-db.ts | 263 +- src/services/teams.ts | 22 +- src/services/tokens.ts | 10 +- src/services/usage.ts | 134 - src/services/users.ts | 82 +- src/services/webhooks.ts | 8 +- test/services/account.test.js | 6 +- test/services/activities.test.js | 16 +- test/services/backups.test.js | 7 +- test/services/health.test.js | 383 -- test/services/messaging.test.js | 64 - test/services/organization.test.js | 282 +- test/services/project.test.js | 422 +-- test/services/usage.test.js | 42 - test/services/users.test.js | 2 +- test/services/webhooks.test.js | 8 +- 102 files changed, 4656 insertions(+), 4844 deletions(-) delete mode 100644 docs/examples/health/get-audits-db.md delete mode 100644 docs/examples/health/get-cache.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-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/messaging/list-provider-logs.md delete mode 100644 docs/examples/messaging/list-subscriber-logs.md delete mode 100644 docs/examples/messaging/list-topic-logs.md create mode 100644 docs/examples/organization/create-membership.md rename docs/examples/{health/get-queue-certificates.md => organization/delete-membership.md} (66%) rename docs/examples/{health/get-antivirus.md => organization/delete.md} (74%) rename docs/examples/{health/get-queue-builds.md => organization/get-membership.md} (67%) rename docs/examples/{health => organization}/get.md (75%) rename docs/examples/{messaging/list-message-logs.md => organization/list-memberships.md} (71%) create mode 100644 docs/examples/organization/update-membership.md rename docs/examples/{health/get-certificate.md => organization/update.md} (71%) rename docs/examples/{health/get-queue-audits.md => project/update-deny-corporate-email-policy.md} (69%) rename docs/examples/{health/get-console-pausing.md => project/update-o-auth-2-appwrite.md} (57%) delete mode 100644 docs/examples/usage/list-events.md delete mode 100644 docs/examples/usage/list-gauges.md create mode 100644 src/enums/billing-plan-group.ts create mode 100644 src/enums/database-status.ts delete mode 100644 src/enums/health-antivirus-status.ts delete mode 100644 src/enums/health-check-status.ts delete mode 100644 src/enums/health-queue-name.ts create mode 100644 src/enums/o-auth-2-oidc-prompt.ts create mode 100644 src/enums/project-o-auth-2-oidc-prompt.ts delete mode 100644 src/services/health.ts delete mode 100644 src/services/usage.ts delete mode 100644 test/services/health.test.js delete mode 100644 test/services/usage.test.js diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ee63d52..48121d6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -34,9 +34,10 @@ jobs: echo "tag=latest" >> "$GITHUB_OUTPUT" fi - - name: Install dependencies and build + - name: Install dependencies, audit, and build run: | npm ci + npm audit --audit-level=high --omit=dev npm run build - name: Publish diff --git a/CHANGELOG.md b/CHANGELOG.md index f7617e5..7b9de72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## 27.0.0 + +* Breaking: removed `Health` service, health enums, and health response models +* Breaking: removed `Usage` service and `UsageEvent`/`UsageGauge` models +* Breaking: removed messaging `listMessageLogs`, `listProviderLogs`, `listSubscriberLogs`, `listTopicLogs` methods +* Added: `Organization` `get`, `update`, `delete`, and membership CRUD methods +* Added: `Query.vectorCosine`, `Query.vectorDot`, `Query.vectorEuclidean` vector filters +* Added: `Client.setBearer` for OAuth access token authentication +* Added: `updateOAuth2Appwrite` and `updateDenyCorporateEmailPolicy` project methods +* Added: `prompt` and `maxAge` params to `updateOAuth2Oidc`, `defaultScopes` to `updateOAuth2Server` +* Added: `token` param to `getDeploymentDownload`, `type` to `listSpecifications` +* Added: `newSpecification` param to `createRestoration`, `specification` to `tablesDB.create` +* Added: `BillingPlanGroup`, `DatabaseStatus`, `OAuth2OidcPrompt`, `ProjectOAuth2OidcPrompt` enums +* Added: `Appwrite` OAuth provider, `stages` and `project.oauth2` key scopes +* Added: `Organization`, `BillingPlan`, `OAuth2Appwrite`, `PolicyDenyCorporateEmail` models +* Fixed: URL-encoded path parameters in organization key/project endpoints +* Updated: spatial attribute/column `xdefault` types narrowed to `number[]`/`any[][]` + ## 26.2.0 * Added: Device Authorization Grant params (`verificationUrl`, `userCodeLength`, `userCodeFormat`, `deviceCodeDuration`) to `updateOAuth2Server` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index db31f30..abc8c13 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -11,7 +11,7 @@ const account = new sdk.Account(client); const result = await account.create({ userId: '', email: 'email@example.com', - password: '', + password: 'password', name: '' // optional }); ``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 0e6cd7b..d359b34 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.updatePassword({ - password: '', - oldPassword: '' // optional + password: 'password', + oldPassword: 'password' // optional }); ``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 268f3e9..9008f67 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -11,6 +11,6 @@ const account = new sdk.Account(client); const result = await account.updateRecovery({ userId: '', secret: '', - password: '' + password: 'password' }); ``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index f41a234..6a8096a 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -12,6 +12,7 @@ const result = await backups.createRestoration({ archiveId: '', services: [sdk.BackupServices.Databases], newResourceId: '', // optional - newResourceName: '' // optional + newResourceName: '', // optional + newSpecification: 'serverless' // optional }); ``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index 5e9a956..6a75bad 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -11,6 +11,7 @@ const functions = new sdk.Functions(client); const result = await functions.getDeploymentDownload({ functionId: '', deploymentId: '', - type: sdk.DeploymentDownloadType.Source // optional + type: sdk.DeploymentDownloadType.Source, // optional + token: '' // optional }); ``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index 0fc8b8d..f9bb52b 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const functions = new sdk.Functions(client); -const result = await functions.listSpecifications(); +const result = await functions.listSpecifications({ + type: 'runtimes' // optional +}); ``` diff --git a/docs/examples/health/get-audits-db.md b/docs/examples/health/get-audits-db.md deleted file mode 100644 index 50d2eff..0000000 --- a/docs/examples/health/get-audits-db.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getAuditsDB(); -``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md deleted file mode 100644 index a952506..0000000 --- a/docs/examples/health/get-cache.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getCache(); -``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md deleted file mode 100644 index 45a840c..0000000 --- a/docs/examples/health/get-db.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getDB(); -``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md deleted file mode 100644 index 3f41e63..0000000 --- a/docs/examples/health/get-failed-jobs.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getFailedJobs({ - name: sdk.HealthQueueName.V1Database, - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md deleted file mode 100644 index c03bb59..0000000 --- a/docs/examples/health/get-pub-sub.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getPubSub(); -``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md deleted file mode 100644 index 181621e..0000000 --- a/docs/examples/health/get-queue-databases.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueDatabases({ - name: '', // optional - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md deleted file mode 100644 index e1b5bc0..0000000 --- a/docs/examples/health/get-queue-deletes.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueDeletes({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md deleted file mode 100644 index f40904a..0000000 --- a/docs/examples/health/get-queue-functions.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueFunctions({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md deleted file mode 100644 index 437a86b..0000000 --- a/docs/examples/health/get-queue-logs.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueLogs({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md deleted file mode 100644 index 3da627b..0000000 --- a/docs/examples/health/get-queue-mails.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueMails({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md deleted file mode 100644 index 504ad1d..0000000 --- a/docs/examples/health/get-queue-messaging.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueMessaging({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md deleted file mode 100644 index 59e4550..0000000 --- a/docs/examples/health/get-queue-migrations.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueMigrations({ - threshold: null // optional -}); -``` 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 542d11e..0000000 --- a/docs/examples/health/get-queue-stats-resources.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueStatsResources({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md deleted file mode 100644 index 86dbfb8..0000000 --- a/docs/examples/health/get-queue-usage.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueUsage({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md deleted file mode 100644 index 36c3037..0000000 --- a/docs/examples/health/get-queue-webhooks.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueWebhooks({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md deleted file mode 100644 index 1593339..0000000 --- a/docs/examples/health/get-storage-local.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getStorageLocal(); -``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md deleted file mode 100644 index 75ec5cb..0000000 --- a/docs/examples/health/get-storage.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getStorage(); -``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md deleted file mode 100644 index 86d8617..0000000 --- a/docs/examples/health/get-time.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getTime(); -``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index e17fdc1..b980c3b 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -14,7 +14,7 @@ const result = await messaging.createSMTPProvider({ host: '', port: 1, // optional username: '', // optional - password: '', // optional + password: 'password', // optional encryption: sdk.SmtpEncryption.None, // optional autoTLS: false, // optional mailer: '', // optional diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md deleted file mode 100644 index 92b4c2f..0000000 --- a/docs/examples/messaging/list-provider-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listProviderLogs({ - providerId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md deleted file mode 100644 index 2f89225..0000000 --- a/docs/examples/messaging/list-subscriber-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listSubscriberLogs({ - subscriberId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md deleted file mode 100644 index ee76366..0000000 --- a/docs/examples/messaging/list-topic-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listTopicLogs({ - topicId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index d860736..1b0ec72 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -14,7 +14,7 @@ const result = await messaging.updateSMTPProvider({ host: '', // optional port: 1, // optional username: '', // optional - password: '', // optional + password: 'password', // optional encryption: sdk.SmtpEncryption.None, // optional autoTLS: false, // optional mailer: '', // optional diff --git a/docs/examples/organization/create-membership.md b/docs/examples/organization/create-membership.md new file mode 100644 index 0000000..02450ab --- /dev/null +++ b/docs/examples/organization/create-membership.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.createMembership({ + roles: [], + email: 'email@example.com', // optional + userId: '', // optional + phone: '+12065550100', // optional + url: 'https://example.com', // optional + name: '' // optional +}); +``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/organization/delete-membership.md similarity index 66% rename from docs/examples/health/get-queue-certificates.md rename to docs/examples/organization/delete-membership.md index ef065d5..174ffc3 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/organization/delete-membership.md @@ -6,9 +6,9 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const organization = new sdk.Organization(client); -const result = await health.getQueueCertificates({ - threshold: null // optional +const result = await organization.deleteMembership({ + membershipId: '' }); ``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/organization/delete.md similarity index 74% rename from docs/examples/health/get-antivirus.md rename to docs/examples/organization/delete.md index 3f0c834..79b8e08 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/organization/delete.md @@ -6,7 +6,7 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const organization = new sdk.Organization(client); -const result = await health.getAntivirus(); +const result = await organization.delete(); ``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/organization/get-membership.md similarity index 67% rename from docs/examples/health/get-queue-builds.md rename to docs/examples/organization/get-membership.md index da49e02..42f6070 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/organization/get-membership.md @@ -6,9 +6,9 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const organization = new sdk.Organization(client); -const result = await health.getQueueBuilds({ - threshold: null // optional +const result = await organization.getMembership({ + membershipId: '' }); ``` diff --git a/docs/examples/health/get.md b/docs/examples/organization/get.md similarity index 75% rename from docs/examples/health/get.md rename to docs/examples/organization/get.md index bfb883b..3b156dd 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/organization/get.md @@ -6,7 +6,7 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const organization = new sdk.Organization(client); -const result = await health.get(); +const result = await organization.get(); ``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/organization/list-memberships.md similarity index 71% rename from docs/examples/messaging/list-message-logs.md rename to docs/examples/organization/list-memberships.md index c9c8a47..594cfd1 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/organization/list-memberships.md @@ -6,11 +6,11 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const messaging = new sdk.Messaging(client); +const organization = new sdk.Organization(client); -const result = await messaging.listMessageLogs({ - messageId: '', +const result = await organization.listMemberships({ queries: [], // optional + search: '', // optional total: false // optional }); ``` diff --git a/docs/examples/organization/update-membership.md b/docs/examples/organization/update-membership.md new file mode 100644 index 0000000..17d7e17 --- /dev/null +++ b/docs/examples/organization/update-membership.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.updateMembership({ + membershipId: '', + roles: [] +}); +``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/organization/update.md similarity index 71% rename from docs/examples/health/get-certificate.md rename to docs/examples/organization/update.md index 571b3cd..21485ef 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/organization/update.md @@ -6,9 +6,9 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const organization = new sdk.Organization(client); -const result = await health.getCertificate({ - domain: '' // optional +const result = await organization.update({ + name: '' }); ``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/project/update-deny-corporate-email-policy.md similarity index 69% rename from docs/examples/health/get-queue-audits.md rename to docs/examples/project/update-deny-corporate-email-policy.md index dcc7c6c..8335b8e 100644 --- a/docs/examples/health/get-queue-audits.md +++ b/docs/examples/project/update-deny-corporate-email-policy.md @@ -6,9 +6,9 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const project = new sdk.Project(client); -const result = await health.getQueueAudits({ - threshold: null // optional +const result = await project.updateDenyCorporateEmailPolicy({ + enabled: false }); ``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/project/update-o-auth-2-appwrite.md similarity index 57% rename from docs/examples/health/get-console-pausing.md rename to docs/examples/project/update-o-auth-2-appwrite.md index a3dfca6..6a7df87 100644 --- a/docs/examples/health/get-console-pausing.md +++ b/docs/examples/project/update-o-auth-2-appwrite.md @@ -6,10 +6,11 @@ const client = new sdk.Client() .setProject('') // Your project ID .setKey(''); // Your secret API key -const health = new sdk.Health(client); +const project = new sdk.Project(client); -const result = await health.getConsolePausing({ - threshold: null, // optional - inactivityDays: null // optional +const result = await project.updateOAuth2Appwrite({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md index 7f1f6eb..271afcf 100644 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -15,6 +15,8 @@ const result = await project.updateOAuth2Oidc({ authorizationURL: 'https://example.com', // optional tokenURL: 'https://example.com', // optional userInfoURL: 'https://example.com', // optional + prompt: [sdk.ProjectOAuth2OidcPrompt.None], // optional + maxAge: 0, // optional enabled: false // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index 5feef6a..0cd95ae 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -21,6 +21,7 @@ const result = await project.updateOAuth2Server({ verificationUrl: 'https://example.com', // optional userCodeLength: 6, // optional userCodeFormat: 'numeric', // optional - deviceCodeDuration: 60 // optional + deviceCodeDuration: 60, // optional + defaultScopes: [] // optional }); ``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index fe7258a..d7ace09 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -12,7 +12,7 @@ const result = await project.updateSMTP({ host: '', // optional port: null, // optional username: '', // optional - password: '', // optional + password: 'password', // optional senderEmail: 'email@example.com', // optional senderName: '', // optional replyToEmail: 'email@example.com', // optional diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 6e88289..208c827 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const sites = new sdk.Sites(client); -const result = await sites.listSpecifications(); +const result = await sites.listSpecifications({ + type: 'runtimes' // optional +}); ``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 0571906..280db02 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -11,6 +11,7 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.create({ databaseId: '', name: '', - enabled: false // optional + enabled: false, // optional + specification: 'serverless' // optional }); ``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md deleted file mode 100644 index 887f98f..0000000 --- a/docs/examples/usage/list-events.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const usage = new sdk.Usage(client); - -const result = await usage.listEvents({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md deleted file mode 100644 index aa5ba1d..0000000 --- a/docs/examples/usage/list-gauges.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const usage = new sdk.Usage(client); - -const result = await usage.listGauges({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 5610f06..c93772d 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -12,7 +12,7 @@ const result = await users.create({ userId: '', email: 'email@example.com', // optional phone: '+12065550100', // optional - password: '', // optional + password: 'password', // optional name: '' // optional }); ``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index ab572ca..5cadfdb 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updatePassword({ userId: '', - password: '' + password: 'password' }); ``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index c860387..75c778c 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -16,7 +16,7 @@ const result = await webhooks.create({ enabled: false, // optional tls: false, // optional authUsername: '', // optional - authPassword: '', // optional + authPassword: 'password', // optional secret: '' // optional }); ``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index 6596e90..f83021c 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -16,6 +16,6 @@ const result = await webhooks.update({ enabled: false, // optional tls: false, // optional authUsername: '', // optional - authPassword: '' // optional + authPassword: 'password' // optional }); ``` diff --git a/package-lock.json b/package-lock.json index 2ac1a1e..6a10292 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,25 +1,29 @@ { "name": "node-appwrite", - "version": "26.2.0", + "version": "27.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "26.2.0", + "version": "27.0.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0", - "undici": "^6.26.0" + "undici": "^6.27.0" }, "devDependencies": { "@types/json-bigint": "1.0.4", - "@types/node": "20.11.25", + "@types/node": "26.1.1", "esbuild-plugin-file-path-extensions": "^2.0.0", - "jest": "^29.7.0", - "tslib": "2.6.2", + "jest": "^30.4.2", + "tslib": "2.8.1", "tsup": "^8.5.1", - "typescript": "5.4.2" + "typescript": "5.9.3" + }, + "overrides": { + "esbuild": "^0.28.1", + "js-yaml": "^4.2.0" } }, "node_modules/@babel/code-frame": { @@ -518,10 +522,44 @@ "dev": true, "license": "MIT" }, + "node_modules/@emnapi/core": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", + "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.1", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz", + "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz", + "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", - "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", "cpu": [ "ppc64" ], @@ -536,9 +574,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", - "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", "cpu": [ "arm" ], @@ -553,9 +591,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", - "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", "cpu": [ "arm64" ], @@ -570,9 +608,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", - "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", "cpu": [ "x64" ], @@ -587,9 +625,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", - "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", "cpu": [ "arm64" ], @@ -604,9 +642,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", - "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", "cpu": [ "x64" ], @@ -621,9 +659,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", - "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", "cpu": [ "arm64" ], @@ -638,9 +676,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", - "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", "cpu": [ "x64" ], @@ -655,9 +693,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", - "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", "cpu": [ "arm" ], @@ -672,9 +710,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", - "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", "cpu": [ "arm64" ], @@ -689,9 +727,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", - "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", "cpu": [ "ia32" ], @@ -706,9 +744,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", - "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", "cpu": [ "loong64" ], @@ -723,9 +761,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", - "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", "cpu": [ "mips64el" ], @@ -740,9 +778,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", - "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", "cpu": [ "ppc64" ], @@ -757,9 +795,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", - "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", "cpu": [ "riscv64" ], @@ -774,9 +812,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", - "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", "cpu": [ "s390x" ], @@ -791,9 +829,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", - "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", "cpu": [ "x64" ], @@ -808,9 +846,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", - "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", "cpu": [ "arm64" ], @@ -825,9 +863,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", - "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", "cpu": [ "x64" ], @@ -842,9 +880,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", - "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", "cpu": [ "arm64" ], @@ -859,9 +897,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", - "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", "cpu": [ "x64" ], @@ -876,9 +914,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", - "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", "cpu": [ "arm64" ], @@ -893,9 +931,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", - "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", "cpu": [ "x64" ], @@ -910,9 +948,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", - "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", "cpu": [ "arm64" ], @@ -927,9 +965,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", - "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", "cpu": [ "ia32" ], @@ -944,9 +982,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", - "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", "cpu": [ "x64" ], @@ -960,6 +998,24 @@ "node": ">=18" } }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -988,61 +1044,61 @@ } }, "node_modules/@jest/console": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", - "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-30.4.1.tgz", + "integrity": "sha512-v3bhyxUh9Hgmo5p6hAOXe14/R3ZxZDOsvHleh4B07z3m/x4/ngPUXEm9XwK4sF4u+f+P2ORb0Ge+MgpaqRMVDA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", + "@jest/types": "30.4.1", "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", + "chalk": "^4.1.2", + "jest-message-util": "30.4.1", + "jest-util": "30.4.1", "slash": "^3.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/core": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", - "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-30.4.2.tgz", + "integrity": "sha512-TZJA6cPJUFxoWhxaLo8t0VX/MZX2wPWr0uIDvLSHIvN4gu9h02vSzqI2kBADG1ExqQlC+cY09xKMSreivvrChQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "^29.7.0", - "@jest/reporters": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", + "@jest/console": "30.4.1", + "@jest/pattern": "30.4.0", + "@jest/reporters": "30.4.1", + "@jest/test-result": "30.4.1", + "@jest/transform": "30.4.1", + "@jest/types": "30.4.1", "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.7.0", - "jest-config": "^29.7.0", - "jest-haste-map": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-resolve-dependencies": "^29.7.0", - "jest-runner": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "jest-watcher": "^29.7.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "exit-x": "^0.2.2", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.11", + "jest-changed-files": "30.4.1", + "jest-config": "30.4.2", + "jest-haste-map": "30.4.1", + "jest-message-util": "30.4.1", + "jest-regex-util": "30.4.0", + "jest-resolve": "30.4.1", + "jest-resolve-dependencies": "30.4.2", + "jest-runner": "30.4.2", + "jest-runtime": "30.4.2", + "jest-snapshot": "30.4.1", + "jest-util": "30.4.1", + "jest-validate": "30.4.1", + "jest-watcher": "30.4.1", + "pretty-format": "30.4.1", + "slash": "^3.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -1053,117 +1109,150 @@ } } }, + "node_modules/@jest/diff-sequences": { + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/@jest/diff-sequences/-/diff-sequences-30.4.0.tgz", + "integrity": "sha512-zOpzlfUs45l6u7jm39qr87JCHUDsaeCtvL+kQe/Vn9jSnRB4/5IPXISm0h9I1vZW/o00Kn4UTJ2MOlhnUGwv3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, "node_modules/@jest/environment": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", - "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.4.1.tgz", + "integrity": "sha512-AK9yNRqgKxiabqMoe4oW+3/TSSeV8vkdC7BGaxZdU0AFXfOpofTLqdru2GXKZghP3sdgwE9XXpnVwfZ8JnFV4w==", "dev": true, "license": "MIT", "dependencies": { - "@jest/fake-timers": "^29.7.0", - "@jest/types": "^29.6.3", + "@jest/fake-timers": "30.4.1", + "@jest/types": "30.4.1", "@types/node": "*", - "jest-mock": "^29.7.0" + "jest-mock": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/expect": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", - "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-30.4.1.tgz", + "integrity": "sha512-ginrj6TMgh2GshLUGCjO94Ptx9HhdZA/I6A9iUfyeLKFtdAjnKzHDgzgP9HYQgbxM1lbXScQ2eUBz2lGeVDPWA==", "dev": true, "license": "MIT", "dependencies": { - "expect": "^29.7.0", - "jest-snapshot": "^29.7.0" + "expect": "30.4.1", + "jest-snapshot": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/expect-utils": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", - "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.4.1.tgz", + "integrity": "sha512-ZBn5CglH8fBsQsvs4VWNzD4aWfUYks+IdOOQU3MEK71ol/BcVm+P+rtb1KpiFBpSWSCE27uOahyyf1vfqOVbcQ==", "dev": true, "license": "MIT", "dependencies": { - "jest-get-type": "^29.6.3" + "@jest/get-type": "30.1.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/fake-timers": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", - "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.4.1.tgz", + "integrity": "sha512-iW5umdmfPeWzehrVhugFQZqCchSCud5S1l2YT0O9ZhjRR0ExclANDZkiSBwzqtnlOn0J1JXvO+HZ6rkuyOVOgQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", - "@sinonjs/fake-timers": "^10.0.2", + "@jest/types": "30.4.1", + "@sinonjs/fake-timers": "^15.4.0", "@types/node": "*", - "jest-message-util": "^29.7.0", - "jest-mock": "^29.7.0", - "jest-util": "^29.7.0" + "jest-message-util": "30.4.1", + "jest-mock": "30.4.1", + "jest-util": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/get-type": { + "version": "30.1.0", + "resolved": "https://registry.npmjs.org/@jest/get-type/-/get-type-30.1.0.tgz", + "integrity": "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/globals": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", - "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-30.4.1.tgz", + "integrity": "sha512-ZbuY4cmXC8DkxYjfvT2DbcHWL2T6vmsMhXCDcmTB2T0y0gaezBI77ufq5ZAIdcRkYZ7NEQEDg1xFeKbxUJ5v5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "30.4.1", + "@jest/expect": "30.4.1", + "@jest/types": "30.4.1", + "jest-mock": "30.4.1" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/pattern": { + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.4.0.tgz", + "integrity": "sha512-RAWn3+f9u8BsHijKJ71uHcFp6vmyEt6VvoWXkl6hKF3qVIuWNmudVjg12DlBPGup/frIl5UcUlH5HfEuvHpEXg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/expect": "^29.7.0", - "@jest/types": "^29.6.3", - "jest-mock": "^29.7.0" + "@types/node": "*", + "jest-regex-util": "30.4.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/reporters": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", - "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-30.4.1.tgz", + "integrity": "sha512-/SnkPCzEQpUaBH81kjdEdDdo2WZl5hxw+BmLDGWjRkm8o7XlhjwsU36cqwe5PGBE5WYpBvDzRSdXx9rbGuJtNA==", "dev": true, "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@jridgewell/trace-mapping": "^0.3.18", + "@jest/console": "30.4.1", + "@jest/test-result": "30.4.1", + "@jest/transform": "30.4.1", + "@jest/types": "30.4.1", + "@jridgewell/trace-mapping": "^0.3.25", "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", + "chalk": "^4.1.2", + "collect-v8-coverage": "^1.0.2", + "exit-x": "^0.2.2", + "glob": "^10.5.0", + "graceful-fs": "^4.2.11", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", + "istanbul-lib-source-maps": "^5.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "jest-worker": "^29.7.0", + "jest-message-util": "30.4.1", + "jest-util": "30.4.1", + "jest-worker": "30.4.1", "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", + "string-length": "^4.0.2", "v8-to-istanbul": "^9.0.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -1175,108 +1264,124 @@ } }, "node_modules/@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.4.1.tgz", + "integrity": "sha512-i6b4qw5qnP8c5FEeBJg/uZQ4ddrkN6Ca8qISJh0pr7a5hfn3h3v5x60BEbOC7OYAGZNMs1LfFLwnW2CuK8F57Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.34.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/snapshot-utils": { + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/snapshot-utils/-/snapshot-utils-30.4.1.tgz", + "integrity": "sha512-ObY4ljvQ95mt6iwKtVLetR/4yXiAgl3H4nJxhztr0MTjrN97TwDYrnCp/kF60Ec9HdhkWTHSu+Hg05aXfngpOA==", "dev": true, "license": "MIT", "dependencies": { - "@sinclair/typebox": "^0.27.8" + "@jest/types": "30.4.1", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "natural-compare": "^1.4.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/source-map": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", - "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-30.0.1.tgz", + "integrity": "sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/trace-mapping": "^0.3.18", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" + "@jridgewell/trace-mapping": "^0.3.25", + "callsites": "^3.1.0", + "graceful-fs": "^4.2.11" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/test-result": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", - "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-30.4.1.tgz", + "integrity": "sha512-/ZG7pgEiOmmWkN9TplKbOu4id2N5lh7FHwRwlkgBVAzGdRH+OkkQ8wX/kIxg4zmd3ZQvAL1RwL2yWsvNYYECTw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" + "@jest/console": "30.4.1", + "@jest/types": "30.4.1", + "@types/istanbul-lib-coverage": "^2.0.6", + "collect-v8-coverage": "^1.0.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/test-sequencer": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", - "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-30.4.1.tgz", + "integrity": "sha512-PeYE+4td5rKjoRPxztObrXU+H8hsjZfxKMXOcmrr34JerSyB/ROOxbbicz8B7A5j9R9VayDnVPvBmedqCsFCdw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/test-result": "^29.7.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", + "@jest/test-result": "30.4.1", + "graceful-fs": "^4.2.11", + "jest-haste-map": "30.4.1", "slash": "^3.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/transform": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", - "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-30.4.1.tgz", + "integrity": "sha512-Wz0LyktlTvRefoymh+n64hQ84KNXsRGcwdoZ8CSa0Ea+fgYcHZlnk+hDP7v2MS7il2bQ5uTEIxf4/NNfhMN4KQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.6.3", - "@jridgewell/trace-mapping": "^0.3.18", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", + "@babel/core": "^7.27.4", + "@jest/types": "30.4.1", + "@jridgewell/trace-mapping": "^0.3.25", + "babel-plugin-istanbul": "^7.0.1", + "chalk": "^4.1.2", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-util": "^29.7.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", + "graceful-fs": "^4.2.11", + "jest-haste-map": "30.4.1", + "jest-regex-util": "30.4.0", + "jest-util": "30.4.1", + "pirates": "^4.0.7", "slash": "^3.0.0", - "write-file-atomic": "^4.0.2" + "write-file-atomic": "^5.0.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/types": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", - "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.4.1.tgz", + "integrity": "sha512-f1x/vJXIfjOlEmejYpbkbgw1gOqpPECwMvMEtBqe47j7H2Hg8h8w3o3ikhSXq3MI15kg+oQ0exWO0uCtTNJLoQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", + "@jest/pattern": "30.4.0", + "@jest/schemas": "30.4.1", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jridgewell/gen-mapping": { @@ -1329,10 +1434,53 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", + "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@pkgr/core": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.3.6.tgz", + "integrity": "sha512-SEeaJLb3qBNF/OaXnaR1NmmBbFYk1zC0ZH/52fATcRPLFg/p791YrcyFFy44Bo9sLaGuSuLp5Q6axbb/O+v/RA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/pkgr" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", - "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz", + "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==", "cpu": [ "arm" ], @@ -1344,9 +1492,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", - "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz", + "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==", "cpu": [ "arm64" ], @@ -1358,9 +1506,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", - "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz", + "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==", "cpu": [ "arm64" ], @@ -1372,9 +1520,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", - "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz", + "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==", "cpu": [ "x64" ], @@ -1386,9 +1534,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", - "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz", + "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==", "cpu": [ "arm64" ], @@ -1400,9 +1548,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", - "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz", + "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==", "cpu": [ "x64" ], @@ -1414,13 +1562,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", - "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz", + "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==", "cpu": [ "arm" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1428,13 +1579,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", - "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz", + "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==", "cpu": [ "arm" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1442,13 +1596,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", - "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz", + "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1456,13 +1613,16 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", - "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz", + "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1470,13 +1630,16 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", - "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz", + "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==", "cpu": [ "loong64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1484,13 +1647,16 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", - "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz", + "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==", "cpu": [ "loong64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1498,13 +1664,16 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", - "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz", + "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==", "cpu": [ "ppc64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1512,13 +1681,16 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", - "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz", + "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==", "cpu": [ "ppc64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1526,13 +1698,16 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", - "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz", + "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==", "cpu": [ "riscv64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1540,13 +1715,16 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", - "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz", + "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==", "cpu": [ "riscv64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1554,13 +1732,16 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", - "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz", + "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==", "cpu": [ "s390x" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1568,13 +1749,16 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", - "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz", + "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1582,13 +1766,16 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", - "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz", + "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1596,9 +1783,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", - "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz", + "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==", "cpu": [ "x64" ], @@ -1610,9 +1797,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", - "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz", + "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==", "cpu": [ "arm64" ], @@ -1624,9 +1811,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", - "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz", + "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==", "cpu": [ "arm64" ], @@ -1638,9 +1825,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", - "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz", + "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==", "cpu": [ "ia32" ], @@ -1652,9 +1839,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", - "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz", + "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==", "cpu": [ "x64" ], @@ -1666,9 +1853,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", - "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz", + "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==", "cpu": [ "x64" ], @@ -1680,9 +1867,9 @@ ] }, "node_modules/@sinclair/typebox": { - "version": "0.27.10", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz", - "integrity": "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==", + "version": "0.34.51", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.51.tgz", + "integrity": "sha512-Nu4sNPT4G3QgAvxmdUCR/NBmsi23F2tEIcbMOZJVHS+qEgk+rmXxQikEeoKFyaX+UEggAoTvHUvIlj8MfYPzXQ==", "dev": true, "license": "MIT" }, @@ -1697,13 +1884,24 @@ } }, "node_modules/@sinonjs/fake-timers": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", - "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-15.4.0.tgz", + "integrity": "sha512-DsG+8/LscQIQg68J6Ef3dv10u6nVyetYn923s3/sus5eaGfTo1of5WMZSLf0UJc9KDuKPilPH0UDJCjvNbDNCA==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^3.0.0" + "@sinonjs/commons": "^3.0.1" + } + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", + "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" } }, "node_modules/@types/babel__core": { @@ -1758,16 +1956,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/graceful-fs": { - "version": "4.1.9", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", - "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1803,13 +1991,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", - "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", + "version": "26.1.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.1.tgz", + "integrity": "sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~8.3.0" } }, "node_modules/@types/stack-utils": { @@ -1836,162 +2024,508 @@ "dev": true, "license": "MIT" }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", + "node_modules/@ungap/structured-clone": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.3.tgz", + "integrity": "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg==", "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } + "license": "ISC" }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "node_modules/@unrs/resolver-binding-android-arm-eabi": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.12.2.tgz", + "integrity": "sha512-g5T90pqg1bo/7mytQx6F4iBNC0Wsh9cu+z9veDbFjc7HjpesJFWD7QMS0NGStXM075+7dJPPVvBbpZlnrdpi/w==", + "cpu": [ + "arm" + ], "dev": true, "license": "MIT", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "optional": true, + "os": [ + "android" + ] }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "node_modules/@unrs/resolver-binding-android-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.12.2.tgz", + "integrity": "sha512-YGCRZv/9GLhwmz6mYDeTsm/92BAyR28l6c2ReweVW5pWgfsitWLY8upvfRlGdoyD8HjeTHSYJWyZGD4KJA/nFQ==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", - "engines": { - "node": ">=8" - } + "optional": true, + "os": [ + "android" + ] }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@unrs/resolver-binding-darwin-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.12.2.tgz", + "integrity": "sha512-u9DiNT1auQMO20A9SyTuG3wUgQWB9Z7KjAg0uFuCDR1FsAY8A0CG2S6JpHS1xwm/w1G08bjXZDcyOCjv1WAm2w==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } + "optional": true, + "os": [ + "darwin" + ] }, - "node_modules/any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "node_modules/@unrs/resolver-binding-darwin-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.12.2.tgz", + "integrity": "sha512-f7rPLi/T1HVKZu/u6t87lroib16n8vrSzcyxI7lg4BGO9UF26KhQL44sd9eOUgrTYhvRXtWOIZT5PejdPyJfUA==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "node_modules/@unrs/resolver-binding-freebsd-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.12.2.tgz", + "integrity": "sha512-BpcOjWCJub6nRZUS2zA20pmLvjtqAtGejETaIyRLiZiQf++cbrjltLA5NN/xaXfqeOBOSlMFbemIl5/S5tljmg==", + "cpu": [ + "x64" + ], "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.12.2.tgz", + "integrity": "sha512-vZTDvdSISZjJx66OzJqtsOhzifbqRjbmI1Mnu49fQDwog5GtDI4QidRiEAYbZCRj9C8YZEW+3ZjqsyS9GR4k2A==", + "cpu": [ + "arm" + ], "dev": true, "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/babel-jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", - "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.12.2.tgz", + "integrity": "sha512-BiPI+IrIlwcW4nLLMM21+B1dFPzd55yAVgVGrdgDjNef+ch03GdxrcyaIz8X9SsQirh/kCQ7mviyWlMxdh2D7g==", + "cpu": [ + "arm" + ], "dev": true, "license": "MIT", - "dependencies": { - "@jest/transform": "^29.7.0", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.6.3", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.8.0" - } + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.12.2.tgz", + "integrity": "sha512-zJc0H99FEPoFfSrNpa91HYfxzfAJCr502oxNK1cfdC9hlaFI43RT+JFCann9JUgZmLzzntChHyn13Sgn9ljHNg==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "node_modules/@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.12.2.tgz", + "integrity": "sha512-KQ3Lki6l+Pz1k/eBipN41ES+YUK30beLGb9YqcB1O542cyLCNE6GaxrfcY3T6EezmGGk84wb5XyO9loTM9tkcA==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-loong64-gnu/-/resolver-binding-linux-loong64-gnu-1.12.2.tgz", + "integrity": "sha512-3SJGEh1DborhG6pyxvhPzCT4bbSIVihsvgJc13P1bHG7KLdNDaF9T3gsTwFc7Jw/5Y5/iWOjkEx7Zy0NvCGX3Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-loong64-musl/-/resolver-binding-linux-loong64-musl-1.12.2.tgz", + "integrity": "sha512-jiuG/Obbel7uw1PwHNFfrkiKhLAF6mnyZ6aWlOAVN9WqKm8v0OFGnciJIHu8+CMvXLQ8AD51LPzAoUfT21D5Ew==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.12.2.tgz", + "integrity": "sha512-q7xRvVpmcfeL+LlZg8Pbbo6QaTZwDU5BaGZbwfhkEsXJn3Was8xYfE0RBH266xZt0rM6B7i8xAYIvjthuUIWHg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.12.2.tgz", + "integrity": "sha512-0CVdx6lcnT3Q9inOH8tsMIOJ6ImndllMjqJHg8RLVdB7Vq4SfkEXl9mCSsVNuNA4MCYycRicCUxPCabVHJRr6A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.12.2.tgz", + "integrity": "sha512-iOwlRo9vnp6R6ohHQS11n0NnfdXx/omhkocmIfaPRpQhKZ+3BDMkkdRVh53qjkFkpPddf+FETA28NwGN7l5l+w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.12.2.tgz", + "integrity": "sha512-HYJtLfXq94q8iZNFT1lknx258wlkkWhZeUXJRqzKBBUJ00CvZ+N33zgbCqimLjsyw5Va6uUxhVa12mI+kaveEw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.12.2.tgz", + "integrity": "sha512-mPsUhunKKDih5O96Y6enDQyHc1SqBPlY1E/SfMWDM3EdJ95Z9CArPeCVwCCqbP45ljvivdEk8Fxn+SIb1rDAJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.12.2.tgz", + "integrity": "sha512-azrt6+5ydLd8Vt210AAFis/lZevSfPw93EJRIJG+xPu4WCJ8K0kppCTpMyLPcKT7H15M4Jnt2tMp5bOvCkRC6A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-openharmony-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-openharmony-arm64/-/resolver-binding-openharmony-arm64-1.12.2.tgz", + "integrity": "sha512-YZ9hP4O0X9PQb8eO980qmLNGH4zT3I9+SZTdt0Pr0YyuGQhYKoOZkV02VzrzyOZJ5xIJ3UFIenKkUkGg8GjgWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.12.2.tgz", + "integrity": "sha512-tYFDIkMxSflfEc/h92ZWNsZlHSwgimbNHSO3PL2JWQHfCuC2q316jMyYU9TIWZsFK2bQwyK5VAdYgn8ygPj69A==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.12.2.tgz", + "integrity": "sha512-qzNyg3xL0VPQmCaUh+N5jSitce6k+uCBfMDesWRnlULOZaqUkaJ0ybdT+UqlAWJoQjuqfIU/0Ptx9bteN4D82g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.12.2.tgz", + "integrity": "sha512-WD9sY00OfpHVGfsnHZoA8jVT+esS/Bg8z8jzxp5BnDCjjwsuKsPQrzswwpFy4J1AUJbXPRfkpcX0mXrzeXW79g==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.12.2.tgz", + "integrity": "sha512-nAB74NfSNKknqQ1RrYj6uz8FcXEomu/MATJZxh/x+BArzN2U3JbOYC0APYzUIGhVY3m5hRxA8VPNdPBoG8txlA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/babel-jest": { + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-30.4.1.tgz", + "integrity": "sha512-fATAbM8piYxkiXQp3RBXmZHxZVNJZAVXXfyeyCN2Tida3+qJ8ea9UxhiJ2y4fLO90ZImKt6k9FlcH2+rLkJGhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "30.4.1", + "@types/babel__core": "^7.20.5", + "babel-plugin-istanbul": "^7.0.1", + "babel-preset-jest": "30.4.0", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "slash": "^3.0.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.11.0 || ^8.0.0-0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-7.0.1.tgz", + "integrity": "sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA==", + "dev": true, + "license": "BSD-3-Clause", + "workspaces": [ + "test/babel-8" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-instrument": "^6.0.2", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=12" + } }, "node_modules/babel-plugin-jest-hoist": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", - "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.4.0.tgz", + "integrity": "sha512-9EdtWM/sSfXLOGLwSn+GS6pIXyBnL07/8gyJlwFXjWy4DxMOyItqyUT29d4lQiS380EZwYlX7/At4PgBS+m2aA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" + "@types/babel__core": "^7.20.5" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/babel-preset-current-node-syntax": { @@ -2022,20 +2556,20 @@ } }, "node_modules/babel-preset-jest": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", - "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-30.4.0.tgz", + "integrity": "sha512-lBY4jxsNmCnSiu7kquw8ZC9F4+XLMOKypT3RnNHPvU2Kpd4W0xaPuLr5ZkRyOsvLYAY4yaW1ZwTW4xB7NIiZzg==", "dev": true, "license": "MIT", "dependencies": { - "babel-plugin-jest-hoist": "^29.6.3", - "babel-preset-current-node-syntax": "^1.0.0" + "babel-plugin-jest-hoist": "30.4.0", + "babel-preset-current-node-syntax": "^1.2.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.11.0 || ^8.0.0-beta.1" } }, "node_modules/balanced-match": { @@ -2046,9 +2580,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.10.34", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.34.tgz", - "integrity": "sha512-IMDedajPifLnHNY0X9n8hKxRTQ6/eTHwr5bDo04WnuqxyKw6LYtQywCuuqPZwhl3aBXMvQpJov42GLCwRRdQzw==", + "version": "2.10.42", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.42.tgz", + "integrity": "sha512-c/jurFrDLyui7o1J86yLkRu4LMsTYcBohveus7/I2Hzdn9KIP2bdJPTue/lR1KH46enoPbD77GKeSYNdyPoD3Q==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2068,33 +2602,19 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz", - "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.2.tgz", + "integrity": "sha512-w5JZcKgdhDOgOwm8H+KgbosopHMuGcl6qbulwjtz3SM7I7P3yW1eAjzMPLrIE+NQ9vjgANKHWeMHnrT0OXW1oA==", "dev": true, "license": "MIT", "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" + "balanced-match": "^1.0.0" } }, "node_modules/browserslist": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", - "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", + "version": "4.28.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.5.tgz", + "integrity": "sha512-Cu2E6QejHWzuDMTkuwgpABFgDfZrXLQq5V13YOACZx4mFAG4IwGTbTfHPMr4WtxlHoXSM8FIuRwYYCz5XiabaQ==", "dev": true, "funding": [ { @@ -2112,10 +2632,10 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.10.12", - "caniuse-lite": "^1.0.30001782", - "electron-to-chromium": "^1.5.328", - "node-releases": "^2.0.36", + "baseline-browser-mapping": "^2.10.42", + "caniuse-lite": "^1.0.30001800", + "electron-to-chromium": "^1.5.387", + "node-releases": "^2.0.50", "update-browserslist-db": "^1.2.3" }, "bin": { @@ -2189,9 +2709,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001797", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001797.tgz", - "integrity": "sha512-l8xKG+gwAIExZGl9FrF7KUwuOmk6wbEPC9Xoy/RtnWv1XG0Q4LFlagaLpUv3Kiza3W/wm27zy0yWJEieYKAP6w==", + "version": "1.0.30001803", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001803.tgz", + "integrity": "sha512-g/uHREV2ZpK9qMalCsWaxmA6ol+DX8GYhuf3T40RKoP+oL7vhRJh8LNt73PCjpnR6l14FzfPrB5Yux4PKm2meg==", "dev": true, "funding": [ { @@ -2253,9 +2773,9 @@ } }, "node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", + "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==", "dev": true, "funding": [ { @@ -2269,9 +2789,9 @@ } }, "node_modules/cjs-module-lexer": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz", - "integrity": "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz", + "integrity": "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==", "dev": true, "license": "MIT" }, @@ -2290,6 +2810,69 @@ "node": ">=12" } }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -2369,28 +2952,6 @@ "dev": true, "license": "MIT" }, - "node_modules/create-jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", - "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-config": "^29.7.0", - "jest-util": "^29.7.0", - "prompts": "^2.0.1" - }, - "bin": { - "create-jest": "bin/create-jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -2459,20 +3020,17 @@ "node": ">=8" } }, - "node_modules/diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } + "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.368", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.368.tgz", - "integrity": "sha512-7RckJJK4uESJF9PxvfMWd3TGqIiieUTG4HxnKaKuIpGbcr+r2ZEB3g2gAhCP3Fqm42vJSzLfgab9eva/C4/XVw==", + "version": "1.5.389", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.389.tgz", + "integrity": "sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg==", "dev": true, "license": "ISC" }, @@ -2490,9 +3048,9 @@ } }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true, "license": "MIT" }, @@ -2506,20 +3064,10 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, "node_modules/esbuild": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", - "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -2530,32 +3078,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.7", - "@esbuild/android-arm": "0.27.7", - "@esbuild/android-arm64": "0.27.7", - "@esbuild/android-x64": "0.27.7", - "@esbuild/darwin-arm64": "0.27.7", - "@esbuild/darwin-x64": "0.27.7", - "@esbuild/freebsd-arm64": "0.27.7", - "@esbuild/freebsd-x64": "0.27.7", - "@esbuild/linux-arm": "0.27.7", - "@esbuild/linux-arm64": "0.27.7", - "@esbuild/linux-ia32": "0.27.7", - "@esbuild/linux-loong64": "0.27.7", - "@esbuild/linux-mips64el": "0.27.7", - "@esbuild/linux-ppc64": "0.27.7", - "@esbuild/linux-riscv64": "0.27.7", - "@esbuild/linux-s390x": "0.27.7", - "@esbuild/linux-x64": "0.27.7", - "@esbuild/netbsd-arm64": "0.27.7", - "@esbuild/netbsd-x64": "0.27.7", - "@esbuild/openbsd-arm64": "0.27.7", - "@esbuild/openbsd-x64": "0.27.7", - "@esbuild/openharmony-arm64": "0.27.7", - "@esbuild/sunos-x64": "0.27.7", - "@esbuild/win32-arm64": "0.27.7", - "@esbuild/win32-ia32": "0.27.7", - "@esbuild/win32-x64": "0.27.7" + "@esbuild/aix-ppc64": "0.28.1", + "@esbuild/android-arm": "0.28.1", + "@esbuild/android-arm64": "0.28.1", + "@esbuild/android-x64": "0.28.1", + "@esbuild/darwin-arm64": "0.28.1", + "@esbuild/darwin-x64": "0.28.1", + "@esbuild/freebsd-arm64": "0.28.1", + "@esbuild/freebsd-x64": "0.28.1", + "@esbuild/linux-arm": "0.28.1", + "@esbuild/linux-arm64": "0.28.1", + "@esbuild/linux-ia32": "0.28.1", + "@esbuild/linux-loong64": "0.28.1", + "@esbuild/linux-mips64el": "0.28.1", + "@esbuild/linux-ppc64": "0.28.1", + "@esbuild/linux-riscv64": "0.28.1", + "@esbuild/linux-s390x": "0.28.1", + "@esbuild/linux-x64": "0.28.1", + "@esbuild/netbsd-arm64": "0.28.1", + "@esbuild/netbsd-x64": "0.28.1", + "@esbuild/openbsd-arm64": "0.28.1", + "@esbuild/openbsd-x64": "0.28.1", + "@esbuild/openharmony-arm64": "0.28.1", + "@esbuild/sunos-x64": "0.28.1", + "@esbuild/win32-arm64": "0.28.1", + "@esbuild/win32-ia32": "0.28.1", + "@esbuild/win32-x64": "0.28.1" } }, "node_modules/esbuild-plugin-file-path-extensions": { @@ -2581,26 +3129,12 @@ }, "node_modules/escape-string-regexp": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/execa": { @@ -2627,30 +3161,39 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/exit-x": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/exit-x/-/exit-x-0.2.2.tgz", + "integrity": "sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8.0" } }, "node_modules/expect": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", - "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-30.4.1.tgz", + "integrity": "sha512-PMARsyh/JtqC20HoGqlFcIlQAyqUtW4PlI1rup1uhYJtKuwAjbvWi3GQMAn+STdHum/dk8xrKfUM1+5SAwpolA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/expect-utils": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0" + "@jest/expect-utils": "30.4.1", + "@jest/get-type": "30.1.0", + "jest-matcher-utils": "30.4.1", + "jest-message-util": "30.4.1", + "jest-mock": "30.4.1", + "jest-util": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/fast-json-stable-stringify": { @@ -2670,17 +3213,22 @@ "bser": "2.1.1" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, "engines": { - "node": ">=8" + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, "node_modules/find-up": { @@ -2709,6 +3257,23 @@ "rollup": "^4.34.8" } }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2731,16 +3296,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -2785,22 +3340,22 @@ } }, "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", "dev": true, "license": "ISC", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": "*" + "bin": { + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2823,19 +3378,6 @@ "node": ">=8" } }, - "node_modules/hasown": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", - "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -2909,22 +3451,6 @@ "dev": true, "license": "MIT" }, - "node_modules/is-core-module": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", - "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -2945,16 +3471,6 @@ "node": ">=6" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -3003,9 +3519,9 @@ } }, "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "7.8.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", - "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", "dev": true, "license": "ISC", "bin": { @@ -3031,15 +3547,15 @@ } }, "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", + "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", "dev": true, "license": "BSD-3-Clause", "dependencies": { + "@jridgewell/trace-mapping": "^0.3.23", "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" + "istanbul-lib-coverage": "^3.0.0" }, "engines": { "node": ">=10" @@ -3059,23 +3575,39 @@ "node": ">=8" } }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", - "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/jest/-/jest-30.4.2.tgz", + "integrity": "sha512-Yi1jqNC/Oq0N4hBgNH/YvBpP1P57QqundgytzYqy3yqAa7NZPNjSoi4SGbRAXDMdBzNE6xBCi5U7RgfrvMEUVQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/core": "^29.7.0", - "@jest/types": "^29.6.3", - "import-local": "^3.0.2", - "jest-cli": "^29.7.0" + "@jest/core": "30.4.2", + "@jest/types": "30.4.1", + "import-local": "^3.2.0", + "jest-cli": "30.4.2" }, "bin": { "jest": "bin/jest.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -3087,76 +3619,75 @@ } }, "node_modules/jest-changed-files": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", - "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-30.4.1.tgz", + "integrity": "sha512-IuctmYrxi21iOSOaIXpJWalHyPAsVv0GeBHKDn8C1CA4W5htHn7INL+wdnL4Bo0+olEndvAFkmb++tIQJG+vvg==", "dev": true, "license": "MIT", "dependencies": { - "execa": "^5.0.0", - "jest-util": "^29.7.0", + "execa": "^5.1.1", + "jest-util": "30.4.1", "p-limit": "^3.1.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-circus": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", - "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-30.4.2.tgz", + "integrity": "sha512-rvHH7VlY6LgbJXJTQ87GW62g1FntOtbhh0zT+v04kC+pgL6aBKyYINXxWukCpj3dcIBMw5/XUbtDS9dU9JTXeQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/expect": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", + "@jest/environment": "30.4.1", + "@jest/expect": "30.4.1", + "@jest/test-result": "30.4.1", + "@jest/types": "30.4.1", "@types/node": "*", - "chalk": "^4.0.0", + "chalk": "^4.1.2", "co": "^4.6.0", - "dedent": "^1.0.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.7.0", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", + "dedent": "^1.6.0", + "is-generator-fn": "^2.1.0", + "jest-each": "30.4.1", + "jest-matcher-utils": "30.4.1", + "jest-message-util": "30.4.1", + "jest-runtime": "30.4.2", + "jest-snapshot": "30.4.1", + "jest-util": "30.4.1", "p-limit": "^3.1.0", - "pretty-format": "^29.7.0", - "pure-rand": "^6.0.0", + "pretty-format": "30.4.1", + "pure-rand": "^7.0.0", "slash": "^3.0.0", - "stack-utils": "^2.0.3" + "stack-utils": "^2.0.6" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-cli": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", - "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-30.4.2.tgz", + "integrity": "sha512-jfA2ocvVHMXS2QijrJ0d31ektP+d/W0T5RpcTX2Pq+3sVqHlsXVCM2+FmwpL+bdY8OfHpIg9xMxLF17Zg0U49Q==", "dev": true, "license": "MIT", "dependencies": { - "@jest/core": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "create-jest": "^29.7.0", - "exit": "^0.1.2", - "import-local": "^3.0.2", - "jest-config": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "yargs": "^17.3.1" + "@jest/core": "30.4.2", + "@jest/test-result": "30.4.1", + "@jest/types": "30.4.1", + "chalk": "^4.1.2", + "exit-x": "^0.2.2", + "import-local": "^3.2.0", + "jest-config": "30.4.2", + "jest-util": "30.4.1", + "jest-validate": "30.4.1", + "yargs": "^17.7.2" }, "bin": { "jest": "bin/jest.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -3168,215 +3699,211 @@ } }, "node_modules/jest-config": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", - "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.7.0", - "@jest/types": "^29.6.3", - "babel-jest": "^29.7.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-runner": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "micromatch": "^4.0.4", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-30.4.2.tgz", + "integrity": "sha512-rNHAShJQqQwFNoL0hbf3BphSBOWnpOUAKvidLS/AjNVLPfoj5mSf4jQMfW3cYOs6hXeZC7nF7mDHaBnbxELOzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.27.4", + "@jest/get-type": "30.1.0", + "@jest/pattern": "30.4.0", + "@jest/test-sequencer": "30.4.1", + "@jest/types": "30.4.1", + "babel-jest": "30.4.1", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "deepmerge": "^4.3.1", + "glob": "^10.5.0", + "graceful-fs": "^4.2.11", + "jest-circus": "30.4.2", + "jest-docblock": "30.4.0", + "jest-environment-node": "30.4.1", + "jest-regex-util": "30.4.0", + "jest-resolve": "30.4.1", + "jest-runner": "30.4.2", + "jest-util": "30.4.1", + "jest-validate": "30.4.1", "parse-json": "^5.2.0", - "pretty-format": "^29.7.0", + "pretty-format": "30.4.1", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { "@types/node": "*", + "esbuild-register": ">=3.4.0", "ts-node": ">=9.0.0" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, + "esbuild-register": { + "optional": true + }, "ts-node": { "optional": true } } }, "node_modules/jest-diff": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", - "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.4.1.tgz", + "integrity": "sha512-CRpFK0RtLriVDGcPPAnR6HMVI8bSR2jnUIgralhauzYQZIb4RH9AtEInTuQr65LmmGggGcRT6HIASxwqsVsmlA==", "dev": true, "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.6.3", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" + "@jest/diff-sequences": "30.4.0", + "@jest/get-type": "30.1.0", + "chalk": "^4.1.2", + "pretty-format": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-docblock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", - "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-30.4.0.tgz", + "integrity": "sha512-ZPMabUZCx5MpbZ2eBYSvZ0J8fvo3dR9oM+eeUpb3aKNQFuS2tu3Duw1TNlMoP8k3WQgKGJuhcMFvwcVuq6T7oA==", "dev": true, "license": "MIT", "dependencies": { - "detect-newline": "^3.0.0" + "detect-newline": "^3.1.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-each": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", - "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-30.4.1.tgz", + "integrity": "sha512-/8MJbH6fuj48TstjrMf+u/pd06Qezz5xOXvZA6442heNOWr8bdeoGZX2d9fCn028CoMgYmroH9//zky5GfyYmA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "jest-get-type": "^29.6.3", - "jest-util": "^29.7.0", - "pretty-format": "^29.7.0" + "@jest/get-type": "30.1.0", + "@jest/types": "30.4.1", + "chalk": "^4.1.2", + "jest-util": "30.4.1", + "pretty-format": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-environment-node": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", - "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-30.4.1.tgz", + "integrity": "sha512-4FZYVOk85hz2AyT6BbarKy9u37g6DbrDyCdFhsnDdXqyrueYQvB+0zO4f/kqLCRD0BsPRXPMNJeQwihKZV8naw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/fake-timers": "^29.7.0", - "@jest/types": "^29.6.3", + "@jest/environment": "30.4.1", + "@jest/fake-timers": "30.4.1", + "@jest/types": "30.4.1", "@types/node": "*", - "jest-mock": "^29.7.0", - "jest-util": "^29.7.0" + "jest-mock": "30.4.1", + "jest-util": "30.4.1", + "jest-validate": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-get-type": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", - "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-haste-map": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", - "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-30.4.1.tgz", + "integrity": "sha512-rFrcONd8jeFsyw+Z9CrScJgglRf2+NFmNam8dKu7n+SoHqNYT47mn0DdEcVUZJpvh7Iz6/si7f7yUH7GJHVgnw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", - "@types/graceful-fs": "^4.1.3", + "@jest/types": "30.4.1", "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.6.3", - "jest-util": "^29.7.0", - "jest-worker": "^29.7.0", - "micromatch": "^4.0.4", + "anymatch": "^3.1.3", + "fb-watchman": "^2.0.2", + "graceful-fs": "^4.2.11", + "jest-regex-util": "30.4.0", + "jest-util": "30.4.1", + "jest-worker": "30.4.1", + "picomatch": "^4.0.3", "walker": "^1.0.8" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "optionalDependencies": { - "fsevents": "^2.3.2" + "fsevents": "^2.3.3" } }, "node_modules/jest-leak-detector": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", - "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-30.4.1.tgz", + "integrity": "sha512-IpmyiioeHxiWDhesHnUFmOxcTzwCwKpgACgWajtAP+nYQXiY7DakTxB6Bx9JFiRMljr0AX1PvnQdaU1KFoz6NQ==", "dev": true, "license": "MIT", "dependencies": { - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" + "@jest/get-type": "30.1.0", + "pretty-format": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-matcher-utils": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", - "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.4.1.tgz", + "integrity": "sha512-zvYfX5CaeEkFrrLS9suWe9rvJrm9J1Iv3ua8kIBv9GEPzcnsfBf0bob37la7s67fs0nlBC3EuvkOLnXQKxtx4A==", "dev": true, "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^29.7.0", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" + "@jest/get-type": "30.1.0", + "chalk": "^4.1.2", + "jest-diff": "30.4.1", + "pretty-format": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-message-util": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", - "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.4.1.tgz", + "integrity": "sha512-kwCKIvq0MCW1HzLoGola9Te6JUdzgV0loyKJ3Qghrkz9i5/RRIHsL95BMQc2HBBhlBKC4j22K9p11TGHH8RBpQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.6.3", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.7.0", + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.4.1", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "jest-util": "30.4.1", + "picomatch": "^4.0.3", + "pretty-format": "30.4.1", "slash": "^3.0.0", - "stack-utils": "^2.0.3" + "stack-utils": "^2.0.6" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-mock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", - "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.4.1.tgz", + "integrity": "sha512-/i8SVb8/NSB7RfNi8gfqu8gxLV23KaL5EpAttyb9iz8qWRIqXRLflycz/32wXsYkOnaUlx8NAKnJYtpsmXUmfw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", + "@jest/types": "30.4.1", "@types/node": "*", - "jest-util": "^29.7.0" + "jest-util": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-pnp-resolver": { @@ -3398,153 +3925,154 @@ } }, "node_modules/jest-regex-util": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", - "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.4.0.tgz", + "integrity": "sha512-mWlvLviKIgIQ8VCuM1xRdD0TWp3zlzionlmDBjuXVBs+VkmXq6FgW9T4Emr7oGz/Rk6feDCGyiugolcQEyp3mg==", "dev": true, "license": "MIT", "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-resolve": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", - "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-30.4.1.tgz", + "integrity": "sha512-Zry8Yq/yJcNAZ7dJ5F2heic8AheXvbFZ7XI5V+h28nrYZ7Qoyy4dItq8OodjnYD270mvX+ZudmrNV9cysqhW5Q==", "dev": true, "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "resolve": "^1.20.0", - "resolve.exports": "^2.0.0", - "slash": "^3.0.0" + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "jest-haste-map": "30.4.1", + "jest-pnp-resolver": "^1.2.3", + "jest-util": "30.4.1", + "jest-validate": "30.4.1", + "slash": "^3.0.0", + "unrs-resolver": "^1.7.11" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-resolve-dependencies": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", - "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-30.4.2.tgz", + "integrity": "sha512-gDiVh1I+GxYzz9oXlyw+1wv6VOYX1WYxMOfjsA3iGKePV2oxmbHhwxfkALxNxYy1ciw6APWwkW2zZONwP97aEQ==", "dev": true, "license": "MIT", "dependencies": { - "jest-regex-util": "^29.6.3", - "jest-snapshot": "^29.7.0" + "jest-regex-util": "30.4.0", + "jest-snapshot": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-runner": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", - "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-30.4.2.tgz", + "integrity": "sha512-2dw0PslVYXxffXGpLo+Ejad+KcI1Qkjn7f4X4619gf21oCUmL+SPfjqIa/losUem3yEOvfNZe/F1HWUcNpODcg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "^29.7.0", - "@jest/environment": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", + "@jest/console": "30.4.1", + "@jest/environment": "30.4.1", + "@jest/test-result": "30.4.1", + "@jest/transform": "30.4.1", + "@jest/types": "30.4.1", "@types/node": "*", - "chalk": "^4.0.0", + "chalk": "^4.1.2", "emittery": "^0.13.1", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jest-haste-map": "^29.7.0", - "jest-leak-detector": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-resolve": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-util": "^29.7.0", - "jest-watcher": "^29.7.0", - "jest-worker": "^29.7.0", + "exit-x": "^0.2.2", + "graceful-fs": "^4.2.11", + "jest-docblock": "30.4.0", + "jest-environment-node": "30.4.1", + "jest-haste-map": "30.4.1", + "jest-leak-detector": "30.4.1", + "jest-message-util": "30.4.1", + "jest-resolve": "30.4.1", + "jest-runtime": "30.4.2", + "jest-util": "30.4.1", + "jest-watcher": "30.4.1", + "jest-worker": "30.4.1", "p-limit": "^3.1.0", "source-map-support": "0.5.13" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-runtime": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", - "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "version": "30.4.2", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-30.4.2.tgz", + "integrity": "sha512-3/5e8iPz2k/VLqlr8DgTftYyLUv8Su3FkCAO2/Od81UsUTpSxOrS6O5x5KkoQwyUjmpYyDJKeyAvg2T2nvpNkQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/fake-timers": "^29.7.0", - "@jest/globals": "^29.7.0", - "@jest/source-map": "^29.6.3", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", + "@jest/environment": "30.4.1", + "@jest/fake-timers": "30.4.1", + "@jest/globals": "30.4.1", + "@jest/source-map": "30.0.1", + "@jest/test-result": "30.4.1", + "@jest/transform": "30.4.1", + "@jest/types": "30.4.1", "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-mock": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", + "chalk": "^4.1.2", + "cjs-module-lexer": "^2.1.0", + "collect-v8-coverage": "^1.0.2", + "glob": "^10.5.0", + "graceful-fs": "^4.2.11", + "jest-haste-map": "30.4.1", + "jest-message-util": "30.4.1", + "jest-mock": "30.4.1", + "jest-regex-util": "30.4.0", + "jest-resolve": "30.4.1", + "jest-snapshot": "30.4.1", + "jest-util": "30.4.1", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-snapshot": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", - "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.7.0", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "natural-compare": "^1.4.0", - "pretty-format": "^29.7.0", - "semver": "^7.5.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-30.4.1.tgz", + "integrity": "sha512-tEOkkfOMppUyeiHwjZswOQ3lcnoTnws/q5FnGIaeIh/jmoU0ZlgMYRR8sTlTj+nNGCoJ0RDq6SfxGxCsyMTPmw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.27.4", + "@babel/generator": "^7.27.5", + "@babel/plugin-syntax-jsx": "^7.27.1", + "@babel/plugin-syntax-typescript": "^7.27.1", + "@babel/types": "^7.27.3", + "@jest/expect-utils": "30.4.1", + "@jest/get-type": "30.1.0", + "@jest/snapshot-utils": "30.4.1", + "@jest/transform": "30.4.1", + "@jest/types": "30.4.1", + "babel-preset-current-node-syntax": "^1.2.0", + "chalk": "^4.1.2", + "expect": "30.4.1", + "graceful-fs": "^4.2.11", + "jest-diff": "30.4.1", + "jest-matcher-utils": "30.4.1", + "jest-message-util": "30.4.1", + "jest-util": "30.4.1", + "pretty-format": "30.4.1", + "semver": "^7.7.2", + "synckit": "^0.11.8" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.8.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", - "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", "dev": true, "license": "ISC", "bin": { @@ -3555,39 +4083,39 @@ } }, "node_modules/jest-util": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.4.1.tgz", + "integrity": "sha512-vjQb1sACEiv13DKJMDToJpzVW0joCsIQrmbg0fi7CyOOt+g9jTuQl2A216pWRBYhOVt53XbL/2LbMKg1BECWOw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", + "@jest/types": "30.4.1", "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.3" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-validate": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", - "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-30.4.1.tgz", + "integrity": "sha512-PDWi4SOwLnwqNDfHZjOcsEFyZ4fc/2W2gVL3DEoyqnB6jCQMLRtfBong8s6omIw3lI0HWOus12xfnFmQtjW3fw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.6.3", + "@jest/get-type": "30.1.0", + "@jest/types": "30.4.1", + "camelcase": "^6.3.0", + "chalk": "^4.1.2", "leven": "^3.1.0", - "pretty-format": "^29.7.0" + "pretty-format": "30.4.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-validate/node_modules/camelcase": { @@ -3604,39 +4132,40 @@ } }, "node_modules/jest-watcher": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", - "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-30.4.1.tgz", + "integrity": "sha512-/l9UonmvCwjHH7d2h3iAwIloLc1H0S8mJZ/LNK3i86hqwPAz8otUJjP9MfYtz9Tt77Su5FD2xGjZn8d31IZHlw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", + "@jest/test-result": "30.4.1", + "@jest/types": "30.4.1", "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", "emittery": "^0.13.1", - "jest-util": "^29.7.0", - "string-length": "^4.0.1" + "jest-util": "30.4.1", + "string-length": "^4.0.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-worker": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", - "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-30.4.1.tgz", + "integrity": "sha512-SHynN/q/QD++iNyvMdy+WMmbCGk8jIsNcRxycXbWubSOhvo6T+j2afcfUSl+3hYsiBebOTo0cT7c2H7CXugu1g==", "dev": true, "license": "MIT", "dependencies": { "@types/node": "*", - "jest-util": "^29.7.0", + "@ungap/structured-clone": "^1.3.0", + "jest-util": "30.4.1", "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" + "supports-color": "^8.1.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-worker/node_modules/supports-color": { @@ -3673,14 +4202,23 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", - "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" @@ -3728,16 +4266,6 @@ "node": ">=6" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -3828,9 +4356,9 @@ } }, "node_modules/make-dir/node_modules/semver": { - "version": "7.8.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz", - "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==", + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", "dev": true, "license": "ISC", "bin": { @@ -3857,20 +4385,6 @@ "dev": true, "license": "MIT" }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -3882,16 +4396,29 @@ } }, "node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", "dev": true, "license": "ISC", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.2" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" } }, "node_modules/mlly": { @@ -3926,6 +4453,22 @@ "thenify-all": "^1.0.0" } }, + "node_modules/napi-postinstall": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.3.4.tgz", + "integrity": "sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==", + "dev": true, + "license": "MIT", + "bin": { + "napi-postinstall": "lib/cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/napi-postinstall" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3941,9 +4484,9 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.47", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz", - "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==", + "version": "2.0.51", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz", + "integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==", "dev": true, "license": "MIT", "engines": { @@ -4064,6 +4607,13 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -4113,12 +4663,29 @@ "node": ">=8" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, - "license": "MIT" + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" }, "node_modules/pathe": { "version": "2.0.3", @@ -4135,13 +4702,13 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", - "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", "dev": true, "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -4226,18 +4793,19 @@ } }, "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.4.1.tgz", + "integrity": "sha512-K6KiKMHTL4jjX4u3Kir2EW07nRfcqVTXIImx50wbjHQTcZPgg+gjVeNTIT3l3L1Rd4UefxfogquC9J37SoFyyw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" + "@jest/schemas": "30.4.1", + "ansi-styles": "^5.2.0", + "react-is-18": "npm:react-is@^18.3.1", + "react-is-19": "npm:react-is@^19.2.5" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/pretty-format/node_modules/ansi-styles": { @@ -4253,24 +4821,10 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/pure-rand": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", - "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz", + "integrity": "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==", "dev": true, "funding": [ { @@ -4284,13 +4838,22 @@ ], "license": "MIT" }, - "node_modules/react-is": { + "node_modules/react-is-18": { + "name": "react-is", "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true, "license": "MIT" }, + "node_modules/react-is-19": { + "name": "react-is", + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.7.tgz", + "integrity": "sha512-kZFnouyVv7eP/Phmrlo9FK+zcAdriZJvzxXHF1Sl1P377WSGe2G/JxVolhTrB/jeV47lKImhNUsijjHAAbcl/A==", + "dev": true, + "license": "MIT" + }, "node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -4315,28 +4878,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve": { - "version": "1.22.12", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", - "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "is-core-module": "^2.16.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -4360,20 +4901,10 @@ "node": ">=8" } }, - "node_modules/resolve.exports": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", - "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, "node_modules/rollup": { - "version": "4.61.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", - "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", + "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==", "dev": true, "license": "MIT", "dependencies": { @@ -4387,31 +4918,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.61.1", - "@rollup/rollup-android-arm64": "4.61.1", - "@rollup/rollup-darwin-arm64": "4.61.1", - "@rollup/rollup-darwin-x64": "4.61.1", - "@rollup/rollup-freebsd-arm64": "4.61.1", - "@rollup/rollup-freebsd-x64": "4.61.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", - "@rollup/rollup-linux-arm-musleabihf": "4.61.1", - "@rollup/rollup-linux-arm64-gnu": "4.61.1", - "@rollup/rollup-linux-arm64-musl": "4.61.1", - "@rollup/rollup-linux-loong64-gnu": "4.61.1", - "@rollup/rollup-linux-loong64-musl": "4.61.1", - "@rollup/rollup-linux-ppc64-gnu": "4.61.1", - "@rollup/rollup-linux-ppc64-musl": "4.61.1", - "@rollup/rollup-linux-riscv64-gnu": "4.61.1", - "@rollup/rollup-linux-riscv64-musl": "4.61.1", - "@rollup/rollup-linux-s390x-gnu": "4.61.1", - "@rollup/rollup-linux-x64-gnu": "4.61.1", - "@rollup/rollup-linux-x64-musl": "4.61.1", - "@rollup/rollup-openbsd-x64": "4.61.1", - "@rollup/rollup-openharmony-arm64": "4.61.1", - "@rollup/rollup-win32-arm64-msvc": "4.61.1", - "@rollup/rollup-win32-ia32-msvc": "4.61.1", - "@rollup/rollup-win32-x64-gnu": "4.61.1", - "@rollup/rollup-win32-x64-msvc": "4.61.1", + "@rollup/rollup-android-arm-eabi": "4.62.2", + "@rollup/rollup-android-arm64": "4.62.2", + "@rollup/rollup-darwin-arm64": "4.62.2", + "@rollup/rollup-darwin-x64": "4.62.2", + "@rollup/rollup-freebsd-arm64": "4.62.2", + "@rollup/rollup-freebsd-x64": "4.62.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.2", + "@rollup/rollup-linux-arm-musleabihf": "4.62.2", + "@rollup/rollup-linux-arm64-gnu": "4.62.2", + "@rollup/rollup-linux-arm64-musl": "4.62.2", + "@rollup/rollup-linux-loong64-gnu": "4.62.2", + "@rollup/rollup-linux-loong64-musl": "4.62.2", + "@rollup/rollup-linux-ppc64-gnu": "4.62.2", + "@rollup/rollup-linux-ppc64-musl": "4.62.2", + "@rollup/rollup-linux-riscv64-gnu": "4.62.2", + "@rollup/rollup-linux-riscv64-musl": "4.62.2", + "@rollup/rollup-linux-s390x-gnu": "4.62.2", + "@rollup/rollup-linux-x64-gnu": "4.62.2", + "@rollup/rollup-linux-x64-musl": "4.62.2", + "@rollup/rollup-openbsd-x64": "4.62.2", + "@rollup/rollup-openharmony-arm64": "4.62.2", + "@rollup/rollup-win32-arm64-msvc": "4.62.2", + "@rollup/rollup-win32-ia32-msvc": "4.62.2", + "@rollup/rollup-win32-x64-gnu": "4.62.2", + "@rollup/rollup-win32-x64-msvc": "4.62.2", "fsevents": "~2.3.2" } }, @@ -4449,18 +4980,17 @@ } }, "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, - "license": "MIT" + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, "node_modules/slash": { "version": "3.0.0", @@ -4493,13 +5023,6 @@ "source-map": "^0.6.0" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true, - "license": "BSD-3-Clause" - }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -4507,27 +5030,69 @@ "dev": true, "license": "MIT", "dependencies": { - "escape-string-regexp": "^2.0.0" + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-length/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">=10" + "node": ">=8" } }, - "node_modules/string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, "license": "MIT", "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=10" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/string-width": { + "node_modules/string-width-cjs": { + "name": "string-width", "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", @@ -4542,7 +5107,54 @@ "node": ">=8" } }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", @@ -4555,6 +5167,16 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -4624,17 +5246,20 @@ "node": ">=8" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "node_modules/synckit": { + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.13.tgz", + "integrity": "sha512-eNRKgb3z66Yp3D2CixVujOUvXLFUTij/zVnV8KRyvFdQwpz7I5DS8UfRkTeLzb64u+dkzDSdelE24izu+zSSUg==", "dev": true, "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.3.6" + }, "engines": { - "node": ">= 0.4" + "node": "^14.18.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/synckit" } }, "node_modules/test-exclude": { @@ -4652,6 +5277,52 @@ "node": ">=8" } }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/thenify": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", @@ -4699,37 +5370,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4737,19 +5377,6 @@ "dev": true, "license": "BSD-3-Clause" }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -4768,9 +5395,9 @@ "license": "Apache-2.0" }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, "license": "0BSD" }, @@ -4861,9 +5488,9 @@ } }, "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -4882,21 +5509,59 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.26.0.tgz", - "integrity": "sha512-4yqz8a3n5HmGTlsbADNtr/dJlhkh/55Rq798G6ibiULcXbDtaLpTl1pvdqcbFfeoj3iSi52lePFM7h9H21cw/A==", + "version": "6.27.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz", + "integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==", "license": "MIT", "engines": { "node": ">=18.17" } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", "dev": true, "license": "MIT" }, + "node_modules/unrs-resolver": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/unrs-resolver/-/unrs-resolver-1.12.2.tgz", + "integrity": "sha512-dmlRxBJJayXjqTwC+JtF1HhJmgf3ftQ3YejFcZrf4+KKtJv0qDsK1pjqaaVjG7wJ5NJ6UVP1OqRMQ71Z4C3rxQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "napi-postinstall": "^0.3.4" + }, + "funding": { + "url": "https://opencollective.com/unrs-resolver" + }, + "optionalDependencies": { + "@unrs/resolver-binding-android-arm-eabi": "1.12.2", + "@unrs/resolver-binding-android-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-x64": "1.12.2", + "@unrs/resolver-binding-freebsd-x64": "1.12.2", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-arm64-musl": "1.12.2", + "@unrs/resolver-binding-linux-loong64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-loong64-musl": "1.12.2", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-musl": "1.12.2", + "@unrs/resolver-binding-linux-s390x-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-musl": "1.12.2", + "@unrs/resolver-binding-openharmony-arm64": "1.12.2", + "@unrs/resolver-binding-wasm32-wasi": "1.12.2", + "@unrs/resolver-binding-win32-arm64-msvc": "1.12.2", + "@unrs/resolver-binding-win32-ia32-msvc": "1.12.2", + "@unrs/resolver-binding-win32-x64-msvc": "1.12.2" + } + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -4970,6 +5635,25 @@ } }, "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", @@ -4987,6 +5671,64 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -4995,17 +5737,17 @@ "license": "ISC" }, "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", + "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", "dev": true, "license": "ISC", "dependencies": { "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" + "signal-exit": "^4.0.1" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/y18n": { @@ -5026,9 +5768,9 @@ "license": "ISC" }, "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "version": "17.7.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", "dev": true, "license": "MIT", "dependencies": { @@ -5054,6 +5796,51 @@ "node": ">=12" } }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 581a191..a791cae 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "26.2.0", + "version": "27.0.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", @@ -43,15 +43,19 @@ }, "devDependencies": { "@types/json-bigint": "1.0.4", - "@types/node": "20.11.25", + "@types/node": "26.1.1", "tsup": "^8.5.1", "esbuild-plugin-file-path-extensions": "^2.0.0", - "tslib": "2.6.2", - "typescript": "5.4.2", - "jest": "^29.7.0" + "tslib": "2.8.1", + "typescript": "5.9.3", + "jest": "^30.4.2" }, "dependencies": { "json-bigint": "1.0.0", - "undici": "^6.26.0" + "undici": "^6.27.0" + }, + "overrides": { + "esbuild": "^0.28.1", + "js-yaml": "^4.2.0" } } diff --git a/src/client.ts b/src/client.ts index 5bc4e36..4fb7ac6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -73,7 +73,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/26.2.0'; + let ua = 'AppwriteNodeJSSDK/27.0.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -115,6 +115,7 @@ class Client { project: '', key: '', jwt: '', + bearer: '', locale: '', session: '', forwardeduseragent: '', @@ -128,7 +129,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '26.2.0', + 'x-sdk-version': '27.0.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.9.5', }; @@ -245,6 +246,20 @@ class Client { this.config.jwt = value; return this; } + /** + * Set Bearer + * + * The OAuth access token to authenticate with + * + * @param value string + * + * @return {this} + */ + setBearer(value: string): this { + this.headers['Authorization'] = value; + this.config.bearer = value; + return this; + } /** * Set Locale * @@ -316,7 +331,7 @@ class Client { /** * 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. + * Impersonate a user by ID * * @param value string * @@ -330,7 +345,7 @@ class Client { /** * 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. + * Impersonate a user by email * * @param value string * @@ -344,7 +359,7 @@ class Client { /** * 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. + * Impersonate a user by phone * * @param value string * @@ -660,6 +675,7 @@ class Client { async ping(): Promise { return this.call('GET', new URL(this.config.endpoint + '/ping'), { 'X-Appwrite-Project': this.config.project, + 'accept': 'application/json', }); } diff --git a/src/enums/billing-plan-group.ts b/src/enums/billing-plan-group.ts new file mode 100644 index 0000000..8aa025b --- /dev/null +++ b/src/enums/billing-plan-group.ts @@ -0,0 +1,5 @@ +export enum BillingPlanGroup { + Starter = 'starter', + Pro = 'pro', + Scale = 'scale', +} \ No newline at end of file diff --git a/src/enums/database-status.ts b/src/enums/database-status.ts new file mode 100644 index 0000000..9e9cb51 --- /dev/null +++ b/src/enums/database-status.ts @@ -0,0 +1,5 @@ +export enum DatabaseStatus { + Provisioning = 'provisioning', + Ready = 'ready', + Failed = 'failed', +} \ 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 d4da4c4..0000000 --- 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 9dbc681..0000000 --- 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/health-queue-name.ts b/src/enums/health-queue-name.ts deleted file mode 100644 index 81320f8..0000000 --- a/src/enums/health-queue-name.ts +++ /dev/null @@ -1,15 +0,0 @@ -export enum HealthQueueName { - 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-oidc-prompt.ts b/src/enums/o-auth-2-oidc-prompt.ts new file mode 100644 index 0000000..daa1ef0 --- /dev/null +++ b/src/enums/o-auth-2-oidc-prompt.ts @@ -0,0 +1,6 @@ +export enum OAuth2OidcPrompt { + None = 'none', + Login = 'login', + 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 cc9e340..e7136d6 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -1,6 +1,7 @@ export enum OAuthProvider { Amazon = 'amazon', Apple = 'apple', + Appwrite = 'appwrite', Auth0 = 'auth0', Authentik = 'authentik', Autodesk = 'autodesk', diff --git a/src/enums/organization-key-scopes.ts b/src/enums/organization-key-scopes.ts index 05c96d2..a4ff3fb 100644 --- a/src/enums/organization-key-scopes.ts +++ b/src/enums/organization-key-scopes.ts @@ -5,6 +5,10 @@ export enum OrganizationKeyScopes { DevKeysWrite = 'devKeys.write', OrganizationKeysRead = 'organization.keys.read', OrganizationKeysWrite = 'organization.keys.write', + OrganizationMembershipsRead = 'organization.memberships.read', + OrganizationMembershipsWrite = 'organization.memberships.write', + OrganizationRead = 'organization.read', + OrganizationWrite = 'organization.write', DomainsRead = 'domains.read', DomainsWrite = 'domains.write', KeysRead = 'keys.read', diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts index 927acf8..7f97ba9 100644 --- a/src/enums/project-key-scopes.ts +++ b/src/enums/project-key-scopes.ts @@ -11,10 +11,12 @@ export enum ProjectKeyScopes { PoliciesWrite = 'policies.write', ProjectPoliciesRead = 'project.policies.read', ProjectPoliciesWrite = 'project.policies.write', + ProjectOauth2Read = 'project.oauth2.read', + ProjectOauth2Write = 'project.oauth2.write', TemplatesRead = 'templates.read', TemplatesWrite = 'templates.write', - Oauth2Read = 'oauth2.read', - Oauth2Write = 'oauth2.write', + StagesRead = 'stages.read', + StagesWrite = 'stages.write', UsersRead = 'users.read', UsersWrite = 'users.write', SessionsRead = 'sessions.read', @@ -95,5 +97,7 @@ export enum ProjectKeyScopes { EventsRead = 'events.read', AppsRead = 'apps.read', AppsWrite = 'apps.write', + Oauth2Read = 'oauth2.read', + Oauth2Write = 'oauth2.write', UsageRead = 'usage.read', } \ No newline at end of file diff --git a/src/enums/project-o-auth-2-oidc-prompt.ts b/src/enums/project-o-auth-2-oidc-prompt.ts new file mode 100644 index 0000000..6d346b1 --- /dev/null +++ b/src/enums/project-o-auth-2-oidc-prompt.ts @@ -0,0 +1,6 @@ +export enum ProjectOAuth2OidcPrompt { + None = 'none', + Login = 'login', + Consent = 'consent', + SelectAccount = 'select_account', +} \ No newline at end of file diff --git a/src/enums/project-o-auth-provider-id.ts b/src/enums/project-o-auth-provider-id.ts index e1ed1b8..125ee88 100644 --- a/src/enums/project-o-auth-provider-id.ts +++ b/src/enums/project-o-auth-provider-id.ts @@ -1,6 +1,7 @@ export enum ProjectOAuthProviderId { Amazon = 'amazon', Apple = 'apple', + Appwrite = 'appwrite', Auth0 = 'auth0', Authentik = 'authentik', Autodesk = 'autodesk', diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts index be2ea72..823727a 100644 --- a/src/enums/project-policy-id.ts +++ b/src/enums/project-policy-id.ts @@ -12,4 +12,5 @@ export enum ProjectPolicyId { Denyaliasedemail = 'deny-aliased-email', Denydisposableemail = 'deny-disposable-email', Denyfreeemail = 'deny-free-email', + Denycorporateemail = 'deny-corporate-email', } \ No newline at end of file diff --git a/src/enums/project-service-id.ts b/src/enums/project-service-id.ts index 01f844a..0da78c5 100644 --- a/src/enums/project-service-id.ts +++ b/src/enums/project-service-id.ts @@ -17,4 +17,5 @@ export enum ProjectServiceId { Migrations = 'migrations', Messaging = 'messaging', Advisor = 'advisor', + Oauth2 = 'oauth2', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6e11f54..efa797e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,6 @@ 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 { Organization } from './services/organization'; @@ -19,7 +18,6 @@ export { Storage } from './services/storage'; export { TablesDB } from './services/tables-db'; export { Teams } from './services/teams'; export { Tokens } from './services/tokens'; -export { Usage } from './services/usage'; export { Users } from './services/users'; export { Webhooks } from './services/webhooks'; export type { Models, Payload, UploadProgress } from './client'; @@ -49,13 +47,13 @@ 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 { HealthQueueName } from './enums/health-queue-name'; export { MessagePriority } from './enums/message-priority'; export { SmtpEncryption } from './enums/smtp-encryption'; export { OrganizationKeyScopes } from './enums/organization-key-scopes'; export { Region } from './enums/region'; export { ProjectAuthMethodId } from './enums/project-auth-method-id'; export { ProjectOAuth2GooglePrompt } from './enums/project-o-auth-2-google-prompt'; +export { ProjectOAuth2OidcPrompt } from './enums/project-o-auth-2-oidc-prompt'; export { ProjectOAuthProviderId } from './enums/project-o-auth-provider-id'; export { ProjectPolicyId } from './enums/project-policy-id'; export { ProjectProtocolId } from './enums/project-protocol-id'; @@ -74,6 +72,7 @@ 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 { DatabaseStatus } from './enums/database-status'; export { AttributeStatus } from './enums/attribute-status'; export { ColumnStatus } from './enums/column-status'; export { IndexStatus } from './enums/index-status'; @@ -81,9 +80,9 @@ 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 { OAuth2OidcPrompt } from './enums/o-auth-2-oidc-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'; +export { BillingPlanGroup } from './enums/billing-plan-group'; diff --git a/src/models.ts b/src/models.ts index 2c72952..5e56cfa 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1,4 +1,5 @@ import { DatabaseType } from "./enums/database-type" +import { DatabaseStatus } from "./enums/database-status" import { AttributeStatus } from "./enums/attribute-status" import { ColumnStatus } from "./enums/column-status" import { IndexStatus } from "./enums/index-status" @@ -9,12 +10,12 @@ import { ProjectAuthMethodId } from "./enums/project-auth-method-id" import { ProjectServiceId } from "./enums/project-service-id" import { ProjectProtocolId } from "./enums/project-protocol-id" import { OAuth2GooglePrompt } from "./enums/o-auth-2-google-prompt" +import { OAuth2OidcPrompt } from "./enums/o-auth-2-oidc-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" +import { BillingPlanGroup } from "./enums/billing-plan-group" /** * Appwrite Models @@ -496,7 +497,7 @@ export namespace Models { /** * List of policies. */ - policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordStrength | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail)[]; + policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordStrength | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail | Models.PolicyDenyCorporateEmail)[]; } /** @@ -513,20 +514,6 @@ export namespace Models { templates: EmailTemplate[]; } - /** - * Status List - */ - export type HealthStatusList = { - /** - * Total number of statuses that matched your query. - */ - total: number; - /** - * List of statuses. - */ - statuses: HealthStatus[]; - } - /** * Rule List */ @@ -709,6 +696,10 @@ export namespace Models { * Database type. */ type: DatabaseType; + /** + * Database status. Possible values: `provisioning`, `ready` or `failed` + */ + status?: DatabaseStatus; /** * Database backup policies. */ @@ -1364,7 +1355,7 @@ export namespace Models { /** * Default value for attribute when not provided. Cannot be set when attribute is required. */ - default?: any[]; + default?: number[]; } /** @@ -1406,7 +1397,7 @@ export namespace Models { /** * Default value for attribute when not provided. Cannot be set when attribute is required. */ - default?: any[]; + default?: number[][]; } /** @@ -1448,7 +1439,7 @@ export namespace Models { /** * Default value for attribute when not provided. Cannot be set when attribute is required. */ - default?: any[]; + default?: number[][][]; } /** @@ -2284,7 +2275,7 @@ export namespace Models { /** * Default value for column when not provided. Cannot be set when column is required. */ - default?: any[]; + default?: number[]; } /** @@ -2326,7 +2317,7 @@ export namespace Models { /** * Default value for column when not provided. Cannot be set when column is required. */ - default?: any[]; + default?: number[][]; } /** @@ -2368,7 +2359,7 @@ export namespace Models { /** * Default value for column when not provided. Cannot be set when column is required. */ - default?: any[]; + default?: number[][][]; } /** @@ -2796,7 +2787,7 @@ export namespace Models { */ mode: string; /** - * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + * User type who triggered the audit log. Possible values: user, admin, guest, hidden, keyProject, keyAccount, keyOrganization. */ userType: string; /** @@ -3336,6 +3327,50 @@ export namespace Models { * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format */ currency: string; + /** + * City + */ + city?: string; + /** + * Name of timezone + */ + timeZone?: string; + /** + * Postal code + */ + postalCode?: string; + /** + * Latitude + */ + latitude?: number; + /** + * Longitude + */ + longitude?: number; + /** + * Autonomous System Number (ASN) of the IP + */ + autonomousSystemNumber?: string; + /** + * Organization that owns the ASN + */ + autonomousSystemOrganization?: string; + /** + * Internet service provider of the IP + */ + isp?: string; + /** + * Connection type of the IP (e.g. cable, cellular, corporate) + */ + connectionType?: string; + /** + * User type classification of the IP (e.g. residential, business, hosting) + */ + connectionUsageType?: string; + /** + * Registered organization of the IP + */ + connectionOrganization?: string; } /** @@ -4252,6 +4287,10 @@ export namespace Models { * Project status */ status: string; + /** + * Stage progress (completed or skipped) with timestamps and actor types, keyed by stage id. + */ + onboarding: object; /** * List of auth methods. */ @@ -4279,59 +4318,63 @@ export namespace Models { /** * OAuth2 server status */ - oAuth2ServerEnabled: boolean; + oAuth2ServerEnabled?: boolean; /** * OAuth2 server authorization URL */ - oAuth2ServerAuthorizationUrl: string; + oAuth2ServerAuthorizationUrl?: string; /** * OAuth2 server allowed scopes */ - oAuth2ServerScopes: string[]; + oAuth2ServerScopes?: string[]; + /** + * OAuth2 server scopes used when an authorization request omits the scope parameter + */ + oAuth2ServerDefaultScopes?: string[]; /** * OAuth2 server accepted RFC 9396 authorization_details types */ - oAuth2ServerAuthorizationDetailsTypes: string[]; + oAuth2ServerAuthorizationDetailsTypes?: string[]; /** * OAuth2 server access token duration in seconds for confidential clients */ - oAuth2ServerAccessTokenDuration: number; + oAuth2ServerAccessTokenDuration?: number; /** * OAuth2 server refresh token duration in seconds for confidential clients */ - oAuth2ServerRefreshTokenDuration: number; + oAuth2ServerRefreshTokenDuration?: number; /** * OAuth2 server access token duration in seconds for public clients (SPAs, mobile, native) */ - oAuth2ServerPublicAccessTokenDuration: number; + oAuth2ServerPublicAccessTokenDuration?: number; /** * OAuth2 server refresh token duration in seconds for public clients (SPAs, mobile, native) */ - oAuth2ServerPublicRefreshTokenDuration: number; + oAuth2ServerPublicRefreshTokenDuration?: number; /** * When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. */ - oAuth2ServerConfidentialPkce: boolean; + oAuth2ServerConfidentialPkce?: boolean; /** * URL to your application page where users enter the device flow user code. Empty when the Device Authorization Grant is not configured. */ - oAuth2ServerVerificationUrl: string; + oAuth2ServerVerificationUrl?: string; /** * Number of characters in the device flow user code, excluding the formatting separator. */ - oAuth2ServerUserCodeLength: number; + oAuth2ServerUserCodeLength?: number; /** * Character set for device flow user codes: `numeric`, `alphabetic`, or `alphanumeric`. */ - oAuth2ServerUserCodeFormat: string; + oAuth2ServerUserCodeFormat?: string; /** * Lifetime in seconds of device flow device codes and user codes. */ - oAuth2ServerDeviceCodeDuration: number; + oAuth2ServerDeviceCodeDuration?: number; /** * OAuth2 server discovery URL */ - oAuth2ServerDiscoveryUrl: string; + oAuth2ServerDiscoveryUrl?: string; } /** @@ -5268,6 +5311,28 @@ export namespace Models { endpoint: string; } + /** + * OAuth2Appwrite + */ + export type OAuth2Appwrite = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Appwrite OAuth2 client ID. + */ + clientId: string; + /** + * Appwrite OAuth2 client secret. + */ + clientSecret: string; + } + /** * OAuth2Authentik */ @@ -5412,6 +5477,14 @@ export namespace Models { * OpenID Connect user info endpoint URL. */ userInfoURL: string; + /** + * OpenID Connect prompt values controlling the authentication and consent screens. + */ + prompt: OAuth2OidcPrompt[]; + /** + * Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds. + */ + maxAge?: number; } /** @@ -5533,7 +5606,7 @@ export namespace Models { /** * 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)[]; + 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.OAuth2Appwrite | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft)[]; } /** @@ -6012,96 +6085,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 */ @@ -6788,62 +6771,36 @@ export namespace Models { * Hostname. */ hostname: string; + } + + /** + * AdditionalResource + */ + export type AdditionalResource = { /** - * 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. + * Resource name */ - clientEngineVersion: string; + name: string; /** - * Device name. + * Resource unit */ - deviceName: string; + unit: string; /** - * Device brand name. + * Price currency */ - deviceBrand: string; + currency: string; /** - * Device model name. + * Price */ - deviceModel: string; + price: number; /** - * Country two-character ISO 3166-1 alpha code. + * Resource value */ - countryCode: string; + value: number; /** - * Country name. + * Description on invoice */ - countryName: string; + invoiceDesc: string; } /** @@ -6939,179 +6896,665 @@ export namespace Models { } /** - * Block + * billingPlan */ - export type Block = { + export type BillingPlan = { /** - * Block creation date in ISO 8601 format. + * Plan ID. */ - $createdAt: string; + $id: string; /** - * Resource type that is blocked + * Plan name */ - resourceType: string; + name: string; /** - * Resource identifier that is blocked + * Plan description */ - resourceId: string; + desc: string; /** - * Reason for the block. Can be null if no reason was provided. + * Plan order */ - reason?: string; + order: number; /** - * Block expiration date in ISO 8601 format. Can be null if the block does not expire. + * Price */ - expiredAt?: string; + price: number; /** - * Name of the project this block applies to. + * Trial days */ - projectName: string; + trial: number; /** - * Region of the project this block applies to. + * Bandwidth */ - region: string; + bandwidth: number; /** - * Name of the organization that owns the project. + * Storage */ - organizationName: string; + storage: number; /** - * ID of the organization that owns the project. + * Image Transformations */ - organizationId: string; + imageTransformations: number; /** - * Billing plan of the organization that owns the project. + * Screenshots generated */ - billingPlan: string; - } - - /** - * backup - */ - export type BackupPolicy = { + screenshotsGenerated: number; /** - * Backup policy ID. + * Members */ - $id: string; + members: number; /** - * Backup policy name. + * Webhooks */ - name: string; + webhooks: number; /** - * Policy creation date in ISO 8601 format. + * Projects */ - $createdAt: string; + projects: number; /** - * Policy update date in ISO 8601 format. + * Platforms */ - $updatedAt: string; + platforms: number; /** - * The services that are backed up by this policy. + * Users */ - services: string[]; + users: number; /** - * The resources that are backed up by this policy. + * Teams */ - resources: string[]; + teams: number; /** - * The resource ID to backup. Set only if this policy should backup a single resource. + * Databases */ - resourceId?: string; + databases: number; /** - * The resource type to backup. Set only if this policy should backup a single resource. + * Database reads per month */ - resourceType?: string; + databasesReads: number; /** - * How many days to keep the backup before it will be automatically deleted. + * Database writes per month */ - retention: number; + databasesWrites: number; /** - * Policy backup schedule in CRON format. + * Database batch size limit */ - schedule: string; + databasesBatchSize: number; /** - * Is this policy enabled. + * Buckets */ - enabled: boolean; - } - - /** - * Policy Deny Aliased Email - */ - export type PolicyDenyAliasedEmail = { + buckets: number; /** - * Policy ID. + * File size */ - $id: string; + fileSize: number; /** - * Whether the deny aliased email policy is enabled. + * Functions */ - enabled: boolean; - } - - /** - * Policy Deny Disposable Email - */ - export type PolicyDenyDisposableEmail = { + functions: number; /** - * Policy ID. + * Sites */ - $id: string; + sites: number; /** - * Whether the deny disposable email policy is enabled. + * Function executions */ - enabled: boolean; - } - - /** - * Policy Deny Free Email - */ - export type PolicyDenyFreeEmail = { + executions: number; /** - * Policy ID. + * Rolling max executions retained per function/site */ - $id: string; + executionsRetentionCount: number; /** - * Whether the deny free email policy is enabled. + * GB hours for functions */ - enabled: boolean; - } - - /** - * Restoration - */ - export type BackupRestoration = { + GBHours: number; /** - * Restoration ID. + * Realtime connections */ - $id: string; + realtime: number; /** - * Restoration creation time in ISO 8601 format. + * Realtime messages */ - $createdAt: string; + realtimeMessages: number; /** - * Restoration update date in ISO 8601 format. + * Messages per month + */ + messages: number; + /** + * Topics for messaging + */ + topics: number; + /** + * SMS authentications per month + */ + authPhone: number; + /** + * Custom domains + */ + domains: number; + /** + * Activity log days + */ + activityLogs: number; + /** + * Usage history days + */ + usageLogs: number; + /** + * Usage log time intervals allowed for this plan (e.g. 15m, 1h, 1d). + */ + usageLogsIntervals?: string[]; + /** + * Number of days of console inactivity before a project is paused. 0 means pausing is disabled. + */ + projectInactivityDays: number; + /** + * Alert threshold percentage + */ + alertLimit: number; + /** + * Additional resources + */ + usage: UsageBillingPlan; + /** + * Addons + */ + addons: BillingPlanAddon; + /** + * Budget cap enabled or disabled. + */ + budgetCapEnabled: boolean; + /** + * Custom SMTP + */ + customSmtp: boolean; + /** + * Appwrite branding in email + */ + emailBranding: boolean; + /** + * Does plan require payment method + */ + requiresPaymentMethod: boolean; + /** + * Does plan require billing address + */ + requiresBillingAddress: boolean; + /** + * Is the billing plan available + */ + isAvailable: boolean; + /** + * Can user change the plan themselves + */ + selfService: boolean; + /** + * Does plan enable premium support + */ + premiumSupport: boolean; + /** + * Does plan support budget cap + */ + budgeting: boolean; + /** + * Does plan support mock numbers + */ + supportsMockNumbers: boolean; + /** + * Does plan support organization roles + */ + supportsOrganizationRoles: boolean; + /** + * Does plan support credit + */ + supportsCredits: boolean; + /** + * Does plan support blocking disposable email addresses. + */ + supportsDisposableEmailValidation: boolean; + /** + * Does plan support requiring canonical email addresses. + */ + supportsCanonicalEmailValidation: boolean; + /** + * Does plan support blocking free email addresses. + */ + supportsFreeEmailValidation: boolean; + /** + * Does plan support restricting sign-ups to corporate email addresses only. + */ + supportsCorporateEmailValidation: boolean; + /** + * Does plan support project-specific member roles. + */ + supportsProjectSpecificRoles: boolean; + /** + * Does plan support backup policies. + */ + backupsEnabled: boolean; + /** + * Whether usage addons are calculated per project. + */ + usagePerProject: boolean; + /** + * Supported addons for this plan + */ + supportedAddons: BillingPlanSupportedAddons; + /** + * How many policies does plan support + */ + backupPolicies: number; + /** + * Maximum function and site deployment size in MB + */ + deploymentSize: number; + /** + * Maximum function and site deployment size in MB + */ + buildSize: number; + /** + * Does the plan support encrypted string attributes or not. + */ + databasesAllowEncrypt: boolean; + /** + * Plan specific limits + */ + limits?: BillingPlanLimits; + /** + * Group of this billing plan for variants + */ + group: BillingPlanGroup; + /** + * Details of the program this plan is a part of. + */ + program?: Program; + /** + * Dedicated database limits available to this plan. + */ + dedicatedDatabases?: BillingPlanDedicatedDatabaseLimits; + } + + /** + * Addon + */ + export type BillingPlanAddon = { + /** + * Addon seats + */ + seats: BillingPlanAddonDetails; + /** + * Addon projects + */ + projects: BillingPlanAddonDetails; + } + + /** + * Details + */ + export type BillingPlanAddonDetails = { + /** + * Is the addon supported in the plan? + */ + supported: boolean; + /** + * Addon plan included value + */ + planIncluded: number; + /** + * Addon limit + */ + limit: number; + /** + * Addon type + */ + type: string; + /** + * Price currency + */ + currency: string; + /** + * Price + */ + price: number; + /** + * Resource value + */ + value: number; + /** + * Description on invoice + */ + invoiceDesc: string; + } + + /** + * PlanLimits + */ + export type BillingPlanLimits = { + /** + * Credits limit per billing cycle + */ + credits?: number; + /** + * Daily credits limit (if applicable) + */ + dailyCredits?: number; + } + + /** + * dedicatedDatabaseLimits + */ + export type BillingPlanDedicatedDatabaseLimits = { + /** + * Minimum CPU allocation in millicores. + */ + minCpu?: number; + /** + * Maximum CPU allocation in millicores. + */ + maxCpu?: number; + /** + * Minimum memory allocation in megabytes. + */ + minMemoryMb?: number; + /** + * Maximum memory allocation in megabytes. + */ + maxMemoryMb?: number; + /** + * Minimum storage allocation in gigabytes. + */ + minStorageGb?: number; + /** + * Maximum storage allocation in gigabytes. + */ + maxStorageGb?: number; + /** + * Maximum number of high-availability replicas per dedicated database. + */ + maxReplicas?: number; + /** + * Maximum number of client connections. + */ + maxConnections?: number; + /** + * Maximum number of entries allowed in the IP allowlist. + */ + maxIpAllowlistSize?: number; + /** + * Maximum number of database extensions that can be enabled. + */ + maxExtensions?: number; + /** + * Maximum number of days a backup can be retained. + */ + maxBackupRetentionDays?: number; + /** + * Maximum number of days of point-in-time recovery data that can be retained. + */ + maxPitrRetentionDays?: number; + /** + * Maximum number of rows a single SQL API query can return. + */ + maxSqlApiMaxRows?: number; + /** + * Maximum response size in bytes for a single SQL API query. + */ + maxSqlApiMaxBytes?: number; + /** + * Maximum execution time in seconds for a single SQL API query. + */ + maxSqlApiTimeoutSeconds?: number; + /** + * Maximum number of SQL statement types that can be permitted through the SQL API. + */ + maxSqlApiAllowedStatements?: number; + /** + * SQL statement types permitted through the SQL API. + */ + allowedSqlStatements?: string[]; + /** + * Storage classes available for dedicated databases. + */ + allowedStorageClasses?: string[]; + /** + * Replica synchronization modes available for dedicated databases. + */ + allowedSyncModes?: string[]; + } + + /** + * BillingPlanSupportedAddons + */ + export type BillingPlanSupportedAddons = { + /** + * Whether the plan supports BAA (Business Associate Agreement) addon + */ + baa: boolean; + /** + * Whether the plan supports Premium Geo DB addon (project-level) + */ + premiumGeoDB: boolean; + /** + * Whether the plan supports Premium Geo DB addon (organization-level) + */ + premiumGeoDBOrg: boolean; + } + + /** + * 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; + /** + * Block mode. full blocks reads and writes; readOnly blocks writes only. + */ + mode: 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; + } + + /** + * Organization + */ + export type Organization = { + /** + * Team ID. + */ + $id: string; + /** + * Team creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Team update date in ISO 8601 format. */ $updatedAt: string; /** - * Backup archive ID. + * Team name. */ - archiveId: string; + name: string; /** - * Backup policy ID. + * Total number of team members. */ - policyId: string; + total: number; /** - * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. + * Team preferences as a key-value object + */ + prefs: Preferences; + /** + * Project budget limit + */ + billingBudget: number; + /** + * Project budget limit + */ + budgetAlerts: number[]; + /** + * Organization's billing plan ID. + */ + billingPlan: string; + /** + * Organization's billing plan ID. + */ + billingPlanId: string; + /** + * Organization's billing plan. + */ + billingPlanDetails: BillingPlan; + /** + * Billing email set for the organization. + */ + billingEmail: string; + /** + * Billing cycle start date. + */ + billingStartDate: string; + /** + * Current invoice cycle start date. + */ + billingCurrentInvoiceDate: string; + /** + * Next invoice cycle start date. + */ + billingNextInvoiceDate: string; + /** + * Start date of trial. + */ + billingTrialStartDate: string; + /** + * Number of trial days. + */ + billingTrialDays: number; + /** + * Current active aggregation id. + */ + billingAggregationId: string; + /** + * Current active aggregation id. + */ + billingInvoiceId: string; + /** + * Default payment method. + */ + paymentMethodId: string; + /** + * Default payment method. + */ + billingAddressId: string; + /** + * Backup payment method. + */ + backupPaymentMethodId: string; + /** + * Team status. */ status: string; /** - * The backup start time. + * Remarks on team status. */ - startedAt: string; + remarks: string; /** - * Migration ID. + * Organization agreements */ - migrationId: string; + agreementBAA: string; + /** + * Program manager's name. + */ + programManagerName: string; + /** + * Program manager's calendar link. + */ + programManagerCalendar: string; + /** + * Program's discord channel name. + */ + programDiscordChannelName: string; + /** + * Program's discord channel URL. + */ + programDiscordChannelUrl: string; + /** + * Billing limits reached + */ + billingLimits?: BillingLimits; + /** + * Billing plan selected for downgrade. + */ + billingPlanDowngrade: string; + /** + * Tax Id + */ + billingTaxId: string; + /** + * Marked for deletion + */ + markedForDeletion: boolean; + /** + * Product with which the organization is associated (appwrite or imagine) + */ + platform: string; + /** + * Selected projects + */ + projects: 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. */ @@ -7121,81 +7564,227 @@ export namespace Models { */ resources: string[]; /** - * Optional data in key-value object. + * The resource ID to backup. Set only if this policy should backup a single resource. */ - options: string; + 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; + /** + * Backup type. Possible values: full (complete database snapshot), incremental (changes since last backup). + */ + type: string; + /** + * Is this policy enabled. + */ + enabled: boolean; } /** - * usageEvent + * Policy Deny Aliased Email */ - export type UsageEvent = { + export type PolicyDenyAliasedEmail = { /** - * The metric key. + * Policy ID. */ - metric: string; + $id: string; /** - * The metric value. + * Whether the deny aliased email policy is enabled. */ - value: number; + enabled: boolean; + } + + /** + * Policy Deny Disposable Email + */ + export type PolicyDenyDisposableEmail = { /** - * The event timestamp. + * Policy ID. */ - time: string; + $id: string; + /** + * Whether the deny disposable email policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Deny Free Email + */ + export type PolicyDenyFreeEmail = { /** - * The API endpoint path. + * Policy ID. */ - path: string; + $id: string; /** - * The HTTP method. + * Whether the deny free email policy is enabled. */ - method: string; + enabled: boolean; + } + + /** + * Policy Deny Corporate Email + */ + export type PolicyDenyCorporateEmail = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether the deny non-corporate email policy is enabled. + */ + enabled: boolean; + } + + /** + * Program + */ + export type Program = { + /** + * Program ID + */ + $id: string; + /** + * Program title + */ + title: string; + /** + * Program description + */ + description: string; + /** + * Program tag for highlighting on console + */ + tag: string; + /** + * Program icon for highlighting on console + */ + icon: string; + /** + * URL for more information on this program + */ + url: string; + /** + * Whether this program is active + */ + active: boolean; + /** + * Whether this program is external + */ + external: boolean; + /** + * Billing plan ID that this is program is associated with. + */ + billingPlanId: string; + } + + /** + * 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; /** - * HTTP status code. Stored as string to preserve unset state (empty string = not available). + * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. */ status: string; /** - * The resource type. + * The backup start time. */ - resourceType: string; + startedAt: string; /** - * The resource ID. + * Migration ID. */ - resourceId: string; + migrationId: string; /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. + * The services that are backed up by this policy. */ - countryCode: string; + services: string[]; /** - * The user agent string. + * The resources that are backed up by this policy. */ - userAgent: string; + resources: string[]; + /** + * Optional data in key-value object. + */ + options: string; } /** - * usageGauge + * usageBillingPlan */ - export type UsageGauge = { + export type UsageBillingPlan = { /** - * The metric key. + * Bandwidth additional resources */ - metric: string; + bandwidth: AdditionalResource; /** - * The current snapshot value. + * Executions additional resources */ - value: number; + executions: AdditionalResource; /** - * The snapshot timestamp. + * Member additional resources */ - time: string; + member: AdditionalResource; /** - * The resource type. + * Realtime additional resources */ - resourceType: string; + realtime: AdditionalResource; /** - * The resource ID. + * Realtime messages additional resources */ - resourceId: string; + realtimeMessages: AdditionalResource; + /** + * Realtime bandwidth additional resources + */ + realtimeBandwidth: AdditionalResource; + /** + * Storage additional resources + */ + storage: AdditionalResource; + /** + * User additional resources + */ + users: AdditionalResource; + /** + * GBHour additional resources + */ + GBHours: AdditionalResource; + /** + * Image transformation additional resources + */ + imageTransformations: AdditionalResource; + /** + * Credits additional resources + */ + credits: AdditionalResource; } /** @@ -7253,32 +7842,4 @@ export namespace Models { */ restorations: BackupRestoration[]; } - - /** - * Usage events list - */ - export type UsageEventList = { - /** - * Total number of events that matched your query. - */ - total: number; - /** - * List of events. - */ - events: UsageEvent[]; - } - - /** - * Usage gauges list - */ - export type UsageGaugeList = { - /** - * Total number of gauges that matched your query. - */ - total: number; - /** - * List of gauges. - */ - gauges: UsageGauge[]; - } } diff --git a/src/query.ts b/src/query.ts index fdd9f40..e0e9725 100644 --- a/src/query.ts +++ b/src/query.ts @@ -494,6 +494,36 @@ export class Query { static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); + /** + * Filter resources using vector dot product similarity. + * + * @param {string} attribute + * @param {number[]} vector + * @returns {string} + */ + static vectorDot = (attribute: string, vector: number[]): string => + new Query("vectorDot", attribute, [vector] as QueryTypesList).toString(); + + /** + * Filter resources using vector cosine similarity. + * + * @param {string} attribute + * @param {number[]} vector + * @returns {string} + */ + static vectorCosine = (attribute: string, vector: number[]): string => + new Query("vectorCosine", attribute, [vector] as QueryTypesList).toString(); + + /** + * Filter resources using vector Euclidean distance. + * + * @param {string} attribute + * @param {number[]} vector + * @returns {string} + */ + static vectorEuclidean = (attribute: string, vector: number[]): string => + new Query("vectorEuclidean", attribute, [vector] as QueryTypesList).toString(); + /** * Filter resources where attribute intersects with the given geometry. * diff --git a/src/services/account.ts b/src/services/account.ts index 474bfba..57aadeb 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -292,7 +292,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "identityId"'); } - const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId); + const apiPath = '/account/identities/{identityId}'.replace('{identityId}', encodeURIComponent(String(identityId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -518,7 +518,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -572,7 +572,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -635,7 +635,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "otp"'); } - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; if (typeof otp !== 'undefined') { payload['otp'] = otp; @@ -700,7 +700,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "otp"'); } - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; if (typeof otp !== 'undefined') { payload['otp'] = otp; @@ -758,7 +758,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -811,7 +811,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2100,7 +2100,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "sessionId"'); } - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', encodeURIComponent(String(sessionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2153,7 +2153,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "sessionId"'); } - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', encodeURIComponent(String(sessionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2207,7 +2207,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "sessionId"'); } - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', encodeURIComponent(String(sessionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2426,7 +2426,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, 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 {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, 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. @@ -2441,7 +2441,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, 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 {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, 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. @@ -2476,7 +2476,7 @@ export class Account { throw new AppwriteException('Missing required parameter: "provider"'); } - const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider); + const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', encodeURIComponent(String(provider))); const payload: Payload = {}; if (typeof success !== 'undefined') { payload['success'] = success; diff --git a/src/services/activities.ts b/src/services/activities.ts index 10b8062..e473154 100644 --- a/src/services/activities.ts +++ b/src/services/activities.ts @@ -101,7 +101,7 @@ export class Activities { throw new AppwriteException('Missing required parameter: "eventId"'); } - const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); + const apiPath = '/activities/events/{eventId}'.replace('{eventId}', encodeURIComponent(String(eventId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/advisor.ts b/src/services/advisor.ts index c735c29..ccb67d3 100644 --- a/src/services/advisor.ts +++ b/src/services/advisor.ts @@ -111,7 +111,7 @@ export class Advisor { throw new AppwriteException('Missing required parameter: "reportId"'); } - const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const apiPath = '/reports/{reportId}'.replace('{reportId}', encodeURIComponent(String(reportId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -166,7 +166,7 @@ export class Advisor { throw new AppwriteException('Missing required parameter: "reportId"'); } - const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const apiPath = '/reports/{reportId}'.replace('{reportId}', encodeURIComponent(String(reportId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -230,7 +230,7 @@ export class Advisor { throw new AppwriteException('Missing required parameter: "reportId"'); } - const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', reportId); + const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', encodeURIComponent(String(reportId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -299,7 +299,7 @@ export class Advisor { throw new AppwriteException('Missing required parameter: "insightId"'); } - const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', reportId).replace('{insightId}', insightId); + const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', encodeURIComponent(String(reportId))).replace('{insightId}', encodeURIComponent(String(insightId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 0e71d1a..d6914c0 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -70,7 +70,7 @@ export class Avatars { throw new AppwriteException('Missing required parameter: "code"'); } - const apiPath = '/avatars/browsers/{code}'.replace('{code}', code); + const apiPath = '/avatars/browsers/{code}'.replace('{code}', encodeURIComponent(String(code))); const payload: Payload = {}; if (typeof width !== 'undefined') { payload['width'] = width; @@ -152,7 +152,7 @@ export class Avatars { throw new AppwriteException('Missing required parameter: "code"'); } - const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code); + const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', encodeURIComponent(String(code))); const payload: Payload = {}; if (typeof width !== 'undefined') { payload['width'] = width; @@ -295,7 +295,7 @@ export class Avatars { throw new AppwriteException('Missing required parameter: "code"'); } - const apiPath = '/avatars/flags/{code}'.replace('{code}', code); + const apiPath = '/avatars/flags/{code}'.replace('{code}', encodeURIComponent(String(code))); const payload: Payload = {}; if (typeof width !== 'undefined') { payload['width'] = width; diff --git a/src/services/backups.ts b/src/services/backups.ts index 098db6d..38b5cc0 100644 --- a/src/services/backups.ts +++ b/src/services/backups.ts @@ -165,7 +165,7 @@ export class Backups { throw new AppwriteException('Missing required parameter: "archiveId"'); } - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); + const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', encodeURIComponent(String(archiveId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -218,7 +218,7 @@ export class Backups { throw new AppwriteException('Missing required parameter: "archiveId"'); } - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); + const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', encodeURIComponent(String(archiveId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -434,7 +434,7 @@ export class Backups { throw new AppwriteException('Missing required parameter: "policyId"'); } - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -504,7 +504,7 @@ export class Backups { throw new AppwriteException('Missing required parameter: "policyId"'); } - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -570,7 +570,7 @@ export class Backups { throw new AppwriteException('Missing required parameter: "policyId"'); } - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -590,41 +590,50 @@ export class Backups { /** * Create and trigger a new restoration for a backup on a project. + * + * When restoring a DocumentsDB or VectorsDB database to a new resource, pass `newSpecification` to provision the restored database on a different specification than the archived one (for example, restoring onto a larger or smaller dedicated database). Use `serverless` to restore onto the shared pool, or a dedicated specification slug to restore onto a dedicated database of that size. The specification must be permitted by the organization's plan. `newSpecification` is not supported for legacy/TablesDB databases or for bucket restores. + * * * @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. + * @param {string} params.newSpecification - Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use `serverless` for the shared pool or a dedicated specification slug. * @throws {AppwriteException} * @returns {Promise} */ - createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise; + createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string }): Promise; /** * Create and trigger a new restoration for a backup on a project. + * + * When restoring a DocumentsDB or VectorsDB database to a new resource, pass `newSpecification` to provision the restored database on a different specification than the archived one (for example, restoring onto a larger or smaller dedicated database). Use `serverless` to restore onto the shared pool, or a dedicated specification slug to restore onto a dedicated database of that size. The specification must be permitted by the organization's plan. `newSpecification` is not supported for legacy/TablesDB databases or for bucket restores. + * * * @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. + * @param {string} newSpecification - Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use `serverless` for the shared pool or a dedicated specification slug. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise; + createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string): Promise; createRestoration( - paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, - ...rest: [(BackupServices[])?, (string)?, (string)?] + paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string } | string, + ...rest: [(BackupServices[])?, (string)?, (string)?, (string)?] ): Promise { - let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; + let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; + params = (paramsOrFirst || {}) as { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string }; } else { params = { archiveId: paramsOrFirst as string, services: rest[0] as BackupServices[], newResourceId: rest[1] as string, - newResourceName: rest[2] as string + newResourceName: rest[2] as string, + newSpecification: rest[3] as string }; } @@ -632,6 +641,7 @@ export class Backups { const services = params.services; const newResourceId = params.newResourceId; const newResourceName = params.newResourceName; + const newSpecification = params.newSpecification; if (typeof archiveId === 'undefined') { throw new AppwriteException('Missing required parameter: "archiveId"'); @@ -654,6 +664,9 @@ export class Backups { if (typeof newResourceName !== 'undefined') { payload['newResourceName'] = newResourceName; } + if (typeof newSpecification !== 'undefined') { + payload['newSpecification'] = newSpecification; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -759,7 +772,7 @@ export class Backups { throw new AppwriteException('Missing required parameter: "restorationId"'); } - const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId); + const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', encodeURIComponent(String(restorationId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/databases.ts b/src/services/databases.ts index 8107a94..ee501f8 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -167,6 +167,7 @@ export class Databases { * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTransactions` instead. */ listTransactions(params?: { queries?: string[] }): Promise; /** @@ -220,6 +221,7 @@ export class Databases { * @param {number} params.ttl - Seconds before the transaction expires. * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTransaction` instead. */ createTransaction(params?: { ttl?: number }): Promise; /** @@ -274,6 +276,7 @@ export class Databases { * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTransaction` instead. */ getTransaction(params: { transactionId: string }): Promise; /** @@ -304,7 +307,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -329,6 +332,7 @@ export class Databases { * @param {boolean} params.rollback - Rollback transaction? * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTransaction` instead. */ updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise; /** @@ -366,7 +370,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; if (typeof commit !== 'undefined') { payload['commit'] = commit; @@ -396,6 +400,7 @@ export class Databases { * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTransaction` instead. */ deleteTransaction(params: { transactionId: string }): Promise<{}>; /** @@ -426,7 +431,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -450,6 +455,7 @@ export class Databases { * @param {object[]} params.operations - Array of staged operations. * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createOperations` instead. */ createOperations(params: { transactionId: string, operations?: object[] }): Promise; /** @@ -484,7 +490,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/databases/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); + const apiPath = '/databases/transactions/{transactionId}/operations'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; if (typeof operations !== 'undefined') { payload['operations'] = operations; @@ -542,7 +548,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -605,7 +611,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -666,7 +672,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -733,7 +739,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -831,7 +837,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; if (typeof collectionId !== 'undefined') { payload['collectionId'] = collectionId; @@ -915,7 +921,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "collectionId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -997,7 +1003,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "collectionId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -1075,7 +1081,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "collectionId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1145,7 +1151,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "collectionId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1245,7 +1251,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1361,7 +1367,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -1463,7 +1469,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1563,7 +1569,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -1657,7 +1663,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1757,7 +1763,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -1853,7 +1859,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1955,7 +1961,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2058,7 +2064,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2170,7 +2176,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof elements !== 'undefined') { payload['elements'] = elements; @@ -2277,7 +2283,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2393,7 +2399,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2503,7 +2509,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2619,7 +2625,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2721,7 +2727,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2823,7 +2829,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2857,12 +2863,12 @@ export class Databases { * @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. + * @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} * @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; + createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][] }): Promise; /** * Create a geometric line attribute. * @@ -2870,27 +2876,27 @@ export class Databases { * @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. + * @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} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + 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[] }; + 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[] + xdefault: rest[3] as any[][] }; } @@ -2913,7 +2919,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2947,13 +2953,13 @@ export class Databases { * @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 {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} * @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; + updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string }): Promise; /** * Update a line attribute. Changing the `default` value will not update already existing documents. * @@ -2961,28 +2967,28 @@ export class Databases { * @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 {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} * @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; + updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string): Promise; updateLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + 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 }; + 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[], + xdefault: rest[3] as any[][], newKey: rest[4] as string }; } @@ -3007,7 +3013,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3047,6 +3053,7 @@ export class Databases { * @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} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLongtextColumn` instead. */ createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** @@ -3106,7 +3113,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3151,6 +3158,7 @@ export class Databases { * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLongtextColumn` instead. */ updateLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** @@ -3210,7 +3218,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3250,6 +3258,7 @@ export class Databases { * @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} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createMediumtextColumn` instead. */ createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** @@ -3309,7 +3318,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3354,6 +3363,7 @@ export class Databases { * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateMediumtextColumn` instead. */ updateMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** @@ -3413,7 +3423,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3447,12 +3457,12 @@ export class Databases { * @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. + * @param {number[]} 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} * @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; + createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[] }): Promise; /** * Create a geometric point attribute. * @@ -3460,27 +3470,27 @@ export class Databases { * @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. + * @param {number[]} 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} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[]): Promise; createPointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number[])?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[] }; } 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[] + xdefault: rest[3] as number[] }; } @@ -3503,7 +3513,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3537,13 +3547,13 @@ export class Databases { * @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 {number[]} 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} * @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; + updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], newKey?: string }): Promise; /** * Update a point attribute. Changing the `default` value will not update already existing documents. * @@ -3551,28 +3561,28 @@ export class Databases { * @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 {number[]} 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} * @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; + updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], newKey?: string): Promise; updatePointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number[])?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], 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 }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: 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 any[], + xdefault: rest[3] as number[], newKey: rest[4] as string }; } @@ -3597,7 +3607,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3631,12 +3641,12 @@ export class Databases { * @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. + * @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} * @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; + createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][] }): Promise; /** * Create a geometric polygon attribute. * @@ -3644,27 +3654,27 @@ export class Databases { * @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. + * @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} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createPolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + 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[] }; + 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[] + xdefault: rest[3] as any[][] }; } @@ -3687,7 +3697,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3721,13 +3731,13 @@ export class Databases { * @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 {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} * @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; + updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string }): Promise; /** * Update a polygon attribute. Changing the `default` value will not update already existing documents. * @@ -3735,28 +3745,28 @@ export class Databases { * @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 {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} * @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; + updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string): Promise; updatePolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + 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 }; + 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[], + xdefault: rest[3] as any[][], newKey: rest[4] as string }; } @@ -3781,7 +3791,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3885,7 +3895,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof relatedCollectionId !== 'undefined') { payload['relatedCollectionId'] = relatedCollectionId; @@ -3983,7 +3993,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof onDelete !== 'undefined') { payload['onDelete'] = onDelete; @@ -4087,7 +4097,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4199,7 +4209,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4242,6 +4252,7 @@ export class Databases { * @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} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTextColumn` instead. */ createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** @@ -4301,7 +4312,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4346,6 +4357,7 @@ export class Databases { * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. */ updateTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; /** @@ -4405,7 +4417,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4501,7 +4513,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4603,7 +4615,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4644,6 +4656,7 @@ export class Databases { * @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} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createVarcharColumn` instead. */ createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; /** @@ -4709,7 +4722,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4758,6 +4771,7 @@ export class Databases { * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateVarcharColumn` instead. */ updateVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; /** @@ -4820,7 +4834,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4902,7 +4916,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -4971,7 +4985,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5049,7 +5063,7 @@ export class Databases { 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/{collectionId}/documents'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5145,7 +5159,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "data"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof documentId !== 'undefined') { payload['documentId'] = documentId; @@ -5231,7 +5245,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "documents"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof documents !== 'undefined') { payload['documents'] = documents; @@ -5313,7 +5327,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "documents"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof documents !== 'undefined') { payload['documents'] = documents; @@ -5394,7 +5408,7 @@ export class Databases { 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/{collectionId}/documents'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof data !== 'undefined') { payload['data'] = data; @@ -5474,7 +5488,7 @@ export class Databases { 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/{collectionId}/documents'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5558,7 +5572,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "documentId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5645,7 +5659,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "documentId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); const payload: Payload = {}; if (typeof data !== 'undefined') { payload['data'] = data; @@ -5736,7 +5750,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "documentId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); const payload: Payload = {}; if (typeof data !== 'undefined') { payload['data'] = data; @@ -5819,7 +5833,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "documentId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); const payload: Payload = {}; if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; @@ -5910,7 +5924,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "attribute"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))).replace('{attribute}', encodeURIComponent(String(attribute))); const payload: Payload = {}; if (typeof value !== 'undefined') { payload['value'] = value; @@ -6008,7 +6022,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "attribute"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))).replace('{attribute}', encodeURIComponent(String(attribute))); const payload: Payload = {}; if (typeof value !== 'undefined') { payload['value'] = value; @@ -6088,7 +6102,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "collectionId"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -6187,7 +6201,7 @@ export class Databases { throw new AppwriteException('Missing required parameter: "attributes"'); } - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -6272,7 +6286,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -6341,7 +6355,7 @@ export class Databases { 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 apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/functions.ts b/src/services/functions.ts index 1a0fb93..9957381 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -99,7 +99,7 @@ export class Functions { * @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 {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 200 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. @@ -128,7 +128,7 @@ export class Functions { * @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 {ProjectKeyScopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 200 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. @@ -324,13 +324,41 @@ export class Functions { /** * List allowed function specifications for this instance. * + * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. * @throws {AppwriteException} * @returns {Promise} */ - listSpecifications(): Promise { + listSpecifications(params?: { type?: string }): Promise; + /** + * List allowed function specifications for this instance. + * + * @param {string} type - Specification type to list. Can be one of: runtimes, builds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSpecifications(type?: string): Promise; + listSpecifications( + paramsOrFirst?: { type?: string } | string + ): Promise { + let params: { type?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type?: string }; + } else { + params = { + type: paramsOrFirst as string + }; + } + + const type = params.type; + const apiPath = '/functions/specifications'; const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -382,7 +410,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -413,7 +441,7 @@ export class Functions { * @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 {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 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 @@ -442,7 +470,7 @@ export class Functions { * @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 {ProjectKeyScopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 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 @@ -523,7 +551,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -640,7 +668,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -701,7 +729,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof deploymentId !== 'undefined') { payload['deploymentId'] = deploymentId; @@ -771,7 +799,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -867,7 +895,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "activate"'); } - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof entrypoint !== 'undefined') { payload['entrypoint'] = entrypoint; @@ -946,7 +974,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof deploymentId !== 'undefined') { payload['deploymentId'] = deploymentId; @@ -1050,7 +1078,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "reference"'); } - const apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof repository !== 'undefined') { payload['repository'] = repository; @@ -1145,7 +1173,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "reference"'); } - const apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof type !== 'undefined') { payload['type'] = type; @@ -1216,7 +1244,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1277,7 +1305,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1300,40 +1328,44 @@ export class Functions { * @param {string} params.functionId - Function ID. * @param {string} params.deploymentId - Deployment ID. * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". + * @param {string} params.token - Presigned source-download token for accessing this deployment without a session (jobs-service). * @throws {AppwriteException} * @returns {Promise} */ - getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise; + getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }): Promise; /** * 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". + * @param {string} token - Presigned source-download token for accessing this deployment without a session (jobs-service). * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): Promise; + getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string): Promise; getDeploymentDownload( - paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, - ...rest: [(string)?, (DeploymentDownloadType)?] + paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string } | string, + ...rest: [(string)?, (DeploymentDownloadType)?, (string)?] ): Promise { - let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; + let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; } else { params = { functionId: paramsOrFirst as string, deploymentId: rest[0] as string, - type: rest[1] as DeploymentDownloadType + type: rest[1] as DeploymentDownloadType, + token: rest[2] as string }; } const functionId = params.functionId; const deploymentId = params.deploymentId; const type = params.type; + const token = params.token; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -1342,11 +1374,14 @@ export class Functions { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; if (typeof type !== 'undefined') { payload['type'] = type; } + if (typeof token !== 'undefined') { + payload['token'] = token; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1407,7 +1442,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1470,7 +1505,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1554,7 +1589,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof body !== 'undefined') { payload['body'] = body; @@ -1634,7 +1669,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "executionId"'); } - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{executionId}', encodeURIComponent(String(executionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1695,7 +1730,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "executionId"'); } - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{executionId}', encodeURIComponent(String(executionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1757,7 +1792,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1842,7 +1877,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "value"'); } - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', encodeURIComponent(String(functionId))); const payload: Payload = {}; if (typeof variableId !== 'undefined') { payload['variableId'] = variableId; @@ -1916,7 +1951,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1989,7 +2024,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2060,7 +2095,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', encodeURIComponent(String(functionId))).replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/health.ts b/src/services/health.ts deleted file mode 100644 index 6b8ceda..0000000 --- a/src/services/health.ts +++ /dev/null @@ -1,1117 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { HealthQueueName } from '../enums/health-queue-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} - */ - get(): Promise { - - const apiPath = '/health'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite Antivirus server is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getAntivirus(): Promise { - - const apiPath = '/health/anti-virus'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the database that backs the audit and activity store. When the connection is reachable the endpoint returns a passing status with its response time. - * - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getAuditsDB(): Promise { - - const apiPath = '/health/audits-db'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getCache(): Promise { - - const apiPath = '/health/cache'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the SSL certificate for a domain - * - * @param {string} params.domain - string - * @throws {AppwriteException} - * @returns {Promise} - */ - getCertificate(params?: { domain?: string }): Promise; - /** - * Get the SSL certificate for a domain - * - * @param {string} domain - string - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getCertificate(domain?: string): Promise; - getCertificate( - paramsOrFirst?: { domain?: string } | string - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getConsolePausing(params?: { threshold?: number, inactivityDays?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getConsolePausing(threshold?: number, inactivityDays?: number): Promise; - getConsolePausing( - paramsOrFirst?: { threshold?: number, inactivityDays?: number } | number, - ...rest: [(number)?] - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite database servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getDB(): Promise { - - const apiPath = '/health/db'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite pub-sub servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getPubSub(): Promise { - - const apiPath = '/health/pubsub'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueAudits(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueAudits(threshold?: number): Promise; - getQueueAudits( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueBuilds(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueBuilds(threshold?: number): Promise; - getQueueBuilds( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueCertificates(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueCertificates(threshold?: number): Promise; - getQueueCertificates( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueDatabases(params?: { name?: string, threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueDatabases(name?: string, threshold?: number): Promise; - getQueueDatabases( - paramsOrFirst?: { name?: string, threshold?: number } | string, - ...rest: [(number)?] - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueDeletes(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueDeletes(threshold?: number): Promise; - getQueueDeletes( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Returns the amount of failed jobs in a given queue. - * - * - * @param {HealthQueueName} 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} - */ - getFailedJobs(params: { name: HealthQueueName, threshold?: number }): Promise; - /** - * Returns the amount of failed jobs in a given queue. - * - * - * @param {HealthQueueName} 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFailedJobs(name: HealthQueueName, threshold?: number): Promise; - getFailedJobs( - paramsOrFirst: { name: HealthQueueName, threshold?: number } | HealthQueueName, - ...rest: [(number)?] - ): Promise { - let params: { name: HealthQueueName, threshold?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('name' in paramsOrFirst || 'threshold' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name: HealthQueueName, threshold?: number }; - } else { - params = { - name: paramsOrFirst as HealthQueueName, - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueFunctions(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueFunctions(threshold?: number): Promise; - getQueueFunctions( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueLogs(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueLogs(threshold?: number): Promise; - getQueueLogs( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueMails(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMails(threshold?: number): Promise; - getQueueMails( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueMessaging(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMessaging(threshold?: number): Promise; - getQueueMessaging( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueMigrations(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMigrations(threshold?: number): Promise; - getQueueMigrations( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueStatsResources(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueStatsResources(threshold?: number): Promise; - getQueueStatsResources( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueUsage(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueUsage(threshold?: number): Promise; - getQueueUsage( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getQueueWebhooks(params?: { threshold?: number }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueWebhooks(threshold?: number): Promise; - getQueueWebhooks( - paramsOrFirst?: { threshold?: number } | number - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite storage device is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getStorage(): Promise { - - const apiPath = '/health/storage'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite local storage device is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - getStorageLocal(): Promise { - - const apiPath = '/health/storage/local'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - getTime(): Promise { - - const apiPath = '/health/time'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/messaging.ts b/src/services/messaging.ts index a1c719a..95646cc 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -304,7 +304,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "messageId"'); } - const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', messageId); + const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); const payload: Payload = {}; if (typeof topics !== 'undefined') { payload['topics'] = topics; @@ -650,7 +650,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "messageId"'); } - const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', messageId); + const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); const payload: Payload = {}; if (typeof topics !== 'undefined') { payload['topics'] = topics; @@ -993,7 +993,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "messageId"'); } - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); + const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); const payload: Payload = {}; if (typeof topics !== 'undefined') { payload['topics'] = topics; @@ -1092,7 +1092,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "messageId"'); } - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); + const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); const payload: Payload = {}; if (typeof topics !== 'undefined') { payload['topics'] = topics; @@ -1166,7 +1166,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "messageId"'); } - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); + const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1219,7 +1219,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "messageId"'); } - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); + const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1236,74 +1236,6 @@ export class Messaging { ); } - /** - * 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} - */ - listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMessageLogs(messageId: string, queries?: string[], total?: boolean): Promise; - listMessageLogs( - paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - /** * Get a list of the targets associated with a message. * @@ -1349,7 +1281,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "messageId"'); } - const apiPath = '/messaging/messages/{messageId}/targets'.replace('{messageId}', messageId); + const apiPath = '/messaging/messages/{messageId}/targets'.replace('{messageId}', encodeURIComponent(String(messageId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1727,7 +1659,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -1831,7 +1763,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -2085,7 +2017,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -2161,7 +2093,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -2385,7 +2317,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/mailgun/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/mailgun/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -2583,7 +2515,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -2791,7 +2723,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -3005,7 +2937,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -3241,7 +3173,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/ses/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/ses/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -3687,7 +3619,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -3833,7 +3765,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4043,7 +3975,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/telesign/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/telesign/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4229,7 +4161,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/textmagic/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/textmagic/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4415,7 +4347,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/twilio/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/twilio/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4601,7 +4533,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/vonage/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/vonage/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4672,7 +4604,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -4725,7 +4657,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -4742,142 +4674,6 @@ export class Messaging { ); } - /** - * 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} - */ - listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listProviderLogs(providerId: string, queries?: string[], total?: boolean): Promise; - listProviderLogs( - paramsOrFirst: { providerId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - 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} - */ - listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSubscriberLogs(subscriberId: string, queries?: string[], total?: boolean): Promise; - listSubscriberLogs( - paramsOrFirst: { subscriberId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - /** * Get a list of all topics from the current Appwrite project. * @@ -5059,7 +4855,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "topicId"'); } - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', encodeURIComponent(String(topicId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5123,7 +4919,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "topicId"'); } - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', encodeURIComponent(String(topicId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -5183,7 +4979,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "topicId"'); } - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', encodeURIComponent(String(topicId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5200,74 +4996,6 @@ export class Messaging { ); } - /** - * 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} - */ - listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise; - /** - * 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} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTopicLogs(topicId: string, queries?: string[], total?: boolean): Promise; - listTopicLogs( - paramsOrFirst: { topicId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise { - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - /** * Get a list of all subscribers from the current Appwrite project. * @@ -5317,7 +5045,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "topicId"'); } - const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); + const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', encodeURIComponent(String(topicId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5394,7 +5122,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "targetId"'); } - const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); + const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', encodeURIComponent(String(topicId))); const payload: Payload = {}; if (typeof subscriberId !== 'undefined') { payload['subscriberId'] = subscriberId; @@ -5464,7 +5192,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "subscriberId"'); } - const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); + const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', encodeURIComponent(String(topicId))).replace('{subscriberId}', encodeURIComponent(String(subscriberId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5525,7 +5253,7 @@ export class Messaging { throw new AppwriteException('Missing required parameter: "subscriberId"'); } - const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); + const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', encodeURIComponent(String(topicId))).replace('{subscriberId}', encodeURIComponent(String(subscriberId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/organization.ts b/src/services/organization.ts index c28cc7b..83d4977 100644 --- a/src/services/organization.ts +++ b/src/services/organization.ts @@ -12,6 +12,113 @@ export class Organization { this.client = client; } + /** + * Get the current organization. + * + * @throws {AppwriteException} + * @returns {Promise>} + */ + get(): Promise> { + + const apiPath = '/organization'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the current organization's name. + * + * @param {string} params.name - New organization name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise>} + */ + update(params: { name: string }): Promise>; + /** + * Update the current organization's name. + * + * @param {string} name - New organization name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(name: string): Promise>; + update( + paramsOrFirst: { name: string } | string + ): Promise> { + let params: { name: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { name: string }; + } else { + params = { + name: paramsOrFirst as string + }; + } + + const name = params.name; + + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/organization'; + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete the current organization. All projects that belong to the organization are deleted as well. + * + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(): Promise<{}> { + + const apiPath = '/organization'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + /** * Get a list of all API keys from the current organization. * @@ -78,7 +185,7 @@ export class Organization { * * @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 {OrganizationKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {OrganizationKeyScopes[]} params.scopes - Key scopes list. Maximum of 200 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} @@ -89,7 +196,7 @@ export class Organization { * * @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 {OrganizationKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {OrganizationKeyScopes[]} scopes - Key scopes list. Maximum of 200 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} @@ -194,7 +301,7 @@ export class Organization { throw new AppwriteException('Missing required parameter: "keyId"'); } - const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -216,7 +323,7 @@ export class Organization { * * @param {string} params.keyId - Key unique ID. * @param {string} params.name - Key name. Max length: 128 chars. - * @param {OrganizationKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {OrganizationKeyScopes[]} params.scopes - Key scopes list. Maximum of 200 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} @@ -227,7 +334,7 @@ export class Organization { * * @param {string} keyId - Key unique ID. * @param {string} name - Key name. Max length: 128 chars. - * @param {OrganizationKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {OrganizationKeyScopes[]} scopes - Key scopes list. Maximum of 200 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} @@ -266,7 +373,7 @@ export class Organization { throw new AppwriteException('Missing required parameter: "scopes"'); } - const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -329,7 +436,339 @@ export class Organization { throw new AppwriteException('Missing required parameter: "keyId"'); } - const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all memberships from the current organization. + * + * @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} + */ + listMemberships(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + /** + * Get a list of all memberships from the current organization. + * + * @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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMemberships(queries?: string[], search?: string, total?: boolean): Promise; + listMemberships( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise { + 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 = '/organization/memberships'; + 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 } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Invite a new member to join the current organization. An email with a link to join the organization will be sent to the new member's email address. If member doesn't exist in the project it will be automatically created. + * + * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @param {string} params.email - Email of the new organization member. + * @param {string} params.userId - ID of the user to be added to the organization. + * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. + * @param {string} params.name - Name of the new organization member. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + createMembership(params: { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise; + /** + * Invite a new member to join the current organization. An email with a link to join the organization will be sent to the new member's email address. If member doesn't exist in the project it will be automatically created. + * + * @param {string[]} roles - Array of strings. Use this param to set the user roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @param {string} email - Email of the new organization member. + * @param {string} userId - ID of the user to be added to the organization. + * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. + * @param {string} name - Name of the new organization member. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMembership(roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise; + createMembership( + paramsOrFirst: { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string[], + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + } else { + params = { + roles: paramsOrFirst as string[], + email: rest[0] as string, + userId: rest[1] as string, + phone: rest[2] as string, + url: rest[3] as string, + name: rest[4] as string + }; + } + + const roles = params.roles; + const email = params.email; + const userId = params.userId; + const phone = params.phone; + const url = params.url; + const name = params.name; + + if (typeof roles === 'undefined') { + throw new AppwriteException('Missing required parameter: "roles"'); + } + + const apiPath = '/organization/memberships'; + const payload: Payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof phone !== 'undefined') { + payload['phone'] = phone; + } + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a membership from the current organization by its unique ID. + * + * @param {string} params.membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getMembership(params: { membershipId: string }): Promise; + /** + * Get a membership from the current organization by its unique ID. + * + * @param {string} membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMembership(membershipId: string): Promise; + getMembership( + paramsOrFirst: { membershipId: string } | string + ): Promise { + let params: { membershipId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { membershipId: string }; + } else { + params = { + membershipId: paramsOrFirst as string + }; + } + + const membershipId = params.membershipId; + + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + + const apiPath = '/organization/memberships/{membershipId}'.replace('{membershipId}', encodeURIComponent(String(membershipId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Modify the roles of a member in the current organization. + * + * @param {string} params.membershipId - Membership ID. + * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMembership(params: { membershipId: string, roles: string[] }): Promise; + /** + * Modify the roles of a member in the current organization. + * + * @param {string} membershipId - Membership ID. + * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the organization. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMembership(membershipId: string, roles: string[]): Promise; + updateMembership( + paramsOrFirst: { membershipId: string, roles: string[] } | string, + ...rest: [(string[])?] + ): Promise { + let params: { membershipId: string, roles: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { membershipId: string, roles: string[] }; + } else { + params = { + membershipId: paramsOrFirst as string, + roles: rest[0] as string[] + }; + } + + const membershipId = params.membershipId; + const roles = params.roles; + + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + if (typeof roles === 'undefined') { + throw new AppwriteException('Missing required parameter: "roles"'); + } + + const apiPath = '/organization/memberships/{membershipId}'.replace('{membershipId}', encodeURIComponent(String(membershipId))); + const payload: Payload = {}; + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Remove a member from the current organization. The member is removed whether they accepted the invitation or not; a pending invitation is revoked. + * + * @param {string} params.membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMembership(params: { membershipId: string }): Promise<{}>; + /** + * Remove a member from the current organization. The member is removed whether they accepted the invitation or not; a pending invitation is revoked. + * + * @param {string} membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMembership(membershipId: string): Promise<{}>; + deleteMembership( + paramsOrFirst: { membershipId: string } | string + ): Promise<{}> { + let params: { membershipId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { membershipId: string }; + } else { + params = { + membershipId: paramsOrFirst as string + }; + } + + const membershipId = params.membershipId; + + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + + const apiPath = '/organization/memberships/{membershipId}'.replace('{membershipId}', encodeURIComponent(String(membershipId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -349,7 +788,7 @@ export class Organization { /** * Get a list of all projects. 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, teamId, labels, search + * @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, teamId, labels, search, accessedAt * @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} @@ -359,7 +798,7 @@ export class Organization { /** * Get a list of all projects. 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, teamId, labels, search + * @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, teamId, labels, search, accessedAt * @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} @@ -525,7 +964,7 @@ export class Organization { throw new AppwriteException('Missing required parameter: "projectId"'); } - const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', projectId); + const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', encodeURIComponent(String(projectId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -585,7 +1024,7 @@ export class Organization { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', projectId); + const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', encodeURIComponent(String(projectId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -642,7 +1081,7 @@ export class Organization { throw new AppwriteException('Missing required parameter: "projectId"'); } - const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', projectId); + const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', encodeURIComponent(String(projectId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/presences.ts b/src/services/presences.ts index 51fb984..d7e8af9 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -118,7 +118,7 @@ export class Presences { throw new AppwriteException('Missing required parameter: "presenceId"'); } - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -200,7 +200,7 @@ export class Presences { throw new AppwriteException('Missing required parameter: "status"'); } - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); const payload: Payload = {}; if (typeof userId !== 'undefined') { payload['userId'] = userId; @@ -299,7 +299,7 @@ export class Presences { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); const payload: Payload = {}; if (typeof userId !== 'undefined') { payload['userId'] = userId; @@ -373,7 +373,7 @@ export class Presences { throw new AppwriteException('Missing required parameter: "presenceId"'); } - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/project.ts b/src/services/project.ts index 45207af..1d79f2f 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -5,6 +5,7 @@ import type { Models } from '../models'; import { ProjectAuthMethodId } from '../enums/project-auth-method-id'; import { ProjectKeyScopes } from '../enums/project-key-scopes'; import { ProjectOAuth2GooglePrompt } from '../enums/project-o-auth-2-google-prompt'; +import { ProjectOAuth2OidcPrompt } from '../enums/project-o-auth-2-oidc-prompt'; import { ProjectOAuthProviderId } from '../enums/project-o-auth-provider-id'; import { ProjectPolicyId } from '../enums/project-policy-id'; import { ProjectProtocolId } from '../enums/project-protocol-id'; @@ -113,7 +114,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "enabled"'); } - const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', methodId); + const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', encodeURIComponent(String(methodId))); const payload: Payload = {}; if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; @@ -202,7 +203,7 @@ export class Project { * * @param {string} params.keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} params.name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 200 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} @@ -215,7 +216,7 @@ export class Project { * * @param {string} keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 200 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} @@ -289,7 +290,7 @@ export class Project { * * You can also create a standard API key if you need a longer-lived key instead. * - * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 200 scopes are allowed. * @param {number} params.duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. * @throws {AppwriteException} * @returns {Promise} @@ -300,7 +301,7 @@ export class Project { * * You can also create a standard API key if you need a longer-lived key instead. * - * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 200 scopes are allowed. * @param {number} duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. * @throws {AppwriteException} * @returns {Promise} @@ -392,7 +393,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "keyId"'); } - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -414,7 +415,7 @@ export class Project { * * @param {string} params.keyId - Key ID. * @param {string} params.name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 200 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} @@ -425,7 +426,7 @@ export class Project { * * @param {string} keyId - Key ID. * @param {string} name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 200 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} @@ -464,7 +465,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "scopes"'); } - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -527,7 +528,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "keyId"'); } - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -766,7 +767,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "number"'); } - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const apiPath = '/project/mock-phones/{number}'.replace('{number}', encodeURIComponent(String(number))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -827,7 +828,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "otp"'); } - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const apiPath = '/project/mock-phones/{number}'.replace('{number}', encodeURIComponent(String(number))); const payload: Payload = {}; if (typeof otp !== 'undefined') { payload['otp'] = otp; @@ -884,7 +885,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "number"'); } - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const apiPath = '/project/mock-phones/{number}'.replace('{number}', encodeURIComponent(String(number))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -978,10 +979,11 @@ export class Project { * @param {number} params.userCodeLength - Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. * @param {string} params.userCodeFormat - Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. * @param {number} params.deviceCodeDuration - Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. + * @param {string[]} params.defaultScopes - List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long. * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number }): Promise; + updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }): Promise; /** * Update the OAuth2 server (OIDC provider) configuration. * @@ -998,19 +1000,20 @@ export class Project { * @param {number} userCodeLength - Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. * @param {string} userCodeFormat - Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. * @param {number} deviceCodeDuration - Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. + * @param {string[]} defaultScopes - List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number): Promise; + updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[]): Promise; updateOAuth2Server( - paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number } | boolean, - ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?] + paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] } | boolean, + ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?, (string[])?] ): Promise { - let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number }; + let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number }; + params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; } else { params = { enabled: paramsOrFirst as boolean, @@ -1025,7 +1028,8 @@ export class Project { verificationUrl: rest[8] as string, userCodeLength: rest[9] as number, userCodeFormat: rest[10] as string, - deviceCodeDuration: rest[11] as number + deviceCodeDuration: rest[11] as number, + defaultScopes: rest[12] as string[] }; } @@ -1042,6 +1046,7 @@ export class Project { const userCodeLength = params.userCodeLength; const userCodeFormat = params.userCodeFormat; const deviceCodeDuration = params.deviceCodeDuration; + const defaultScopes = params.defaultScopes; if (typeof enabled === 'undefined') { throw new AppwriteException('Missing required parameter: "enabled"'); @@ -1091,6 +1096,9 @@ export class Project { if (typeof deviceCodeDuration !== 'undefined') { payload['deviceCodeDuration'] = deviceCodeDuration; } + if (typeof defaultScopes !== 'undefined') { + payload['defaultScopes'] = defaultScopes; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1259,6 +1267,75 @@ export class Project { ); } + /** + * Update the project OAuth2 Appwrite configuration. + * + * @param {string} params.clientId - 'Client ID' of Appwrite OAuth2 app. For example: 6a42000000000000b5a0 + * @param {string} params.clientSecret - 'Client Secret' of Appwrite OAuth2 app. For example: b86afd000000000000000000000000000000000000000000000000000ced5f93 + * @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} + */ + updateOAuth2Appwrite(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + /** + * Update the project OAuth2 Appwrite configuration. + * + * @param {string} clientId - 'Client ID' of Appwrite OAuth2 app. For example: 6a42000000000000b5a0 + * @param {string} clientSecret - 'Client Secret' of Appwrite OAuth2 app. For example: b86afd000000000000000000000000000000000000000000000000000ced5f93 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Appwrite(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; + updateOAuth2Appwrite( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/appwrite'; + 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 } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + /** * Update the project OAuth2 Auth0 configuration. * @@ -2842,11 +2919,13 @@ export class Project { * @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 {ProjectOAuth2OidcPrompt[]} params.prompt - Array of OpenID Connect prompt values controlling the authentication and consent screens. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + * @param {number} params.maxAge - Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds, otherwise they are prompted to re-authenticate. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }): Promise; + updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean }): Promise; /** * Update the project OAuth2 Oidc configuration. * @@ -2856,20 +2935,22 @@ export class Project { * @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 {ProjectOAuth2OidcPrompt[]} prompt - Array of OpenID Connect prompt values controlling the authentication and consent screens. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + * @param {number} maxAge - Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds, otherwise they are prompted to re-authenticate. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean): Promise; + updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean): Promise; updateOAuth2Oidc( - paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (ProjectOAuth2OidcPrompt[])?, (number)?, (boolean)?] ): Promise { - let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; + let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, 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 }; + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean }; } else { params = { clientId: paramsOrFirst as string, @@ -2878,7 +2959,9 @@ export class Project { authorizationURL: rest[2] as string, tokenURL: rest[3] as string, userInfoURL: rest[4] as string, - enabled: rest[5] as boolean + prompt: rest[5] as ProjectOAuth2OidcPrompt[], + maxAge: rest[6] as number, + enabled: rest[7] as boolean }; } @@ -2888,6 +2971,8 @@ export class Project { const authorizationURL = params.authorizationURL; const tokenURL = params.tokenURL; const userInfoURL = params.userInfoURL; + const prompt = params.prompt; + const maxAge = params.maxAge; const enabled = params.enabled; @@ -2911,6 +2996,12 @@ export class Project { if (typeof userInfoURL !== 'undefined') { payload['userInfoURL'] = userInfoURL; } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } + if (typeof maxAge !== 'undefined') { + payload['maxAge'] = maxAge; + } if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } @@ -4153,7 +4244,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -4360,7 +4451,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "applicationId"'); } - const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', platformId); + const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4513,7 +4604,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); } - const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', platformId); + const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4666,7 +4757,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "packageName"'); } - const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', platformId); + const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4819,7 +4910,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "hostname"'); } - const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', platformId); + const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -4972,7 +5063,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); } - const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', platformId); + const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -5032,7 +5123,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "platformId"'); } - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5085,7 +5176,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "platformId"'); } - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5220,6 +5311,63 @@ export class Project { ); } + /** + * Configures if only corporate email addresses (non-free and non-disposable domains) are allowed during new user sign-ups and email updates. + * + * @param {boolean} params.enabled - Set whether or not to restrict sign-ups and email updates to corporate email addresses only. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDenyCorporateEmailPolicy(params: { enabled: boolean }): Promise; + /** + * Configures if only corporate email addresses (non-free and non-disposable domains) are allowed during new user sign-ups and email updates. + * + * @param {boolean} enabled - Set whether or not to restrict sign-ups and email updates to corporate email addresses only. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyCorporateEmailPolicy(enabled: boolean): Promise; + updateDenyCorporateEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/deny-corporate-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 } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': '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. * @@ -5970,23 +6118,23 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. + * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - getPolicy(params: { policyId: ProjectPolicyId }): Promise; + getPolicy(params: { policyId: ProjectPolicyId }): Promise; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. + * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: ProjectPolicyId): Promise; + getPolicy(policyId: ProjectPolicyId): Promise; getPolicy( paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId - ): Promise { + ): Promise { let params: { policyId: ProjectPolicyId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { @@ -6003,7 +6151,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "policyId"'); } - const apiPath = '/project/policies/{policyId}'.replace('{policyId}', policyId); + const apiPath = '/project/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -6064,7 +6212,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "enabled"'); } - const apiPath = '/project/protocols/{protocolId}'.replace('{protocolId}', protocolId); + const apiPath = '/project/protocols/{protocolId}'.replace('{protocolId}', encodeURIComponent(String(protocolId))); const payload: Payload = {}; if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; @@ -6088,7 +6236,7 @@ export class Project { /** * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. * - * @param {ProjectServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor + * @param {ProjectServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 * @param {boolean} params.enabled - Service status. * @throws {AppwriteException} * @returns {Promise} @@ -6097,7 +6245,7 @@ export class Project { /** * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. * - * @param {ProjectServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor + * @param {ProjectServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 * @param {boolean} enabled - Service status. * @throws {AppwriteException} * @returns {Promise} @@ -6129,7 +6277,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "enabled"'); } - const apiPath = '/project/services/{serviceId}'.replace('{serviceId}', serviceId); + const apiPath = '/project/services/{serviceId}'.replace('{serviceId}', encodeURIComponent(String(serviceId))); const payload: Payload = {}; if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; @@ -6533,7 +6681,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "templateId"'); } - const apiPath = '/project/templates/email/{templateId}'.replace('{templateId}', templateId); + const apiPath = '/project/templates/email/{templateId}'.replace('{templateId}', encodeURIComponent(String(templateId))); const payload: Payload = {}; if (typeof locale !== 'undefined') { payload['locale'] = locale; @@ -6735,7 +6883,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -6801,7 +6949,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -6864,7 +7012,7 @@ export class Project { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/proxy.ts b/src/services/proxy.ts index b2c53fa..04379aa 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -430,7 +430,7 @@ export class Proxy { throw new AppwriteException('Missing required parameter: "ruleId"'); } - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); + const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -483,7 +483,7 @@ export class Proxy { throw new AppwriteException('Missing required parameter: "ruleId"'); } - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); + const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -536,7 +536,7 @@ export class Proxy { throw new AppwriteException('Missing required parameter: "ruleId"'); } - const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', ruleId); + const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', encodeURIComponent(String(ruleId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/sites.ts b/src/services/sites.ts index 0de414a..314650f 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -334,13 +334,41 @@ export class Sites { /** * List allowed site specifications for this instance. * + * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. * @throws {AppwriteException} * @returns {Promise} */ - listSpecifications(): Promise { + listSpecifications(params?: { type?: string }): Promise; + /** + * List allowed site specifications for this instance. + * + * @param {string} type - Specification type to list. Can be one of: runtimes, builds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSpecifications(type?: string): Promise; + listSpecifications( + paramsOrFirst?: { type?: string } | string + ): Promise { + let params: { type?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type?: string }; + } else { + params = { + type: paramsOrFirst as string + }; + } + + const type = params.type; + const apiPath = '/sites/specifications'; const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -392,7 +420,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "siteId"'); } - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -540,7 +568,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "framework"'); } - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -660,7 +688,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "siteId"'); } - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -721,7 +749,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof deploymentId !== 'undefined') { payload['deploymentId'] = deploymentId; @@ -791,7 +819,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "siteId"'); } - const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -880,7 +908,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "code"'); } - const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof installCommand !== 'undefined') { payload['installCommand'] = installCommand; @@ -958,7 +986,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof deploymentId !== 'undefined') { payload['deploymentId'] = deploymentId; @@ -1059,7 +1087,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "reference"'); } - const apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof repository !== 'undefined') { payload['repository'] = repository; @@ -1154,7 +1182,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "reference"'); } - const apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof type !== 'undefined') { payload['type'] = type; @@ -1225,7 +1253,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1286,7 +1314,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1351,7 +1379,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; if (typeof type !== 'undefined') { payload['type'] = type; @@ -1416,7 +1444,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1479,7 +1507,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "siteId"'); } - const apiPath = '/sites/{siteId}/logs'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/logs'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1546,7 +1574,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "logId"'); } - const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); + const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{logId}', encodeURIComponent(String(logId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1607,7 +1635,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "logId"'); } - const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); + const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{logId}', encodeURIComponent(String(logId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1670,7 +1698,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "siteId"'); } - const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1755,7 +1783,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "value"'); } - const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); + const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', encodeURIComponent(String(siteId))); const payload: Payload = {}; if (typeof variableId !== 'undefined') { payload['variableId'] = variableId; @@ -1829,7 +1857,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1902,7 +1930,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1973,7 +2001,7 @@ export class Sites { throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', encodeURIComponent(String(siteId))).replace('{variableId}', encodeURIComponent(String(variableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/storage.ts b/src/services/storage.ts index f4ae7a0..7ff1932 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -249,7 +249,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "bucketId"'); } - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -346,7 +346,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -430,7 +430,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "bucketId"'); } - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -496,7 +496,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "bucketId"'); } - const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', encodeURIComponent(String(bucketId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -594,7 +594,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "file"'); } - const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', encodeURIComponent(String(bucketId))); const payload: Payload = {}; if (typeof fileId !== 'undefined') { payload['fileId'] = fileId; @@ -666,7 +666,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -735,7 +735,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -803,7 +803,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -868,7 +868,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; if (typeof token !== 'undefined') { payload['token'] = token; @@ -981,7 +981,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; if (typeof width !== 'undefined') { payload['width'] = width; @@ -1083,7 +1083,7 @@ export class Storage { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; if (typeof token !== 'undefined') { payload['token'] = token; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index aa4248f..57baaf2 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -89,10 +89,11 @@ export class TablesDB { * @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. + * @param {string} params.specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. * @throws {AppwriteException} * @returns {Promise} */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise; + create(params: { databaseId: string, name: string, enabled?: boolean, specification?: string }): Promise; /** * Create a new Database. * @@ -100,30 +101,33 @@ export class TablesDB { * @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. + * @param {string} specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(databaseId: string, name: string, enabled?: boolean): Promise; + create(databaseId: string, name: string, enabled?: boolean, specification?: string): Promise; create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, specification?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?] ): Promise { - let params: { databaseId: string, name: string, enabled?: boolean }; + let params: { databaseId: string, name: string, enabled?: boolean, specification?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, specification?: string }; } else { params = { databaseId: paramsOrFirst as string, name: rest[0] as string, - enabled: rest[1] as boolean + enabled: rest[1] as boolean, + specification: rest[2] as string }; } const databaseId = params.databaseId; const name = params.name; const enabled = params.enabled; + const specification = params.specification; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -143,6 +147,9 @@ export class TablesDB { if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } + if (typeof specification !== 'undefined') { + payload['specification'] = specification; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -302,7 +309,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -364,7 +371,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; if (typeof commit !== 'undefined') { payload['commit'] = commit; @@ -424,7 +431,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -482,7 +489,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); + const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', encodeURIComponent(String(transactionId))); const payload: Payload = {}; if (typeof operations !== 'undefined') { payload['operations'] = operations; @@ -539,7 +546,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -601,7 +608,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -661,7 +668,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -727,7 +734,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "databaseId"'); } - const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); + const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -824,7 +831,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); + const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', encodeURIComponent(String(databaseId))); const payload: Payload = {}; if (typeof tableId !== 'undefined') { payload['tableId'] = tableId; @@ -907,7 +914,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -988,7 +995,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -1065,7 +1072,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1134,7 +1141,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1233,7 +1240,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1348,7 +1355,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -1449,7 +1456,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1548,7 +1555,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -1641,7 +1648,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1740,7 +1747,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -1835,7 +1842,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -1936,7 +1943,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2036,7 +2043,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2147,7 +2154,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof elements !== 'undefined') { payload['elements'] = elements; @@ -2253,7 +2260,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2368,7 +2375,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2477,7 +2484,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2592,7 +2599,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2693,7 +2700,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2794,7 +2801,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -2828,11 +2835,11 @@ export class TablesDB { * @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 {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} */ - createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] }): Promise; /** * Create a geometric line column. * @@ -2840,27 +2847,27 @@ export class TablesDB { * @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 {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} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + 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[] }; + 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[] + xdefault: rest[3] as any[][] }; } @@ -2883,7 +2890,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -2917,12 +2924,12 @@ export class TablesDB { * @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 {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} */ - updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string }): Promise; /** * Update a line column. Changing the `default` value will not update already existing rows. * @@ -2930,28 +2937,28 @@ export class TablesDB { * @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 {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} * @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; + updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string): Promise; updateLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + 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 }; + 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[], + xdefault: rest[3] as any[][], newKey: rest[4] as string }; } @@ -2976,7 +2983,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3075,7 +3082,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3179,7 +3186,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3278,7 +3285,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3382,7 +3389,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3416,11 +3423,11 @@ export class TablesDB { * @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 {number[]} 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} */ - createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] }): Promise; /** * Create a geometric point column. * @@ -3428,27 +3435,27 @@ export class TablesDB { * @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 {number[]} 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} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[]): Promise; createPointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number[])?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] }; } 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[] + xdefault: rest[3] as number[] }; } @@ -3471,7 +3478,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3505,12 +3512,12 @@ export class TablesDB { * @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 {number[]} 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} */ - updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string }): Promise; /** * Update a point column. Changing the `default` value will not update already existing rows. * @@ -3518,28 +3525,28 @@ export class TablesDB { * @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 {number[]} 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} * @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; + updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string): Promise; updatePointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number[])?, (string)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], 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 }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: 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 any[], + xdefault: rest[3] as number[], newKey: rest[4] as string }; } @@ -3564,7 +3571,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3598,11 +3605,11 @@ export class TablesDB { * @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 {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} */ - createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise; + createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] }): Promise; /** * Create a geometric polygon column. * @@ -3610,27 +3617,27 @@ export class TablesDB { * @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 {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} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise; + createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createPolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + 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[] }; + 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[] + xdefault: rest[3] as any[][] }; } @@ -3653,7 +3660,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -3687,12 +3694,12 @@ export class TablesDB { * @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 {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} */ - updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise; + updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string }): Promise; /** * Update a polygon column. Changing the `default` value will not update already existing rows. * @@ -3700,28 +3707,28 @@ export class TablesDB { * @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 {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} * @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; + updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string): Promise; updatePolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + 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 }; + 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[], + xdefault: rest[3] as any[][], newKey: rest[4] as string }; } @@ -3746,7 +3753,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -3849,7 +3856,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof relatedTableId !== 'undefined') { payload['relatedTableId'] = relatedTableId; @@ -3965,7 +3972,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4077,7 +4084,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4179,7 +4186,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4283,7 +4290,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4378,7 +4385,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4479,7 +4486,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4585,7 +4592,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "required"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -4696,7 +4703,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof required !== 'undefined') { payload['required'] = required; @@ -4777,7 +4784,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -4845,7 +4852,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -4923,7 +4930,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; if (typeof onDelete !== 'undefined') { payload['onDelete'] = onDelete; @@ -4999,7 +5006,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5097,7 +5104,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "columns"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof key !== 'undefined') { payload['key'] = key; @@ -5181,7 +5188,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5249,7 +5256,7 @@ export class TablesDB { 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 apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5326,7 +5333,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5421,7 +5428,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "data"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof rowId !== 'undefined') { payload['rowId'] = rowId; @@ -5506,7 +5513,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "rows"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof rows !== 'undefined') { payload['rows'] = rows; @@ -5587,7 +5594,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "rows"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof rows !== 'undefined') { payload['rows'] = rows; @@ -5667,7 +5674,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof data !== 'undefined') { payload['data'] = data; @@ -5746,7 +5753,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "tableId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5829,7 +5836,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "rowId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -5915,7 +5922,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "rowId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); const payload: Payload = {}; if (typeof data !== 'undefined') { payload['data'] = data; @@ -6005,7 +6012,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "rowId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); const payload: Payload = {}; if (typeof data !== 'undefined') { payload['data'] = data; @@ -6087,7 +6094,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "rowId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); const payload: Payload = {}; if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; @@ -6177,7 +6184,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "column"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))).replace('{column}', encodeURIComponent(String(column))); const payload: Payload = {}; if (typeof value !== 'undefined') { payload['value'] = value; @@ -6274,7 +6281,7 @@ export class TablesDB { throw new AppwriteException('Missing required parameter: "column"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))).replace('{column}', encodeURIComponent(String(column))); const payload: Payload = {}; if (typeof value !== 'undefined') { payload['value'] = value; diff --git a/src/services/teams.ts b/src/services/teams.ts index 3a77c58..28a9533 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -189,7 +189,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "teamId"'); } - const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}'.replace('{teamId}', encodeURIComponent(String(teamId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -250,7 +250,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}'.replace('{teamId}', encodeURIComponent(String(teamId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -307,7 +307,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "teamId"'); } - const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}'.replace('{teamId}', encodeURIComponent(String(teamId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -373,7 +373,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "teamId"'); } - const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', encodeURIComponent(String(teamId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -477,7 +477,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "roles"'); } - const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', encodeURIComponent(String(teamId))); const payload: Payload = {}; if (typeof email !== 'undefined') { payload['email'] = email; @@ -557,7 +557,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "membershipId"'); } - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -627,7 +627,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "roles"'); } - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); const payload: Payload = {}; if (typeof roles !== 'undefined') { payload['roles'] = roles; @@ -692,7 +692,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "membershipId"'); } - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -773,7 +773,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "secret"'); } - const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); const payload: Payload = {}; if (typeof userId !== 'undefined') { payload['userId'] = userId; @@ -833,7 +833,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "teamId"'); } - const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', encodeURIComponent(String(teamId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -894,7 +894,7 @@ export class Teams { throw new AppwriteException('Missing required parameter: "prefs"'); } - const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); + const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', encodeURIComponent(String(teamId))); const payload: Payload = {}; if (typeof prefs !== 'undefined') { payload['prefs'] = prefs; diff --git a/src/services/tokens.ts b/src/services/tokens.ts index 18b0fed..f5b9cb0 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -62,7 +62,7 @@ export class Tokens { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -133,7 +133,7 @@ export class Tokens { throw new AppwriteException('Missing required parameter: "fileId"'); } - const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); const payload: Payload = {}; if (typeof expire !== 'undefined') { payload['expire'] = expire; @@ -190,7 +190,7 @@ export class Tokens { throw new AppwriteException('Missing required parameter: "tokenId"'); } - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', encodeURIComponent(String(tokenId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -248,7 +248,7 @@ export class Tokens { throw new AppwriteException('Missing required parameter: "tokenId"'); } - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', encodeURIComponent(String(tokenId))); const payload: Payload = {}; if (typeof expire !== 'undefined') { payload['expire'] = expire; @@ -305,7 +305,7 @@ export class Tokens { throw new AppwriteException('Missing required parameter: "tokenId"'); } - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', encodeURIComponent(String(tokenId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); diff --git a/src/services/usage.ts b/src/services/usage.ts deleted file mode 100644 index f7d485e..0000000 --- a/src/services/usage.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Usage { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - */ - listEvents(params?: { queries?: string[], total?: boolean }): Promise; - /** - * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listEvents(queries?: string[], total?: boolean): Promise; - listEvents( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/usage/events'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, timestamp, resourceType, and resourceId. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - */ - listGauges(params?: { queries?: string[], total?: boolean }): Promise; - /** - * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, timestamp, resourceType, and resourceId. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listGauges(queries?: string[], total?: boolean): Promise; - listGauges( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/usage/gauges'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/users.ts b/src/services/users.ts index 44a107a..6b9985c 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -16,7 +16,7 @@ export class Users { /** * 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.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, accessedAt * @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} @@ -26,7 +26,7 @@ export class Users { /** * 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[]} 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, accessedAt * @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} @@ -441,7 +441,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "identityId"'); } - const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId); + const apiPath = '/users/identities/{identityId}'.replace('{identityId}', encodeURIComponent(String(identityId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1006,7 +1006,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}'.replace('{userId}', userId); + const apiPath = '/users/{userId}'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1059,7 +1059,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}'.replace('{userId}', userId); + const apiPath = '/users/{userId}'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1120,7 +1120,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } - const apiPath = '/users/{userId}/email'.replace('{userId}', userId); + const apiPath = '/users/{userId}/email'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof email !== 'undefined') { payload['email'] = email; @@ -1187,7 +1187,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "impersonator"'); } - const apiPath = '/users/{userId}/impersonator'.replace('{userId}', userId); + const apiPath = '/users/{userId}/impersonator'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof impersonator !== 'undefined') { payload['impersonator'] = impersonator; @@ -1253,7 +1253,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/jwts'.replace('{userId}', userId); + const apiPath = '/users/{userId}/jwts'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof sessionId !== 'undefined') { payload['sessionId'] = sessionId; @@ -1325,7 +1325,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "labels"'); } - const apiPath = '/users/{userId}/labels'.replace('{userId}', userId); + const apiPath = '/users/{userId}/labels'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof labels !== 'undefined') { payload['labels'] = labels; @@ -1391,7 +1391,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/logs'.replace('{userId}', userId); + const apiPath = '/users/{userId}/logs'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1463,7 +1463,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId); + const apiPath = '/users/{userId}/memberships'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1534,7 +1534,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "mfa"'); } - const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof mfa !== 'undefined') { payload['mfa'] = mfa; @@ -1599,7 +1599,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "mfa"'); } - const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof mfa !== 'undefined') { payload['mfa'] = mfa; @@ -1665,7 +1665,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); + const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1726,7 +1726,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); + const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{type}', encodeURIComponent(String(type))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1780,7 +1780,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1833,7 +1833,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1887,7 +1887,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1940,7 +1940,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1994,7 +1994,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2048,7 +2048,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2103,7 +2103,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2157,7 +2157,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2219,7 +2219,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/users/{userId}/name'.replace('{userId}', userId); + const apiPath = '/users/{userId}/name'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -2284,7 +2284,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "password"'); } - const apiPath = '/users/{userId}/password'.replace('{userId}', userId); + const apiPath = '/users/{userId}/password'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof password !== 'undefined') { payload['password'] = password; @@ -2349,7 +2349,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "number"'); } - const apiPath = '/users/{userId}/phone'.replace('{userId}', userId); + const apiPath = '/users/{userId}/phone'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof number !== 'undefined') { payload['number'] = number; @@ -2406,7 +2406,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); + const apiPath = '/users/{userId}/prefs'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2467,7 +2467,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "prefs"'); } - const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); + const apiPath = '/users/{userId}/prefs'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof prefs !== 'undefined') { payload['prefs'] = prefs; @@ -2529,7 +2529,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + const apiPath = '/users/{userId}/sessions'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof total !== 'undefined') { payload['total'] = total; @@ -2589,7 +2589,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + const apiPath = '/users/{userId}/sessions'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2643,7 +2643,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + const apiPath = '/users/{userId}/sessions'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2704,7 +2704,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "sessionId"'); } - const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); + const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{sessionId}', encodeURIComponent(String(sessionId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -2765,7 +2765,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "status"'); } - const apiPath = '/users/{userId}/status'.replace('{userId}', userId); + const apiPath = '/users/{userId}/status'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof status !== 'undefined') { payload['status'] = status; @@ -2831,7 +2831,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); + const apiPath = '/users/{userId}/targets'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -2920,7 +2920,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "identifier"'); } - const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); + const apiPath = '/users/{userId}/targets'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof targetId !== 'undefined') { payload['targetId'] = targetId; @@ -2997,7 +2997,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "targetId"'); } - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{targetId}', encodeURIComponent(String(targetId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -3070,7 +3070,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "targetId"'); } - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{targetId}', encodeURIComponent(String(targetId))); const payload: Payload = {}; if (typeof identifier !== 'undefined') { payload['identifier'] = identifier; @@ -3141,7 +3141,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "targetId"'); } - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{targetId}', encodeURIComponent(String(targetId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -3205,7 +3205,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "userId"'); } - const apiPath = '/users/{userId}/tokens'.replace('{userId}', userId); + const apiPath = '/users/{userId}/tokens'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof length !== 'undefined') { payload['length'] = length; @@ -3273,7 +3273,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "emailVerification"'); } - const apiPath = '/users/{userId}/verification'.replace('{userId}', userId); + const apiPath = '/users/{userId}/verification'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof emailVerification !== 'undefined') { payload['emailVerification'] = emailVerification; @@ -3338,7 +3338,7 @@ export class Users { throw new AppwriteException('Missing required parameter: "phoneVerification"'); } - const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId); + const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', encodeURIComponent(String(userId))); const payload: Payload = {}; if (typeof phoneVerification !== 'undefined') { payload['phoneVerification'] = phoneVerification; diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts index cf096f8..71d27f1 100644 --- a/src/services/webhooks.ts +++ b/src/services/webhooks.ts @@ -230,7 +230,7 @@ export class Webhooks { throw new AppwriteException('Missing required parameter: "webhookId"'); } - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', encodeURIComponent(String(webhookId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -321,7 +321,7 @@ export class Webhooks { throw new AppwriteException('Missing required parameter: "events"'); } - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', encodeURIComponent(String(webhookId))); const payload: Payload = {}; if (typeof name !== 'undefined') { payload['name'] = name; @@ -396,7 +396,7 @@ export class Webhooks { throw new AppwriteException('Missing required parameter: "webhookId"'); } - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', encodeURIComponent(String(webhookId))); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -454,7 +454,7 @@ export class Webhooks { throw new AppwriteException('Missing required parameter: "webhookId"'); } - const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', webhookId); + const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', encodeURIComponent(String(webhookId))); const payload: Payload = {}; if (typeof secret !== 'undefined') { payload['secret'] = secret; diff --git a/test/services/account.test.js b/test/services/account.test.js index f13cbde..21537be 100644 --- a/test/services/account.test.js +++ b/test/services/account.test.js @@ -62,7 +62,7 @@ describe('Account', () => { const response = await account.create( '', 'email@example.com', - '', + 'password', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -605,7 +605,7 @@ describe('Account', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await account.updatePassword( - '', + 'password', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -722,7 +722,7 @@ describe('Account', () => { const response = await account.updateRecovery( '', '', - '', + 'password', ); // Remove custom toString method on the objects to allow for clean data comparison. diff --git a/test/services/activities.test.js b/test/services/activities.test.js index e7c258a..2823e41 100644 --- a/test/services/activities.test.js +++ b/test/services/activities.test.js @@ -44,21 +44,7 @@ describe('Activities', () => { 'time': '2020-10-15T06:38:00.000+00:00', 'projectId': '610fc2f985ee0', 'teamId': '610fc2f985ee0', - 'hostname': 'appwrite.io', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States',}; + 'hostname': 'appwrite.io',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await activities.getEvent( diff --git a/test/services/backups.test.js b/test/services/backups.test.js index a5e5599..46f5814 100644 --- a/test/services/backups.test.js +++ b/test/services/backups.test.js @@ -112,6 +112,7 @@ describe('Backups', () => { 'resources': [], 'retention': 7, 'schedule': '0 * * * *', + 'type': 'full', 'enabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -138,6 +139,7 @@ describe('Backups', () => { 'resources': [], 'retention': 7, 'schedule': '0 * * * *', + 'type': 'full', 'enabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -161,6 +163,7 @@ describe('Backups', () => { 'resources': [], 'retention': 7, 'schedule': '0 * * * *', + 'type': 'full', 'enabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -200,7 +203,7 @@ describe('Backups', () => { 'migrationId': 'did8jx6ws45jana098ab7', 'services': [], 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; + 'options': '{databases.database[{oldId, newId, newName, newSpecification}]}',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await backups.createRestoration( @@ -241,7 +244,7 @@ describe('Backups', () => { 'migrationId': 'did8jx6ws45jana098ab7', 'services': [], 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; + 'options': '{databases.database[{oldId, newId, newName, newSpecification}]}',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await backups.getRestoration( diff --git a/test/services/health.test.js b/test/services/health.test.js deleted file mode 100644 index 3e306fe..0000000 --- a/test/services/health.test.js +++ /dev/null @@ -1,383 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Health } = require("../../dist/services/health"); - -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); - -describe('Health', () => { - const client = new Client(); - const health = new Health(client); - - - test('test method get()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.get( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getAntivirus()', async () => { - const data = { - 'version': '1.0.0', - 'status': 'online',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getAntivirus( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getAuditsDB()', async () => { - const data = { - 'total': 5, - 'statuses': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getAuditsDB( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getCache()', async () => { - const data = { - 'total': 5, - 'statuses': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getCache( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getCertificate()', async () => { - const data = { - 'name': '/CN=www.google.com', - 'subjectSN': '', - 'issuerOrganisation': '', - 'validFrom': '1704200998', - 'validTo': '1711458597', - 'signatureTypeSN': 'RSA-SHA256',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getCertificate( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getConsolePausing()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getConsolePausing( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getDB()', async () => { - const data = { - 'total': 5, - 'statuses': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getDB( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPubSub()', async () => { - const data = { - 'total': 5, - 'statuses': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getPubSub( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueAudits()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueAudits( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueBuilds()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueBuilds( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueCertificates()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueCertificates( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueDatabases()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueDatabases( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueDeletes()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueDeletes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFailedJobs()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getFailedJobs( - 'v1-database', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueFunctions()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueFunctions( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueLogs()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueLogs( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueMails()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueMails( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueMessaging()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueMessaging( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueMigrations()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueMigrations( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueStatsResources()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueStatsResources( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueUsage()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueUsage( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueWebhooks()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueWebhooks( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getStorage()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getStorage( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getStorageLocal()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getStorageLocal( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getTime()', async () => { - const data = { - 'remoteTime': 1639490751, - 'localTime': 1639490844, - 'diff': 93,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getTime( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/messaging.test.js b/test/services/messaging.test.js index 1a08800..007688e 100644 --- a/test/services/messaging.test.js +++ b/test/services/messaging.test.js @@ -259,22 +259,6 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method listMessageLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listMessageLogs( - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - test('test method listTargets()', async () => { const data = { 'total': 5, @@ -1019,38 +1003,6 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method listProviderLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listProviderLogs( - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listSubscriberLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listSubscriberLogs( - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - test('test method listTopics()', async () => { const data = { 'total': 5, @@ -1147,22 +1099,6 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method listTopicLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listTopicLogs( - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - test('test method listSubscribers()', async () => { const data = { 'total': 5, diff --git a/test/services/organization.test.js b/test/services/organization.test.js index a2a6a29..69a6ea4 100644 --- a/test/services/organization.test.js +++ b/test/services/organization.test.js @@ -10,6 +10,114 @@ describe('Organization', () => { const organization = new Organization(client); + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {}, + 'billingBudget': 50, + 'budgetAlerts': [], + 'billingPlan': 'tier-1', + 'billingPlanId': 'tier-1', + 'billingPlanDetails': {}, + 'billingEmail': 'billing@org.example', + 'billingStartDate': '2020-10-15T06:38:00.000+00:00', + 'billingCurrentInvoiceDate': '2020-10-15T06:38:00.000+00:00', + 'billingNextInvoiceDate': '2020-10-15T06:38:00.000+00:00', + 'billingTrialStartDate': '2020-10-15T06:38:00.000+00:00', + 'billingTrialDays': 14, + 'billingAggregationId': 'adbc3de4rddfsd', + 'billingInvoiceId': 'adbc3de4rddfsd', + 'paymentMethodId': 'adbc3de4rddfsd', + 'billingAddressId': 'adbc3de4rddfsd', + 'backupPaymentMethodId': 'adbc3de4rddfsd', + 'status': 'active', + 'remarks': 'Pending initial payment', + 'agreementBAA': '', + 'programManagerName': '', + 'programManagerCalendar': '', + 'programDiscordChannelName': '', + 'programDiscordChannelUrl': '', + 'billingPlanDowngrade': 'tier-1', + 'billingTaxId': '', + 'markedForDeletion': true, + 'platform': 'imagine', + 'projects': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.get( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {}, + 'billingBudget': 50, + 'budgetAlerts': [], + 'billingPlan': 'tier-1', + 'billingPlanId': 'tier-1', + 'billingPlanDetails': {}, + 'billingEmail': 'billing@org.example', + 'billingStartDate': '2020-10-15T06:38:00.000+00:00', + 'billingCurrentInvoiceDate': '2020-10-15T06:38:00.000+00:00', + 'billingNextInvoiceDate': '2020-10-15T06:38:00.000+00:00', + 'billingTrialStartDate': '2020-10-15T06:38:00.000+00:00', + 'billingTrialDays': 14, + 'billingAggregationId': 'adbc3de4rddfsd', + 'billingInvoiceId': 'adbc3de4rddfsd', + 'paymentMethodId': 'adbc3de4rddfsd', + 'billingAddressId': 'adbc3de4rddfsd', + 'backupPaymentMethodId': 'adbc3de4rddfsd', + 'status': 'active', + 'remarks': 'Pending initial payment', + 'agreementBAA': '', + 'programManagerName': '', + 'programManagerCalendar': '', + 'programDiscordChannelName': '', + 'programDiscordChannelUrl': '', + 'billingPlanDowngrade': 'tier-1', + 'billingTaxId': '', + 'markedForDeletion': true, + 'platform': 'imagine', + 'projects': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.update( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.delete( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listKeys()', async () => { const data = { 'total': 5, @@ -112,6 +220,123 @@ describe('Organization', () => { expect(response).toEqual(data); }); + test('test method listMemberships()', async () => { + const data = { + 'total': 5, + 'memberships': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.listMemberships( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMembership()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'roles': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.createMembership( + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMembership()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'roles': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.getMembership( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMembership()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'roles': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.updateMembership( + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMembership()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.deleteMembership( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listProjects()', async () => { const data = { 'total': 5, @@ -144,31 +369,18 @@ describe('Organization', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await organization.createProject( @@ -199,31 +411,18 @@ describe('Organization', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await organization.getProject( @@ -253,31 +452,18 @@ describe('Organization', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await organization.updateProject( diff --git a/test/services/project.test.js b/test/services/project.test.js index d644e0d..48aaf8e 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -27,31 +27,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.get( @@ -93,31 +80,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateAuthMethod( @@ -274,31 +248,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateLabels( @@ -428,31 +389,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Server( @@ -502,6 +450,23 @@ describe('Project', () => { expect(response).toEqual(data); }); + test('test method updateOAuth2Appwrite()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6a42000000000000b5a0', + 'clientSecret': 'b86afd000000000000000000000000000000000000000000000000000ced5f93',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Appwrite( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateOAuth2Auth0()', async () => { const data = { '\$id': 'github', @@ -893,7 +858,8 @@ describe('Project', () => { 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', 'authorizationURL': 'https://myoauth.com/oauth2/authorize', 'tokenURL': 'https://myoauth.com/oauth2/token', - 'userInfoURL': 'https://myoauth.com/oauth2/userinfo',}; + 'userInfoURL': 'https://myoauth.com/oauth2/userinfo', + 'prompt': [],}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Oidc( @@ -1516,31 +1482,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateDenyAliasedEmailPolicy( @@ -1553,6 +1506,47 @@ describe('Project', () => { expect(response).toEqual(data); }); + test('test method updateDenyCorporateEmailPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'region': 'fra', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': 'smtp-password', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'onboarding': {}, + 'authMethods': [], + 'services': [], + 'protocols': [], + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateDenyCorporateEmailPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateDenyDisposableEmailPolicy()', async () => { const data = { '\$id': '5e5ea5c16897e', @@ -1570,31 +1564,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateDenyDisposableEmailPolicy( @@ -1624,31 +1605,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateDenyFreeEmailPolicy( @@ -1678,31 +1646,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateMembershipPrivacyPolicy( @@ -1731,31 +1686,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updatePasswordDictionaryPolicy( @@ -1785,31 +1727,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updatePasswordHistoryPolicy( @@ -1839,31 +1768,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updatePasswordPersonalDataPolicy( @@ -1912,31 +1828,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionAlertPolicy( @@ -1966,31 +1869,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionDurationPolicy( @@ -2020,31 +1910,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionInvalidationPolicy( @@ -2074,31 +1951,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionLimitPolicy( @@ -2128,31 +1992,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateUserLimitPolicy( @@ -2198,31 +2049,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateProtocol( @@ -2253,31 +2091,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateService( @@ -2308,31 +2133,18 @@ describe('Project', () => { 'smtpHost': 'mail.appwrite.io', 'smtpPort': 25, 'smtpUsername': 'emailuser', - 'smtpPassword': '', + 'smtpPassword': 'smtp-password', 'smtpSecure': 'tls', 'pingCount': 1, 'pingedAt': '2020-10-15T06:38:00.000+00:00', 'labels': [], 'status': 'active', + 'onboarding': {}, 'authMethods': [], 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'oAuth2ServerEnabled': true, - 'oAuth2ServerAuthorizationUrl': 'https://cloud.appwrite.io/oauth2/.well-known/openid-configuration', - 'oAuth2ServerScopes': [], - 'oAuth2ServerAuthorizationDetailsTypes': [], - 'oAuth2ServerAccessTokenDuration': 3600, - 'oAuth2ServerRefreshTokenDuration': 86400, - 'oAuth2ServerPublicAccessTokenDuration': 3600, - 'oAuth2ServerPublicRefreshTokenDuration': 2592000, - 'oAuth2ServerConfidentialPkce': true, - 'oAuth2ServerVerificationUrl': 'https://cloud.appwrite.io/device', - 'oAuth2ServerUserCodeLength': 8, - 'oAuth2ServerUserCodeFormat': 'alphanumeric', - 'oAuth2ServerDeviceCodeDuration': 600, - 'oAuth2ServerDiscoveryUrl': 'https://auth.example.com/.well-known/openid-configuration',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSMTP( diff --git a/test/services/usage.test.js b/test/services/usage.test.js deleted file mode 100644 index 44efb8e..0000000 --- a/test/services/usage.test.js +++ /dev/null @@ -1,42 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Usage } = require("../../dist/services/usage"); - -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); - -describe('Usage', () => { - const client = new Client(); - const usage = new Usage(client); - - - test('test method listEvents()', async () => { - const data = { - 'total': 5, - 'events': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await usage.listEvents( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listGauges()', async () => { - const data = { - 'total': 5, - 'gauges': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await usage.listGauges( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/users.test.js b/test/services/users.test.js index 7513e57..f9ea2b1 100644 --- a/test/services/users.test.js +++ b/test/services/users.test.js @@ -771,7 +771,7 @@ describe('Users', () => { const response = await users.updatePassword( '', - '', + 'password', ); // Remove custom toString method on the objects to allow for clean data comparison. diff --git a/test/services/webhooks.test.js b/test/services/webhooks.test.js index 7fb1338..46382da 100644 --- a/test/services/webhooks.test.js +++ b/test/services/webhooks.test.js @@ -35,7 +35,7 @@ describe('Webhooks', () => { 'events': [], 'tls': true, 'authUsername': 'username', - 'authPassword': 'password', + 'authPassword': 'webhook-password', 'secret': 'ad3d581ca230e2b7059c545e5a', 'enabled': true, 'logs': 'Failed to connect to remote server.', @@ -65,7 +65,7 @@ describe('Webhooks', () => { 'events': [], 'tls': true, 'authUsername': 'username', - 'authPassword': 'password', + 'authPassword': 'webhook-password', 'secret': 'ad3d581ca230e2b7059c545e5a', 'enabled': true, 'logs': 'Failed to connect to remote server.', @@ -92,7 +92,7 @@ describe('Webhooks', () => { 'events': [], 'tls': true, 'authUsername': 'username', - 'authPassword': 'password', + 'authPassword': 'webhook-password', 'secret': 'ad3d581ca230e2b7059c545e5a', 'enabled': true, 'logs': 'Failed to connect to remote server.', @@ -136,7 +136,7 @@ describe('Webhooks', () => { 'events': [], 'tls': true, 'authUsername': 'username', - 'authPassword': 'password', + 'authPassword': 'webhook-password', 'secret': 'ad3d581ca230e2b7059c545e5a', 'enabled': true, 'logs': 'Failed to connect to remote server.', From c2a4f04053ac013fcfae4e12b73b7b4c8d1df147 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 13 Jul 2026 12:10:38 +0530 Subject: [PATCH 03/11] chore: update Node.js SDK to 27.0.0 --- src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index 4fb7ac6..960612e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -256,7 +256,7 @@ class Client { * @return {this} */ setBearer(value: string): this { - this.headers['Authorization'] = value; + this.headers['Authorization'] = `Bearer ${value}`; this.config.bearer = value; return this; } From 5b3431bdeac005883f5fc655a3006641aa4b729a Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 13 Jul 2026 13:17:33 +0530 Subject: [PATCH 04/11] (fix): remove duplicate Project model properties from merge --- src/models.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/models.ts b/src/models.ts index 448a4e3..5e56cfa 100644 --- a/src/models.ts +++ b/src/models.ts @@ -4335,10 +4335,6 @@ export namespace Models { * OAuth2 server accepted RFC 9396 authorization_details types */ oAuth2ServerAuthorizationDetailsTypes?: string[]; - /** - * OAuth2 server accepted RFC 9396 authorization_details types - */ - oAuth2ServerAuthorizationDetailsTypes: string[]; /** * OAuth2 server access token duration in seconds for confidential clients */ @@ -4375,22 +4371,6 @@ export namespace Models { * Lifetime in seconds of device flow device codes and user codes. */ oAuth2ServerDeviceCodeDuration?: number; - /** - * URL to your application page where users enter the device flow user code. Empty when the Device Authorization Grant is not configured. - */ - oAuth2ServerVerificationUrl: string; - /** - * Number of characters in the device flow user code, excluding the formatting separator. - */ - oAuth2ServerUserCodeLength: number; - /** - * Character set for device flow user codes: `numeric`, `alphabetic`, or `alphanumeric`. - */ - oAuth2ServerUserCodeFormat: string; - /** - * Lifetime in seconds of device flow device codes and user codes. - */ - oAuth2ServerDeviceCodeDuration: number; /** * OAuth2 server discovery URL */ From 25c3ae5ca15d935d826f87189e8e14c27f1c03a9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 23 Jul 2026 16:17:06 +0530 Subject: [PATCH 05/11] chore: update Node.js SDK to 27.1.0 --- CHANGELOG.md | 10 + docs/examples/account/delete-consent-token.md | 15 + docs/examples/account/delete-consent.md | 14 + docs/examples/account/get-consent-token.md | 15 + docs/examples/account/get-consent.md | 14 + docs/examples/account/list-consent-tokens.md | 16 + docs/examples/account/list-consents.md | 15 + .../apps/create-installation-token.md | 15 + docs/examples/apps/create-key.md | 14 + docs/examples/apps/create-secret.md | 14 + docs/examples/apps/create.md | 32 + docs/examples/apps/delete-key.md | 15 + docs/examples/apps/delete-secret.md | 15 + docs/examples/apps/delete-tokens.md | 14 + docs/examples/apps/delete.md | 14 + docs/examples/apps/get-installation.md | 15 + docs/examples/apps/get-key.md | 15 + docs/examples/apps/get-secret.md | 15 + docs/examples/apps/get.md | 14 + .../examples/apps/list-installation-scopes.md | 12 + docs/examples/apps/list-installations.md | 16 + docs/examples/apps/list-keys.md | 16 + docs/examples/apps/list-o-auth-2-scopes.md | 12 + docs/examples/apps/list-secrets.md | 16 + docs/examples/apps/list.md | 15 + docs/examples/apps/update-labels.md | 15 + docs/examples/apps/update-team.md | 15 + docs/examples/apps/update.md | 33 + docs/examples/backups/create-restoration.md | 3 +- docs/examples/oauth2/approve.md | 16 + docs/examples/oauth2/authorize-post.md | 27 + docs/examples/oauth2/authorize.md | 27 + .../oauth2/create-device-authorization.md | 18 + docs/examples/oauth2/create-grant.md | 14 + docs/examples/oauth2/create-par.md | 26 + docs/examples/oauth2/create-token.md | 23 + docs/examples/oauth2/get-grant.md | 14 + docs/examples/oauth2/list-organizations.md | 16 + docs/examples/oauth2/list-projects.md | 16 + docs/examples/oauth2/reject.md | 14 + docs/examples/oauth2/revoke.md | 17 + .../organization/create-installation.md | 15 + .../organization/delete-installation.md | 14 + .../examples/organization/get-installation.md | 14 + .../organization/list-installations.md | 15 + .../organization/update-installation.md | 15 + .../project/update-o-auth-2-server.md | 1 + .../examples/sites/get-deployment-download.md | 3 +- docs/examples/tablesdb/create-failover.md | 15 + docs/examples/tablesdb/create.md | 3 +- docs/examples/tablesdb/get-replicas.md | 14 + docs/examples/tablesdb/get-status.md | 14 + docs/examples/tablesdb/list-specifications.md | 12 + docs/examples/tablesdb/update.md | 3 +- docs/examples/teams/create-installation.md | 16 + docs/examples/teams/delete-installation.md | 15 + docs/examples/teams/get-installation.md | 15 + docs/examples/teams/list-installations.md | 16 + docs/examples/teams/update-installation.md | 16 + package-lock.json | 4 +- package.json | 2 +- src/client.ts | 4 +- src/enums/database-status.ts | 11 + src/enums/database-type.ts | 3 + src/enums/organization-key-scopes.ts | 2 + src/enums/project-key-scopes.ts | 3 + src/index.ts | 2 + src/models.ts | 1314 ++++++++++++++- src/services/account.ts | 359 ++++ src/services/apps.ts | 1476 +++++++++++++++++ src/services/backups.ts | 41 +- src/services/oauth-2.ts | 1097 ++++++++++++ src/services/organization.ts | 295 ++++ src/services/project.ts | 31 +- src/services/sites.ts | 21 +- src/services/tables-db.ts | 235 ++- src/services/teams.ts | 332 ++++ test/services/account.test.js | 110 ++ test/services/activities.test.js | 13 +- test/services/apps.test.js | 502 ++++++ test/services/backups.test.js | 4 +- test/services/databases.test.js | 12 +- test/services/oauth2.test.js | 224 +++ test/services/organization.test.js | 107 +- test/services/project.test.js | 60 +- test/services/tables-d-b.test.js | 128 +- test/services/teams.test.js | 103 ++ 87 files changed, 7229 insertions(+), 154 deletions(-) create mode 100644 docs/examples/account/delete-consent-token.md create mode 100644 docs/examples/account/delete-consent.md create mode 100644 docs/examples/account/get-consent-token.md create mode 100644 docs/examples/account/get-consent.md create mode 100644 docs/examples/account/list-consent-tokens.md create mode 100644 docs/examples/account/list-consents.md create mode 100644 docs/examples/apps/create-installation-token.md create mode 100644 docs/examples/apps/create-key.md create mode 100644 docs/examples/apps/create-secret.md create mode 100644 docs/examples/apps/create.md create mode 100644 docs/examples/apps/delete-key.md create mode 100644 docs/examples/apps/delete-secret.md create mode 100644 docs/examples/apps/delete-tokens.md create mode 100644 docs/examples/apps/delete.md create mode 100644 docs/examples/apps/get-installation.md create mode 100644 docs/examples/apps/get-key.md create mode 100644 docs/examples/apps/get-secret.md create mode 100644 docs/examples/apps/get.md create mode 100644 docs/examples/apps/list-installation-scopes.md create mode 100644 docs/examples/apps/list-installations.md create mode 100644 docs/examples/apps/list-keys.md create mode 100644 docs/examples/apps/list-o-auth-2-scopes.md create mode 100644 docs/examples/apps/list-secrets.md create mode 100644 docs/examples/apps/list.md create mode 100644 docs/examples/apps/update-labels.md create mode 100644 docs/examples/apps/update-team.md create mode 100644 docs/examples/apps/update.md create mode 100644 docs/examples/oauth2/approve.md create mode 100644 docs/examples/oauth2/authorize-post.md create mode 100644 docs/examples/oauth2/authorize.md create mode 100644 docs/examples/oauth2/create-device-authorization.md create mode 100644 docs/examples/oauth2/create-grant.md create mode 100644 docs/examples/oauth2/create-par.md create mode 100644 docs/examples/oauth2/create-token.md create mode 100644 docs/examples/oauth2/get-grant.md create mode 100644 docs/examples/oauth2/list-organizations.md create mode 100644 docs/examples/oauth2/list-projects.md create mode 100644 docs/examples/oauth2/reject.md create mode 100644 docs/examples/oauth2/revoke.md create mode 100644 docs/examples/organization/create-installation.md create mode 100644 docs/examples/organization/delete-installation.md create mode 100644 docs/examples/organization/get-installation.md create mode 100644 docs/examples/organization/list-installations.md create mode 100644 docs/examples/organization/update-installation.md create mode 100644 docs/examples/tablesdb/create-failover.md create mode 100644 docs/examples/tablesdb/get-replicas.md create mode 100644 docs/examples/tablesdb/get-status.md create mode 100644 docs/examples/tablesdb/list-specifications.md create mode 100644 docs/examples/teams/create-installation.md create mode 100644 docs/examples/teams/delete-installation.md create mode 100644 docs/examples/teams/get-installation.md create mode 100644 docs/examples/teams/list-installations.md create mode 100644 docs/examples/teams/update-installation.md create mode 100644 src/services/apps.ts create mode 100644 src/services/oauth-2.ts create mode 100644 test/services/apps.test.js create mode 100644 test/services/oauth2.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b9de72..fc35853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 27.1.0 + +* Added: `Apps` service for managing OAuth2 applications, keys, and installations +* Added: `OAuth2` service with authorize, grant, device authorization, and consent flows +* Added: account OAuth2 consent methods `listConsents`, `getConsent`, `deleteConsent`, and consent token methods +* Added: app installation management methods to `Organization` and `Teams` services +* Added: `installationAccessTokenDuration` parameter to `project.updateOAuth2Server` +* Added: `token` parameter to `sites.getDeploymentDownload` +* Added: `oauth2.introspect` and organization installation key scopes + ## 27.0.0 * Breaking: removed `Health` service, health enums, and health response models diff --git a/docs/examples/account/delete-consent-token.md b/docs/examples/account/delete-consent-token.md new file mode 100644 index 0000000..3b45b09 --- /dev/null +++ b/docs/examples/account/delete-consent-token.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteConsentToken({ + consentId: '', + tokenId: '' +}); +``` diff --git a/docs/examples/account/delete-consent.md b/docs/examples/account/delete-consent.md new file mode 100644 index 0000000..eb93aba --- /dev/null +++ b/docs/examples/account/delete-consent.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteConsent({ + consentId: '' +}); +``` diff --git a/docs/examples/account/get-consent-token.md b/docs/examples/account/get-consent-token.md new file mode 100644 index 0000000..3ae6c1e --- /dev/null +++ b/docs/examples/account/get-consent-token.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getConsentToken({ + consentId: '', + tokenId: '' +}); +``` diff --git a/docs/examples/account/get-consent.md b/docs/examples/account/get-consent.md new file mode 100644 index 0000000..fc7cb6c --- /dev/null +++ b/docs/examples/account/get-consent.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getConsent({ + consentId: '' +}); +``` diff --git a/docs/examples/account/list-consent-tokens.md b/docs/examples/account/list-consent-tokens.md new file mode 100644 index 0000000..d271066 --- /dev/null +++ b/docs/examples/account/list-consent-tokens.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listConsentTokens({ + consentId: '', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/account/list-consents.md b/docs/examples/account/list-consents.md new file mode 100644 index 0000000..12ec54e --- /dev/null +++ b/docs/examples/account/list-consents.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listConsents({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/apps/create-installation-token.md b/docs/examples/apps/create-installation-token.md new file mode 100644 index 0000000..f60d495 --- /dev/null +++ b/docs/examples/apps/create-installation-token.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const apps = new sdk.Apps(client); + +const result = await apps.createInstallationToken({ + appId: '', + installationId: '' +}); +``` diff --git a/docs/examples/apps/create-key.md b/docs/examples/apps/create-key.md new file mode 100644 index 0000000..0b35816 --- /dev/null +++ b/docs/examples/apps/create-key.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.createKey({ + appId: '' +}); +``` diff --git a/docs/examples/apps/create-secret.md b/docs/examples/apps/create-secret.md new file mode 100644 index 0000000..1f85104 --- /dev/null +++ b/docs/examples/apps/create-secret.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.createSecret({ + appId: '' +}); +``` diff --git a/docs/examples/apps/create.md b/docs/examples/apps/create.md new file mode 100644 index 0000000..80339c5 --- /dev/null +++ b/docs/examples/apps/create.md @@ -0,0 +1,32 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.create({ + appId: '', + name: '', + redirectUris: [], + description: '', // optional + clientUri: 'https://example.com', // optional + logoUri: 'https://example.com', // optional + privacyPolicyUrl: 'https://example.com', // optional + termsUrl: 'https://example.com', // optional + contacts: [], // optional + tagline: '', // optional + tags: [], // optional + images: [], // optional + supportUrl: 'https://example.com', // optional + dataDeletionUrl: 'https://example.com', // optional + postLogoutRedirectUris: [], // optional + enabled: false, // optional + type: 'public', // optional + deviceFlow: false, // optional + teamId: '' // optional +}); +``` diff --git a/docs/examples/apps/delete-key.md b/docs/examples/apps/delete-key.md new file mode 100644 index 0000000..f4f0bb5 --- /dev/null +++ b/docs/examples/apps/delete-key.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.deleteKey({ + appId: '', + keyId: '' +}); +``` diff --git a/docs/examples/apps/delete-secret.md b/docs/examples/apps/delete-secret.md new file mode 100644 index 0000000..eeb1e43 --- /dev/null +++ b/docs/examples/apps/delete-secret.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.deleteSecret({ + appId: '', + secretId: '' +}); +``` diff --git a/docs/examples/apps/delete-tokens.md b/docs/examples/apps/delete-tokens.md new file mode 100644 index 0000000..757af7d --- /dev/null +++ b/docs/examples/apps/delete-tokens.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.deleteTokens({ + appId: '' +}); +``` diff --git a/docs/examples/apps/delete.md b/docs/examples/apps/delete.md new file mode 100644 index 0000000..fd9138c --- /dev/null +++ b/docs/examples/apps/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.delete({ + appId: '' +}); +``` diff --git a/docs/examples/apps/get-installation.md b/docs/examples/apps/get-installation.md new file mode 100644 index 0000000..eb483b2 --- /dev/null +++ b/docs/examples/apps/get-installation.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const apps = new sdk.Apps(client); + +const result = await apps.getInstallation({ + appId: '', + installationId: '' +}); +``` diff --git a/docs/examples/apps/get-key.md b/docs/examples/apps/get-key.md new file mode 100644 index 0000000..afc83cc --- /dev/null +++ b/docs/examples/apps/get-key.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.getKey({ + appId: '', + keyId: '' +}); +``` diff --git a/docs/examples/apps/get-secret.md b/docs/examples/apps/get-secret.md new file mode 100644 index 0000000..4d6a0ec --- /dev/null +++ b/docs/examples/apps/get-secret.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.getSecret({ + appId: '', + secretId: '' +}); +``` diff --git a/docs/examples/apps/get.md b/docs/examples/apps/get.md new file mode 100644 index 0000000..660c4f4 --- /dev/null +++ b/docs/examples/apps/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.get({ + appId: '' +}); +``` diff --git a/docs/examples/apps/list-installation-scopes.md b/docs/examples/apps/list-installation-scopes.md new file mode 100644 index 0000000..299d7b7 --- /dev/null +++ b/docs/examples/apps/list-installation-scopes.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.listInstallationScopes(); +``` diff --git a/docs/examples/apps/list-installations.md b/docs/examples/apps/list-installations.md new file mode 100644 index 0000000..e410f66 --- /dev/null +++ b/docs/examples/apps/list-installations.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const apps = new sdk.Apps(client); + +const result = await apps.listInstallations({ + appId: '', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/apps/list-keys.md b/docs/examples/apps/list-keys.md new file mode 100644 index 0000000..3a2198f --- /dev/null +++ b/docs/examples/apps/list-keys.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.listKeys({ + appId: '', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/apps/list-o-auth-2-scopes.md b/docs/examples/apps/list-o-auth-2-scopes.md new file mode 100644 index 0000000..6f92539 --- /dev/null +++ b/docs/examples/apps/list-o-auth-2-scopes.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.listOAuth2Scopes(); +``` diff --git a/docs/examples/apps/list-secrets.md b/docs/examples/apps/list-secrets.md new file mode 100644 index 0000000..d1155a5 --- /dev/null +++ b/docs/examples/apps/list-secrets.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.listSecrets({ + appId: '', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/apps/list.md b/docs/examples/apps/list.md new file mode 100644 index 0000000..d594293 --- /dev/null +++ b/docs/examples/apps/list.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.list({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/apps/update-labels.md b/docs/examples/apps/update-labels.md new file mode 100644 index 0000000..67a98fc --- /dev/null +++ b/docs/examples/apps/update-labels.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const apps = new sdk.Apps(client); + +const result = await apps.updateLabels({ + appId: '', + labels: [] +}); +``` diff --git a/docs/examples/apps/update-team.md b/docs/examples/apps/update-team.md new file mode 100644 index 0000000..65828dc --- /dev/null +++ b/docs/examples/apps/update-team.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.updateTeam({ + appId: '', + teamId: '' +}); +``` diff --git a/docs/examples/apps/update.md b/docs/examples/apps/update.md new file mode 100644 index 0000000..2ac2e58 --- /dev/null +++ b/docs/examples/apps/update.md @@ -0,0 +1,33 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const apps = new sdk.Apps(client); + +const result = await apps.update({ + appId: '', + name: '', + description: '', // optional + clientUri: 'https://example.com', // optional + logoUri: 'https://example.com', // optional + privacyPolicyUrl: 'https://example.com', // optional + termsUrl: 'https://example.com', // optional + contacts: [], // optional + tagline: '', // optional + tags: [], // optional + images: [], // optional + supportUrl: 'https://example.com', // optional + dataDeletionUrl: 'https://example.com', // optional + enabled: false, // optional + redirectUris: [], // optional + postLogoutRedirectUris: [], // optional + type: 'public', // optional + deviceFlow: false, // optional + installationScopes: [], // optional + installationRedirectUrl: 'https://example.com' // optional +}); +``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index 6a8096a..f41a234 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -12,7 +12,6 @@ const result = await backups.createRestoration({ archiveId: '', services: [sdk.BackupServices.Databases], newResourceId: '', // optional - newResourceName: '', // optional - newSpecification: 'serverless' // optional + newResourceName: '' // optional }); ``` diff --git a/docs/examples/oauth2/approve.md b/docs/examples/oauth2/approve.md new file mode 100644 index 0000000..64f473b --- /dev/null +++ b/docs/examples/oauth2/approve.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.approve({ + grantId: '', + authorizationDetails: '', // optional + scope: '' // optional +}); +``` diff --git a/docs/examples/oauth2/authorize-post.md b/docs/examples/oauth2/authorize-post.md new file mode 100644 index 0000000..9d9317e --- /dev/null +++ b/docs/examples/oauth2/authorize-post.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.authorizePost({ + clientId: '', // optional + redirectUri: 'https://example.com', // optional + responseType: '', // optional + scope: '', // optional + state: '', // optional + nonce: '', // optional + codeChallenge: '', // optional + codeChallengeMethod: 's256', // optional + prompt: '', // optional + maxAge: 0, // optional + authorizationDetails: '', // optional + resource: '', // optional + audience: '', // optional + requestUri: '' // optional +}); +``` diff --git a/docs/examples/oauth2/authorize.md b/docs/examples/oauth2/authorize.md new file mode 100644 index 0000000..10b6f61 --- /dev/null +++ b/docs/examples/oauth2/authorize.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.authorize({ + clientId: '', // optional + redirectUri: 'https://example.com', // optional + responseType: '', // optional + scope: '', // optional + state: '', // optional + nonce: '', // optional + codeChallenge: '', // optional + codeChallengeMethod: 's256', // optional + prompt: '', // optional + maxAge: 0, // optional + authorizationDetails: '', // optional + resource: '', // optional + audience: '', // optional + requestUri: '' // optional +}); +``` diff --git a/docs/examples/oauth2/create-device-authorization.md b/docs/examples/oauth2/create-device-authorization.md new file mode 100644 index 0000000..19710c7 --- /dev/null +++ b/docs/examples/oauth2/create-device-authorization.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.createDeviceAuthorization({ + clientId: '', // optional + scope: '', // optional + authorizationDetails: '', // optional + resource: '', // optional + audience: '' // optional +}); +``` diff --git a/docs/examples/oauth2/create-grant.md b/docs/examples/oauth2/create-grant.md new file mode 100644 index 0000000..0f644ee --- /dev/null +++ b/docs/examples/oauth2/create-grant.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.createGrant({ + userCode: '' +}); +``` diff --git a/docs/examples/oauth2/create-par.md b/docs/examples/oauth2/create-par.md new file mode 100644 index 0000000..70623e9 --- /dev/null +++ b/docs/examples/oauth2/create-par.md @@ -0,0 +1,26 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.createPAR({ + clientId: '', + redirectUri: 'https://example.com', + responseType: 'code', + scope: '', // optional + state: '', // optional + nonce: '', // optional + codeChallenge: '', // optional + codeChallengeMethod: 's256', // optional + prompt: '', // optional + maxAge: 0, // optional + authorizationDetails: '', // optional + resource: '', // optional + audience: '' // optional +}); +``` diff --git a/docs/examples/oauth2/create-token.md b/docs/examples/oauth2/create-token.md new file mode 100644 index 0000000..e27883d --- /dev/null +++ b/docs/examples/oauth2/create-token.md @@ -0,0 +1,23 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.createToken({ + grantType: '', + code: '', // optional + refreshToken: '', // optional + deviceCode: '', // optional + clientId: '', // optional + clientSecret: '', // optional + codeVerifier: '', // optional + redirectUri: 'https://example.com', // optional + resource: '', // optional + audience: '' // optional +}); +``` diff --git a/docs/examples/oauth2/get-grant.md b/docs/examples/oauth2/get-grant.md new file mode 100644 index 0000000..b619812 --- /dev/null +++ b/docs/examples/oauth2/get-grant.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.getGrant({ + grantId: '' +}); +``` diff --git a/docs/examples/oauth2/list-organizations.md b/docs/examples/oauth2/list-organizations.md new file mode 100644 index 0000000..b9503c2 --- /dev/null +++ b/docs/examples/oauth2/list-organizations.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.listOrganizations({ + limit: 1, // optional + offset: 0, // optional + search: '' // optional +}); +``` diff --git a/docs/examples/oauth2/list-projects.md b/docs/examples/oauth2/list-projects.md new file mode 100644 index 0000000..95e89e9 --- /dev/null +++ b/docs/examples/oauth2/list-projects.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.listProjects({ + limit: 1, // optional + offset: 0, // optional + search: '' // optional +}); +``` diff --git a/docs/examples/oauth2/reject.md b/docs/examples/oauth2/reject.md new file mode 100644 index 0000000..5e5a8ff --- /dev/null +++ b/docs/examples/oauth2/reject.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.reject({ + grantId: '' +}); +``` diff --git a/docs/examples/oauth2/revoke.md b/docs/examples/oauth2/revoke.md new file mode 100644 index 0000000..e853410 --- /dev/null +++ b/docs/examples/oauth2/revoke.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setProject(''); // Your project ID + +const oauth2 = new sdk.Oauth2(client); + +const result = await oauth2.revoke({ + token: '', + tokenTypeHint: 'access_token', // optional + clientId: '', // optional + clientSecret: '' // optional +}); +``` diff --git a/docs/examples/organization/create-installation.md b/docs/examples/organization/create-installation.md new file mode 100644 index 0000000..56558fd --- /dev/null +++ b/docs/examples/organization/create-installation.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const organization = new sdk.Organization(client); + +const result = await organization.createInstallation({ + appId: '', + authorizationDetails: '' // optional +}); +``` diff --git a/docs/examples/organization/delete-installation.md b/docs/examples/organization/delete-installation.md new file mode 100644 index 0000000..afc3be5 --- /dev/null +++ b/docs/examples/organization/delete-installation.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const organization = new sdk.Organization(client); + +const result = await organization.deleteInstallation({ + installationId: '' +}); +``` diff --git a/docs/examples/organization/get-installation.md b/docs/examples/organization/get-installation.md new file mode 100644 index 0000000..e5ed10e --- /dev/null +++ b/docs/examples/organization/get-installation.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const organization = new sdk.Organization(client); + +const result = await organization.getInstallation({ + installationId: '' +}); +``` diff --git a/docs/examples/organization/list-installations.md b/docs/examples/organization/list-installations.md new file mode 100644 index 0000000..91f6b66 --- /dev/null +++ b/docs/examples/organization/list-installations.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const organization = new sdk.Organization(client); + +const result = await organization.listInstallations({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/organization/update-installation.md b/docs/examples/organization/update-installation.md new file mode 100644 index 0000000..59ccac7 --- /dev/null +++ b/docs/examples/organization/update-installation.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const organization = new sdk.Organization(client); + +const result = await organization.updateInstallation({ + installationId: '', + authorizationDetails: '' // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index 0cd95ae..a34a5fc 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -17,6 +17,7 @@ const result = await project.updateOAuth2Server({ refreshTokenDuration: 60, // optional publicAccessTokenDuration: 60, // optional publicRefreshTokenDuration: 60, // optional + installationAccessTokenDuration: 60, // optional confidentialPkce: false, // optional verificationUrl: 'https://example.com', // optional userCodeLength: 6, // optional diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index 6e7ee4a..1d62d28 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -11,6 +11,7 @@ const sites = new sdk.Sites(client); const result = await sites.getDeploymentDownload({ siteId: '', deploymentId: '', - type: sdk.DeploymentDownloadType.Source // optional + type: sdk.DeploymentDownloadType.Source, // optional + token: '' // optional }); ``` diff --git a/docs/examples/tablesdb/create-failover.md b/docs/examples/tablesdb/create-failover.md new file mode 100644 index 0000000..0ad6437 --- /dev/null +++ b/docs/examples/tablesdb/create-failover.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createFailover({ + databaseId: '', + targetReplicaId: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 280db02..27bf661 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -12,6 +12,7 @@ const result = await tablesDB.create({ databaseId: '', name: '', enabled: false, // optional - specification: 'serverless' // optional + specification: 'serverless', // optional + replicas: 0 // optional }); ``` diff --git a/docs/examples/tablesdb/get-replicas.md b/docs/examples/tablesdb/get-replicas.md new file mode 100644 index 0000000..ab40296 --- /dev/null +++ b/docs/examples/tablesdb/get-replicas.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getReplicas({ + databaseId: '' +}); +``` diff --git a/docs/examples/tablesdb/get-status.md b/docs/examples/tablesdb/get-status.md new file mode 100644 index 0000000..3b85821 --- /dev/null +++ b/docs/examples/tablesdb/get-status.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getStatus({ + databaseId: '' +}); +``` diff --git a/docs/examples/tablesdb/list-specifications.md b/docs/examples/tablesdb/list-specifications.md new file mode 100644 index 0000000..c5e11ea --- /dev/null +++ b/docs/examples/tablesdb/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listSpecifications(); +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 7cbf6f5..034eb94 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -11,6 +11,7 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.update({ databaseId: '', name: '', // optional - enabled: false // optional + enabled: false, // optional + replicas: 0 // optional }); ``` diff --git a/docs/examples/teams/create-installation.md b/docs/examples/teams/create-installation.md new file mode 100644 index 0000000..e84f9d8 --- /dev/null +++ b/docs/examples/teams/create-installation.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.createInstallation({ + teamId: '', + appId: '', + authorizationDetails: '' // optional +}); +``` diff --git a/docs/examples/teams/delete-installation.md b/docs/examples/teams/delete-installation.md new file mode 100644 index 0000000..d363129 --- /dev/null +++ b/docs/examples/teams/delete-installation.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.deleteInstallation({ + teamId: '', + installationId: '' +}); +``` diff --git a/docs/examples/teams/get-installation.md b/docs/examples/teams/get-installation.md new file mode 100644 index 0000000..47c71f3 --- /dev/null +++ b/docs/examples/teams/get-installation.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.getInstallation({ + teamId: '', + installationId: '' +}); +``` diff --git a/docs/examples/teams/list-installations.md b/docs/examples/teams/list-installations.md new file mode 100644 index 0000000..ecd4c42 --- /dev/null +++ b/docs/examples/teams/list-installations.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.listInstallations({ + teamId: '', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/teams/update-installation.md b/docs/examples/teams/update-installation.md new file mode 100644 index 0000000..f62bdfc --- /dev/null +++ b/docs/examples/teams/update-installation.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updateInstallation({ + teamId: '', + installationId: '', + authorizationDetails: '' // optional +}); +``` diff --git a/package-lock.json b/package-lock.json index 6a10292..5e4de24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "node-appwrite", - "version": "27.0.0", + "version": "27.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "27.0.0", + "version": "27.1.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0", diff --git a/package.json b/package.json index a791cae..898eb6b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "27.0.0", + "version": "27.1.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 960612e..8051af7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -73,7 +73,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/27.0.0'; + let ua = 'AppwriteNodeJSSDK/27.1.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -129,7 +129,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '27.0.0', + 'x-sdk-version': '27.1.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.9.5', }; diff --git a/src/enums/database-status.ts b/src/enums/database-status.ts index 9e9cb51..8a01e3b 100644 --- a/src/enums/database-status.ts +++ b/src/enums/database-status.ts @@ -1,5 +1,16 @@ export enum DatabaseStatus { Provisioning = 'provisioning', Ready = 'ready', + Inactive = 'inactive', + Paused = 'paused', Failed = 'failed', + Deleting = 'deleting', + Deleted = 'deleted', + Restoring = 'restoring', + Scaling = 'scaling', + Upgrading = 'upgrading', + Migrating = 'migrating', + Pausing = 'pausing', + Resuming = 'resuming', + Failingover = 'failing-over', } \ No newline at end of file diff --git a/src/enums/database-type.ts b/src/enums/database-type.ts index 8ccd969..b39f921 100644 --- a/src/enums/database-type.ts +++ b/src/enums/database-type.ts @@ -3,4 +3,7 @@ export enum DatabaseType { Tablesdb = 'tablesdb', Documentsdb = 'documentsdb', Vectorsdb = 'vectorsdb', + Mysql = 'mysql', + Postgresql = 'postgresql', + Mongodb = 'mongodb', } \ No newline at end of file diff --git a/src/enums/organization-key-scopes.ts b/src/enums/organization-key-scopes.ts index a4ff3fb..eb18181 100644 --- a/src/enums/organization-key-scopes.ts +++ b/src/enums/organization-key-scopes.ts @@ -5,6 +5,8 @@ export enum OrganizationKeyScopes { DevKeysWrite = 'devKeys.write', OrganizationKeysRead = 'organization.keys.read', OrganizationKeysWrite = 'organization.keys.write', + OrganizationInstallationsRead = 'organization.installations.read', + OrganizationInstallationsWrite = 'organization.installations.write', OrganizationMembershipsRead = 'organization.memberships.read', OrganizationMembershipsWrite = 'organization.memberships.write', OrganizationRead = 'organization.read', diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts index 7f97ba9..b0ac3cd 100644 --- a/src/enums/project-key-scopes.ts +++ b/src/enums/project-key-scopes.ts @@ -94,10 +94,13 @@ export enum ProjectKeyScopes { DedicatedDatabasesExecute = 'dedicatedDatabases.execute', DomainsRead = 'domains.read', DomainsWrite = 'domains.write', + WafRulesRead = 'wafRules.read', + WafRulesWrite = 'wafRules.write', EventsRead = 'events.read', AppsRead = 'apps.read', AppsWrite = 'apps.write', Oauth2Read = 'oauth2.read', Oauth2Write = 'oauth2.write', + Oauth2Introspect = 'oauth2.introspect', UsageRead = 'usage.read', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index efa797e..0226923 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; export { Activities } from './services/activities'; +export { Apps } from './services/apps'; export { Avatars } from './services/avatars'; export { Backups } from './services/backups'; export { Databases } from './services/databases'; @@ -8,6 +9,7 @@ export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; +export { Oauth2 } from './services/oauth-2'; export { Organization } from './services/organization'; export { Presences } from './services/presences'; export { Project } from './services/project'; diff --git a/src/models.ts b/src/models.ts index 5e56cfa..9100284 100644 --- a/src/models.ts +++ b/src/models.ts @@ -697,17 +697,29 @@ export namespace Models { */ type: DatabaseType; /** - * Database status. Possible values: `provisioning`, `ready` or `failed` + * Dedicated database lifecycle status. Null when the database has no valid dedicated backing. */ status?: DatabaseStatus; + /** + * Underlying engine of the dedicated backing: postgresql, mysql, mariadb, or mongodb. A managed product (tablesdb, documentsdb, vectorsdb) reports the engine it runs on, so its type and engine can differ. Null when the database has no dedicated backing. + */ + engine?: string; + /** + * Compute specification identifier of the dedicated backing, e.g. s-2vcpu-2gb. Null when the database has no dedicated backing. + */ + specification?: string; + /** + * Number of secondary high availability replicas, excluding the primary. Null when backing configuration is unavailable. + */ + replicas?: number; /** * Database backup policies. */ - policies: BackupPolicy[]; + policies?: BackupPolicy[]; /** * Database backup archives. */ - archives: BackupArchive[]; + archives?: BackupArchive[]; } /** @@ -4311,6 +4323,10 @@ export namespace Models { * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. */ consoleAccessedAt: string; + /** + * Whether WAF enforcement is enabled for the project. + */ + wafEnabled: boolean; /** * Billing limits reached */ @@ -4351,6 +4367,10 @@ export namespace Models { * OAuth2 server refresh token duration in seconds for public clients (SPAs, mobile, native) */ oAuth2ServerPublicRefreshTokenDuration?: number; + /** + * OAuth2 server access token duration in seconds for app installation access tokens + */ + oAuth2ServerInstallationAccessTokenDuration?: number; /** * When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. */ @@ -6755,6 +6775,42 @@ export namespace Models { * Location. */ country: string; + /** + * Continent code. + */ + continentCode: string; + /** + * City name. + */ + city: string; + /** + * Region/state chain. + */ + subdivisions: string; + /** + * Internet service provider. + */ + isp: string; + /** + * Autonomous System Number (ASN). + */ + autonomousSystemNumber: string; + /** + * Organization that owns the ASN. + */ + autonomousSystemOrganization: string; + /** + * Connection type (e.g. cable, cellular, corporate). + */ + connectionType: string; + /** + * User type (e.g. residential, business, hosting). + */ + connectionUsageType: string; + /** + * Registered organization of the IP. + */ + connectionOrganization: string; /** * Log creation date in ISO 8601 format. */ @@ -6771,6 +6827,14 @@ export namespace Models { * Hostname. */ hostname: string; + /** + * Name of the SDK that triggered the event. + */ + sdk: string; + /** + * Version of the SDK that triggered the event. + */ + sdkVersion: string; } /** @@ -6947,6 +7011,10 @@ export namespace Models { * Webhooks */ webhooks: number; + /** + * Maximum WAF rules per project + */ + wafRules: number; /** * Projects */ @@ -7389,6 +7457,286 @@ export namespace Models { billingPlan: string; } + /** + * DedicatedDatabase + */ + export type DedicatedDatabase = { + /** + * Dedicated database ID. + */ + $id: string; + /** + * Database creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Database update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Project ID that owns this database. + */ + projectId: string; + /** + * Database display name. + */ + name: string; + /** + * Product API that owns this database: tablesdb, documentsdb, vectorsdb, mysql, postgresql, or mongodb. + */ + api: string; + /** + * Database engine: postgresql, mysql, mariadb, or mongodb. + */ + engine: string; + /** + * Database engine version. + */ + version: string; + /** + * Specification identifier. + */ + specification: string; + /** + * Database backend provider. Possible values: prisma, edge. + */ + backend: string; + /** + * Database hostname for connections. + */ + hostname: string; + /** + * Database port for connections. + */ + connectionPort: number; + /** + * Database username for connections. + */ + connectionUser: string; + /** + * Database password for connections. + */ + connectionPassword: string; + /** + * Full database connection string (URI format). + */ + connectionString: string; + /** + * Whether SSL/TLS is required for client connections. + */ + ssl: boolean; + /** + * Database status. Possible values: provisioning, ready, inactive, paused, failed, deleted, restoring, scaling. + */ + status: string; + /** + * Container status for lifecycle-managed database runtimes: active or inactive. + */ + containerStatus: string; + /** + * Last activity timestamp in ISO 8601 format. + */ + lastAccessedAt?: string; + /** + * Display-only timestamp when the database is expected to be considered idle (ISO 8601 format). Derived from last activity; lifecycle transitions are driven by lifecycleState. + */ + idleUntil?: string; + /** + * Idle-lifecycle state of the database. Possible values: active, warm, cold, hibernated. + */ + lifecycleState: string; + /** + * Minutes of inactivity before container scales to zero. + */ + idleTimeoutMinutes: number; + /** + * CPU allocated in millicores. + */ + cpu: number; + /** + * Memory allocated in MB. + */ + memory: number; + /** + * Storage allocated in GB. + */ + storage: number; + /** + * Storage class. Currently always 'ssd'; DigitalOcean exposes a single block-storage class. + */ + storageClass: string; + /** + * Maximum storage allowed in GB. 0 means use system default. + */ + storageMaxGb: number; + /** + * Kubernetes node pool where the database is scheduled. + */ + nodePool: string; + /** + * Number of high availability replicas. High availability is enabled when greater than 0. + */ + replicas: number; + /** + * Replication sync mode: async, sync, or quorum. + */ + syncMode: string; + /** + * Number of cross-region replicas. Cross-region availability is enabled when greater than 0. + */ + crossRegionReplicas: number; + /** + * Maximum concurrent connections. + */ + networkMaxConnections: number; + /** + * Connection idle timeout in seconds. + */ + networkIdleTimeoutSeconds: number; + /** + * IP addresses/CIDR ranges allowed to connect. + */ + networkIPAllowlist: string[]; + /** + * Whether automatic backups are enabled. + */ + backupEnabled: boolean; + /** + * Whether point-in-time recovery is enabled. + */ + pitr: boolean; + /** + * Number of days to retain PITR data. + */ + pitrRetentionDays: number; + /** + * Whether automatic storage expansion is enabled. + */ + storageAutoscaling: boolean; + /** + * Storage usage percentage that triggers automatic expansion. + */ + storageAutoscalingThresholdPercent: number; + /** + * Maximum storage size in GB for autoscaling. 0 means no limit. + */ + storageAutoscalingMaxGb: number; + /** + * Day of the week for the maintenance window. Possible values: sun, mon, tue, wed, thu, fri, sat. + */ + maintenanceWindowDay: string; + /** + * Hour in UTC (0-23) when the maintenance window starts. + */ + maintenanceWindowHourUtc: number; + /** + * Whether metrics collection is enabled. + */ + metricsEnabled: boolean; + /** + * Whether the SQL API sidecar is enabled for this database. + */ + sqlApiEnabled: boolean; + /** + * Statement types accepted by the SQL API. Defaults to read/write DML only; DDL/DCL types (CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE) are opt-in per database. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + */ + sqlApiAllowedStatements: string[]; + /** + * Maximum rows returned per SQL API execution. Results larger than this are truncated. + */ + sqlApiMaxRows: number; + /** + * Maximum serialised SQL API result payload in bytes. Results larger than this are truncated. + */ + sqlApiMaxBytes: number; + /** + * Maximum server-side SQL API execution time in seconds before the query is cancelled. + */ + sqlApiTimeoutSeconds: number; + /** + * Error message if status is failed. + */ + error: string; + } + + /** + * Status + */ + export type DatabaseStatus = { + /** + * Overall health status: healthy, degraded, or unhealthy. + */ + health: string; + /** + * Whether the database is ready to accept connections. + */ + ready: boolean; + /** + * Database engine: postgresql, mysql, mariadb, or mongodb. + */ + engine: string; + /** + * Database engine version. + */ + version: string; + /** + * Database uptime in seconds. + */ + uptime: number; + /** + * Connection statistics. + */ + connections: DatabaseStatusConnections; + /** + * List of database replicas and their status. + */ + replicas: DatabaseStatusReplica[]; + /** + * Storage volume information. + */ + volumes: DatabaseStatusVolume[]; + } + + /** + * Member + */ + export type DedicatedDatabaseMember = { + /** + * Member identifier. + */ + $id: string; + /** + * Member role. Possible values: primary (accepts reads and writes), replica (read-only follower). + */ + role: string; + /** + * Member pod status. Possible values: provisioning (pod missing or Pending), starting (Running but not Ready), active (Running and Ready), failed (Failed phase or CrashLoopBackOff container), or the lowercased pod phase reported by the cluster. + */ + status: string; + /** + * Replication lag in seconds. + */ + lagSeconds: number; + } + + /** + * Replicas + */ + export type DedicatedDatabaseReplicas = { + /** + * Number of configured replicas. Zero means high availability is disabled. + */ + replicas: number; + /** + * Replication sync mode. Possible values: async (asynchronous, fastest), sync (synchronous, strong consistency), quorum (quorum-based, majority of replicas must confirm). + */ + syncMode: string; + /** + * Per-pod statuses for the primary and every replica. + */ + members: DedicatedDatabaseMember[]; + } + /** * Organization */ @@ -7738,99 +8086,897 @@ export namespace Models { } /** - * usageBillingPlan + * Specification */ - export type UsageBillingPlan = { - /** - * Bandwidth additional resources - */ - bandwidth: AdditionalResource; - /** - * Executions additional resources - */ - executions: AdditionalResource; + export type DedicatedDatabaseSpecification = { /** - * Member additional resources + * Specification slug. Use this value when creating a dedicated database. */ - member: AdditionalResource; + slug: string; /** - * Realtime additional resources + * Human readable specification name. */ - realtime: AdditionalResource; + name: string; /** - * Realtime messages additional resources + * Monthly price of the specification in USD. */ - realtimeMessages: AdditionalResource; + price: number; /** - * Realtime bandwidth additional resources + * Allocated CPU in millicores. */ - realtimeBandwidth: AdditionalResource; + cpu: number; /** - * Storage additional resources + * Allocated memory in MB. */ - storage: AdditionalResource; + memory: number; /** - * User additional resources + * Maximum number of concurrent connections. */ - users: AdditionalResource; + maxConnections: number; /** - * GBHour additional resources + * Included storage in GB before overage charges apply. */ - GBHours: AdditionalResource; + includedStorage: number; /** - * Image transformation additional resources + * Included bandwidth in GB before overage charges apply. */ - imageTransformations: AdditionalResource; + includedBandwidth: number; /** - * Credits additional resources + * Whether the specification is available on the current plan. */ - credits: AdditionalResource; + enabled: boolean; } /** - * Activity event list + * SpecificationList */ - export type ActivityEventList = { + export type DedicatedDatabaseSpecificationList = { /** - * Total number of events that matched your query. + * List of dedicated database specifications. + */ + specifications: DedicatedDatabaseSpecification[]; + /** + * Total number of specifications. */ total: number; /** - * List of events. + * Overage and add-on pricing shared across all specifications. */ - events: ActivityEvent[]; + pricing: DedicatedDatabaseSpecificationPricing; } /** - * Backup archive list + * SpecificationPricing */ - export type BackupArchiveList = { + export type DedicatedDatabaseSpecificationPricing = { /** - * Total number of archives that matched your query. + * Price per GB of storage above the included amount, per month, in USD. */ - total: number; + storageOverageRate: number; /** - * List of archives. + * Price per GB of bandwidth above the included amount, per month, in USD. */ - archives: BackupArchive[]; + bandwidthOverageRate: number; + /** + * High availability replica price as a fraction of the specification cost. + */ + replicaRate: number; + /** + * Cross-region replica price as a fraction of the specification cost. + */ + crossRegionReplicaRate: number; + /** + * Point-in-time recovery price as a fraction of the specification cost. + */ + pitrRate: number; } /** - * Backup policy list + * Connections */ - export type BackupPolicyList = { + export type DatabaseStatusConnections = { /** - * Total number of policies that matched your query. + * Current number of active connections. */ - total: number; + current: number; /** - * List of policies. + * Maximum allowed connections. */ - policies: BackupPolicy[]; + max: number; } /** - * Backup restoration list + * Replica + */ + export type DatabaseStatusReplica = { + /** + * StatefulSet pod index (0 = primary, 1+ = replicas). + */ + index: number; + /** + * Replica role: primary or replica. + */ + role: string; + /** + * Whether the replica is healthy. + */ + healthy: boolean; + /** + * Replication lag in seconds (null for primary). + */ + lagSeconds?: number; + } + + /** + * Volume + */ + export type DatabaseStatusVolume = { + /** + * Mount path of the volume. + */ + path: string; + /** + * Percentage of storage used. + */ + usedPercent: string; + /** + * Available storage space. + */ + available: string; + /** + * Whether the volume is mounted. + */ + mounted: boolean; + } + + /** + * usageBillingPlan + */ + export type UsageBillingPlan = { + /** + * Bandwidth additional resources + */ + bandwidth: AdditionalResource; + /** + * Executions additional resources + */ + executions: AdditionalResource; + /** + * Member additional resources + */ + member: AdditionalResource; + /** + * Realtime additional resources + */ + realtime: AdditionalResource; + /** + * Realtime messages additional resources + */ + realtimeMessages: AdditionalResource; + /** + * Realtime bandwidth additional resources + */ + realtimeBandwidth: AdditionalResource; + /** + * Storage additional resources + */ + storage: AdditionalResource; + /** + * User additional resources + */ + users: AdditionalResource; + /** + * GBHour additional resources + */ + GBHours: AdditionalResource; + /** + * Image transformation additional resources + */ + imageTransformations: AdditionalResource; + /** + * Credits additional resources + */ + credits: AdditionalResource; + } + + /** + * App + */ + export type App = { + /** + * App ID. + */ + $id: string; + /** + * App creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * App update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Application name. + */ + name: string; + /** + * Application description shown to users during OAuth2 consent. + */ + description: string; + /** + * Application homepage URL shown to users during OAuth2 consent. + */ + clientUri: string; + /** + * Application logo URL shown to users during OAuth2 consent. + */ + logoUri: string; + /** + * Application privacy policy URL shown to users during OAuth2 consent. + */ + privacyPolicyUrl: string; + /** + * Application terms of service URL shown to users during OAuth2 consent. + */ + termsUrl: string; + /** + * Application support or security contact emails. + */ + contacts: string[]; + /** + * Application tagline shown to users during OAuth2 consent. + */ + tagline: string; + /** + * Application tags shown to users during OAuth2 consent. + */ + tags: string[]; + /** + * Application labels. Read-only for clients; only a server SDK using a project API key can update them. + */ + labels: string[]; + /** + * Application image URLs shown to users during OAuth2 consent. + */ + images: string[]; + /** + * Application support URL shown to users during OAuth2 consent. + */ + supportUrl: string; + /** + * Application data deletion URL shown to users during OAuth2 consent. + */ + dataDeletionUrl: string; + /** + * List of authorized redirect URIs. These URIs can be used to redirect users after they authenticate. + */ + redirectUris: string[]; + /** + * List of authorized post-logout redirect URIs for OpenID Connect RP-Initiated Logout. The logout endpoint only redirects users to URIs in this list after ending their session. + */ + postLogoutRedirectUris: string[]; + /** + * Whether the app is enabled or not. + */ + enabled: boolean; + /** + * OAuth2 client type. `public` for SPAs, mobile, and native apps that cannot keep a client secret (PKCE required); `confidential` for server-side clients that authenticate with a client secret. + */ + type: string; + /** + * Whether this client may use the OAuth2 Device Authorization Grant (RFC 8628). + */ + deviceFlow: boolean; + /** + * ID of team that owns the application, if owned by team. Otherwise, user ID will be used. + */ + teamId: string; + /** + * ID of user who owns the application, if owned by user. Otherwise, team ID will be used. + */ + userId: string; + /** + * Scopes the application requests when installed on a team. Organization-level and project-level scopes only. + */ + installationScopes: string[]; + /** + * URL users are redirected to after creating or updating an installation of this application. Empty for no redirect. + */ + installationRedirectUrl: string; + /** + * List of application secrets. + */ + secrets: AppSecret[]; + } + + /** + * AppSecret + */ + export type AppSecret = { + /** + * Secret ID. + */ + $id: string; + /** + * Secret creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Secret update time in ISO 8601 format. + */ + $updatedAt: string; + /** + * Application ID this secret belongs to. + */ + appId: string; + /** + * Always empty. The application client secret is returned only once, in the response of the createSecret method. + */ + secret: string; + /** + * Last few characters of the client secret, used to help identify it. + */ + hint: string; + /** + * ID of the user who created the secret. + */ + createdById: string; + /** + * Name of the user who created the secret. + */ + createdByName: string; + /** + * Time the secret was last used for authentication in ISO 8601 format. Null if never used. + */ + lastAccessedAt?: string; + } + + /** + * AppSecretPlaintext + */ + export type AppSecretPlaintext = { + /** + * Secret ID. + */ + $id: string; + /** + * Secret creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Secret update time in ISO 8601 format. + */ + $updatedAt: string; + /** + * Application ID this secret belongs to. + */ + appId: string; + /** + * Application client secret. Returned only when the secret is created; subsequent reads always return an empty value. + */ + secret: string; + /** + * Last few characters of the client secret, used to help identify it. + */ + hint: string; + /** + * ID of the user who created the secret. + */ + createdById: string; + /** + * Name of the user who created the secret. + */ + createdByName: string; + /** + * Time the secret was last used for authentication in ISO 8601 format. Null if never used. + */ + lastAccessedAt?: string; + } + + /** + * AppScope + */ + export type AppScope = { + /** + * Scope value as requested by apps. + */ + value: string; + /** + * Human-readable description of what the scope grants. + */ + description: string; + /** + * What the scope grants access to. One of `account`, `project`, or `organization`. Only `project` and `organization` scopes are installable. + */ + type: string; + /** + * Scope category, used to group scopes on consent and installation screens. + */ + category: string; + /** + * Whether the scope is deprecated. Deprecated scopes can still be requested but should not be offered for new grants. + */ + deprecated: boolean; + } + + /** + * AppInstallation + */ + export type AppInstallation = { + /** + * Installation ID. + */ + $id: string; + /** + * Installation creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Installation update time in ISO 8601 format. + */ + $updatedAt: string; + /** + * ID of the installed application. + */ + appId: string; + /** + * ID of the team the application is installed on. + */ + teamId: string; + /** + * Scopes granted to the application. Snapshot of the application's installation scopes taken when the installation was created or last updated. + */ + scopes: string[]; + /** + * Authorization details granted to the application. Rich authorization request (RFC 9396) style entries; the Appwrite Console stores authorized project IDs here. + */ + authorizationDetails: object; + /** + * ID of the user who created the installation. + */ + createdById: string; + /** + * Name of the user who created the installation. + */ + createdByName: string; + /** + * Time an access token was last issued for the installation in ISO 8601 format. Null if never used. + */ + lastAccessedAt?: string; + } + + /** + * AppKey + */ + export type AppKey = { + /** + * App key ID. + */ + $id: string; + /** + * App key creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * App key update time in ISO 8601 format. + */ + $updatedAt: string; + /** + * Application ID this app key belongs to. + */ + appId: string; + /** + * App key secret. + */ + secret: string; + /** + * Last few characters of the app key secret, used to help identify it. + */ + hint: string; + /** + * ID of the user who created the app key. + */ + createdById: string; + /** + * Name of the user who created the app key. + */ + createdByName: string; + /** + * Time the app key was last used for authentication in ISO 8601 format. Null if never used. + */ + lastAccessedAt?: string; + } + + /** + * OAuth2 Authorize + */ + export type Oauth2Authorize = { + /** + * OAuth2 grant ID. Set when the user must give explicit consent; pass it to the approve or reject endpoint. Empty when a redirect URL is returned instead. + */ + grantId: string; + /** + * URL the end user should be redirected to when the flow can complete without consent. Empty when consent is still required. + */ + redirectUrl: string; + } + + /** + * OAuth2 Approve + */ + export type Oauth2Approve = { + /** + * URL the end user should be redirected to after the grant is approved, carrying the authorization `code` and/or `id_token` along with the original `state`. + */ + redirectUrl: string; + } + + /** + * OAuth2 Reject + */ + export type Oauth2Reject = { + /** + * URL the end user should be redirected to after the grant is rejected, carrying an `access_denied` error. + */ + redirectUrl: string; + } + + /** + * OAuth2 Grant + */ + export type Oauth2Grant = { + /** + * Grant ID. + */ + $id: string; + /** + * Grant creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Grant update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ID of the user the grant belongs to. + */ + userId: string; + /** + * ID of the OAuth2 client (app) the grant was requested for. + */ + appId: string; + /** + * Requested OAuth2 scopes the user is being asked to consent to. + */ + scopes: string[]; + /** + * Requested RFC 8707 resource indicators the user is being asked to consent to. + */ + resources: string[]; + /** + * Requested authorization_details the user is being asked to consent to, as a JSON string. Each entry has a `type` plus project-defined fields. + */ + authorizationDetails: string; + /** + * OIDC prompt directive the consent screen should honor. Space-separated list of: login, consent, select_account. + */ + prompt: string; + /** + * Redirect URI the user will be sent to after the flow completes. + */ + redirectUri: string; + /** + * Unix timestamp of when the user last authenticated. + */ + authTime: number; + /** + * Grant expiration time in ISO 8601 format. + */ + expire: string; + } + + /** + * OAuth2 Device Authorization + */ + export type Oauth2DeviceAuthorization = { + /** + * Device verification code used by the client to poll the token endpoint. + */ + device_code: string; + /** + * Short code the end user enters on the verification page. + */ + user_code: string; + /** + * URL where the end user enters the user code. + */ + verification_uri: string; + /** + * Verification URL with the user code prefilled as a query parameter. + */ + verification_uri_complete: string; + /** + * Lifetime of the device code and user code in seconds. + */ + expires_in: number; + /** + * Minimum polling interval for the token endpoint in seconds. + */ + interval: number; + } + + /** + * OAuth2 PAR + */ + export type Oauth2PAR = { + /** + * Authorization request handle to pass to the authorize endpoint. + */ + request_uri: string; + /** + * Lifetime of the authorization request handle in seconds. + */ + expires_in: number; + } + + /** + * OAuth2 Token + */ + export type Oauth2Token = { + /** + * OAuth2 access token. + */ + access_token: string; + /** + * OAuth2 token type. + */ + token_type: string; + /** + * Access token lifetime in seconds. + */ + expires_in: number; + /** + * OAuth2 refresh token. + */ + refresh_token: string; + /** + * Space-separated scopes granted to the access token. + */ + scope: string; + /** + * Granted RFC 9396 authorization details as a JSON string. + */ + authorization_details?: string; + /** + * OpenID Connect ID token. Returned when the `openid` scope is granted. + */ + id_token?: string; + } + + /** + * OAuth2 Consent + */ + export type Oauth2Consent = { + /** + * Consent ID. + */ + $id: string; + /** + * Consent creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Consent update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ID of the user the consent belongs to. + */ + userId: string; + /** + * ID of the registered app the consent was given to. Empty for URL-form (CIMD) clients. + */ + appId: string; + /** + * Client ID metadata document URL of the client the consent was given to. Empty for registered apps. + */ + cimdUrl: string; + /** + * OAuth2 scopes the user consented to. + */ + scopes: string[]; + /** + * RFC 8707 resource indicators the user consented to. + */ + resources: string[]; + /** + * Authorization details the user consented to, as a JSON string. Each entry has a `type` plus project-defined fields. + */ + authorizationDetails: string; + /** + * Consent expiration time in ISO 8601 format. Empty when the consent has no token-bound expiry yet. + */ + expire: string; + } + + /** + * OAuth2 Consent Token + */ + export type Oauth2ConsentToken = { + /** + * Token family ID. + */ + $id: string; + /** + * Token creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Token update date in ISO 8601 format. Refreshing the token family updates this. + */ + $updatedAt: string; + /** + * ID of the consent the token family was issued under. + */ + consentId: string; + /** + * ID of the user the token family belongs to. + */ + userId: string; + /** + * ID of the registered app the token family was issued to. Empty for URL-form (CIMD) clients. + */ + appId: string; + /** + * Client ID metadata document URL of the client the token family was issued to. Empty for registered apps. + */ + cimdUrl: string; + /** + * OAuth2 scopes granted on the token family. + */ + scopes: string[]; + /** + * RFC 8707 resource indicators granted on the token family. + */ + resources: string[]; + /** + * Authorization details granted on the token family, as a JSON string. Each entry has a `type` plus project-defined fields. + */ + authorizationDetails: string; + /** + * Expiration time of the current access token of this family in ISO 8601 format. + */ + expire: string; + } + + /** + * OAuth2 Project + */ + export type Oauth2Project = { + /** + * Project ID. + */ + $id: string; + /** + * Region ID the project is deployed in. + */ + region: string; + /** + * API endpoint of the region the project is deployed in. Empty when the region has no public hostname configured. + */ + endpoint: string; + } + + /** + * OAuth2 Organization + */ + export type Oauth2Organization = { + /** + * Organization ID. + */ + $id: string; + } + + /** + * OAuth2 accessible projects list + */ + export type Oauth2ProjectList = { + /** + * Total number of projects that matched your query. + */ + total: number; + /** + * List of projects. + */ + projects: Oauth2Project[]; + } + + /** + * OAuth2 accessible organizations list + */ + export type Oauth2OrganizationList = { + /** + * Total number of organizations that matched your query. + */ + total: number; + /** + * List of organizations. + */ + organizations: Oauth2Organization[]; + } + + /** + * OAuth2 consents list + */ + export type Oauth2ConsentList = { + /** + * Total number of consents that matched your query. + */ + total: number; + /** + * List of consents. + */ + consents: Oauth2Consent[]; + } + + /** + * OAuth2 consent tokens list + */ + export type Oauth2ConsentTokenList = { + /** + * Total number of tokens that matched your query. + */ + total: number; + /** + * List of tokens. + */ + tokens: Oauth2ConsentToken[]; + } + + /** + * 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 = { /** @@ -7842,4 +8988,74 @@ export namespace Models { */ restorations: BackupRestoration[]; } + + /** + * Apps list + */ + export type AppsList = { + /** + * Total number of apps that matched your query. + */ + total: number; + /** + * List of apps. + */ + apps: App[]; + } + + /** + * App secrets list + */ + export type AppSecretList = { + /** + * Total number of secrets that matched your query. + */ + total: number; + /** + * List of secrets. + */ + secrets: AppSecret[]; + } + + /** + * App scopes list + */ + export type AppScopeList = { + /** + * Total number of scopes that matched your query. + */ + total: number; + /** + * List of scopes. + */ + scopes: AppScope[]; + } + + /** + * App installations list + */ + export type AppInstallationList = { + /** + * Total number of installations that matched your query. + */ + total: number; + /** + * List of installations. + */ + installations: AppInstallation[]; + } + + /** + * App keys list + */ + export type AppKeyList = { + /** + * Total number of keys that matched your query. + */ + total: number; + /** + * List of keys. + */ + keys: AppKey[]; + } } diff --git a/src/services/account.ts b/src/services/account.ts index 57aadeb..3443e13 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -123,6 +123,365 @@ export class Account { ); } + /** + * Get a list of the OAuth2 consents the current user has given to third-party apps. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listConsents(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of the OAuth2 consents the current user has given to third-party apps. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listConsents(queries?: string[], total?: boolean): Promise; + listConsents( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/account/consents'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an OAuth2 consent the current user has given to a third-party app by its unique ID. + * + * @param {string} params.consentId - Consent unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getConsent(params: { consentId: string }): Promise; + /** + * Get an OAuth2 consent the current user has given to a third-party app by its unique ID. + * + * @param {string} consentId - Consent unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getConsent(consentId: string): Promise; + getConsent( + paramsOrFirst: { consentId: string } | string + ): Promise { + let params: { consentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { consentId: string }; + } else { + params = { + consentId: paramsOrFirst as string + }; + } + + const consentId = params.consentId; + + if (typeof consentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "consentId"'); + } + + const apiPath = '/account/consents/{consentId}'.replace('{consentId}', encodeURIComponent(String(consentId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an OAuth2 consent by its unique ID. All token families issued under the consent are revoked, and the app must ask for consent again to regain access. + * + * @param {string} params.consentId - Consent unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteConsent(params: { consentId: string }): Promise<{}>; + /** + * Delete an OAuth2 consent by its unique ID. All token families issued under the consent are revoked, and the app must ask for consent again to regain access. + * + * @param {string} consentId - Consent unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteConsent(consentId: string): Promise<{}>; + deleteConsent( + paramsOrFirst: { consentId: string } | string + ): Promise<{}> { + let params: { consentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { consentId: string }; + } else { + params = { + consentId: paramsOrFirst as string + }; + } + + const consentId = params.consentId; + + if (typeof consentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "consentId"'); + } + + const apiPath = '/account/consents/{consentId}'.replace('{consentId}', encodeURIComponent(String(consentId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of the token families issued under an OAuth2 consent. Each entry represents one authorized device or session; the token secrets themselves are never returned. + * + * @param {string} params.consentId - Consent unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listConsentTokens(params: { consentId: string, queries?: string[], total?: boolean }): Promise; + /** + * Get a list of the token families issued under an OAuth2 consent. Each entry represents one authorized device or session; the token secrets themselves are never returned. + * + * @param {string} consentId - Consent unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listConsentTokens(consentId: string, queries?: string[], total?: boolean): Promise; + listConsentTokens( + paramsOrFirst: { consentId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { consentId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { consentId: string, queries?: string[], total?: boolean }; + } else { + params = { + consentId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const consentId = params.consentId; + const queries = params.queries; + const total = params.total; + + if (typeof consentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "consentId"'); + } + + const apiPath = '/account/consents/{consentId}/tokens'.replace('{consentId}', encodeURIComponent(String(consentId))); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a token family issued under an OAuth2 consent by its unique ID. The token secrets themselves are never returned. + * + * @param {string} params.consentId - Consent unique ID. + * @param {string} params.tokenId - Token unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getConsentToken(params: { consentId: string, tokenId: string }): Promise; + /** + * Get a token family issued under an OAuth2 consent by its unique ID. The token secrets themselves are never returned. + * + * @param {string} consentId - Consent unique ID. + * @param {string} tokenId - Token unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getConsentToken(consentId: string, tokenId: string): Promise; + getConsentToken( + paramsOrFirst: { consentId: string, tokenId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { consentId: string, tokenId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { consentId: string, tokenId: string }; + } else { + params = { + consentId: paramsOrFirst as string, + tokenId: rest[0] as string + }; + } + + const consentId = params.consentId; + const tokenId = params.tokenId; + + if (typeof consentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "consentId"'); + } + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/account/consents/{consentId}/tokens/{tokenId}'.replace('{consentId}', encodeURIComponent(String(consentId))).replace('{tokenId}', encodeURIComponent(String(tokenId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a token family issued under an OAuth2 consent by its unique ID. The access and refresh tokens of the family stop working immediately; other token families and the consent itself are unaffected. + * + * @param {string} params.consentId - Consent unique ID. + * @param {string} params.tokenId - Token unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteConsentToken(params: { consentId: string, tokenId: string }): Promise<{}>; + /** + * Delete a token family issued under an OAuth2 consent by its unique ID. The access and refresh tokens of the family stop working immediately; other token families and the consent itself are unaffected. + * + * @param {string} consentId - Consent unique ID. + * @param {string} tokenId - Token unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteConsentToken(consentId: string, tokenId: string): Promise<{}>; + deleteConsentToken( + paramsOrFirst: { consentId: string, tokenId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { consentId: string, tokenId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { consentId: string, tokenId: string }; + } else { + params = { + consentId: paramsOrFirst as string, + tokenId: rest[0] as string + }; + } + + const consentId = params.consentId; + const tokenId = params.tokenId; + + if (typeof consentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "consentId"'); + } + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/account/consents/{consentId}/tokens/{tokenId}'.replace('{consentId}', encodeURIComponent(String(consentId))).replace('{tokenId}', encodeURIComponent(String(tokenId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + /** * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. diff --git a/src/services/apps.ts b/src/services/apps.ts new file mode 100644 index 0000000..bdee84f --- /dev/null +++ b/src/services/apps.ts @@ -0,0 +1,1476 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Apps { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List applications. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { queries?: string[], total?: boolean }): Promise; + /** + * List applications. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise; + list( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/apps'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new application. + * + * @param {string} params.appId - Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Application name. + * @param {string[]} params.redirectUris - Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. + * @param {string} params.description - Application description shown to users during OAuth2 consent. + * @param {string} params.clientUri - Application homepage URL shown to users during OAuth2 consent. + * @param {string} params.logoUri - Application logo URL shown to users during OAuth2 consent. + * @param {string} params.privacyPolicyUrl - Application privacy policy URL shown to users during OAuth2 consent. + * @param {string} params.termsUrl - Application terms of service URL shown to users during OAuth2 consent. + * @param {string[]} params.contacts - Application support or security contact emails. Maximum of 100 contacts are allowed. + * @param {string} params.tagline - Application tagline shown to users during OAuth2 consent. + * @param {string[]} params.tags - Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long. + * @param {string[]} params.images - Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed. + * @param {string} params.supportUrl - Application support URL shown to users during OAuth2 consent. + * @param {string} params.dataDeletionUrl - Application data deletion URL shown to users during OAuth2 consent. + * @param {string[]} params.postLogoutRedirectUris - Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. + * @param {boolean} params.enabled - Is application enabled? + * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} params.deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @param {string} params.teamId - Team unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }): Promise; + /** + * Create a new application. + * + * @param {string} appId - Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Application name. + * @param {string[]} redirectUris - Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. + * @param {string} description - Application description shown to users during OAuth2 consent. + * @param {string} clientUri - Application homepage URL shown to users during OAuth2 consent. + * @param {string} logoUri - Application logo URL shown to users during OAuth2 consent. + * @param {string} privacyPolicyUrl - Application privacy policy URL shown to users during OAuth2 consent. + * @param {string} termsUrl - Application terms of service URL shown to users during OAuth2 consent. + * @param {string[]} contacts - Application support or security contact emails. Maximum of 100 contacts are allowed. + * @param {string} tagline - Application tagline shown to users during OAuth2 consent. + * @param {string[]} tags - Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long. + * @param {string[]} images - Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed. + * @param {string} supportUrl - Application support URL shown to users during OAuth2 consent. + * @param {string} dataDeletionUrl - Application data deletion URL shown to users during OAuth2 consent. + * @param {string[]} postLogoutRedirectUris - Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. + * @param {boolean} enabled - Is application enabled? + * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @param {string} teamId - Team unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string): Promise; + create( + paramsOrFirst: { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string } | string, + ...rest: [(string)?, (string[])?, (string)?, (string)?, (string)?, (string)?, (string)?, (string[])?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?, (string)?] + ): Promise { + let params: { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; + } else { + params = { + appId: paramsOrFirst as string, + name: rest[0] as string, + redirectUris: rest[1] as string[], + description: rest[2] as string, + clientUri: rest[3] as string, + logoUri: rest[4] as string, + privacyPolicyUrl: rest[5] as string, + termsUrl: rest[6] as string, + contacts: rest[7] as string[], + tagline: rest[8] as string, + tags: rest[9] as string[], + images: rest[10] as string[], + supportUrl: rest[11] as string, + dataDeletionUrl: rest[12] as string, + postLogoutRedirectUris: rest[13] as string[], + enabled: rest[14] as boolean, + type: rest[15] as string, + deviceFlow: rest[16] as boolean, + teamId: rest[17] as string + }; + } + + const appId = params.appId; + const name = params.name; + const redirectUris = params.redirectUris; + const description = params.description; + const clientUri = params.clientUri; + const logoUri = params.logoUri; + const privacyPolicyUrl = params.privacyPolicyUrl; + const termsUrl = params.termsUrl; + const contacts = params.contacts; + const tagline = params.tagline; + const tags = params.tags; + const images = params.images; + const supportUrl = params.supportUrl; + const dataDeletionUrl = params.dataDeletionUrl; + const postLogoutRedirectUris = params.postLogoutRedirectUris; + const enabled = params.enabled; + const type = params.type; + const deviceFlow = params.deviceFlow; + const teamId = params.teamId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof redirectUris === 'undefined') { + throw new AppwriteException('Missing required parameter: "redirectUris"'); + } + + const apiPath = '/apps'; + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof description !== 'undefined') { + payload['description'] = description; + } + if (typeof clientUri !== 'undefined') { + payload['clientUri'] = clientUri; + } + if (typeof logoUri !== 'undefined') { + payload['logoUri'] = logoUri; + } + if (typeof privacyPolicyUrl !== 'undefined') { + payload['privacyPolicyUrl'] = privacyPolicyUrl; + } + if (typeof termsUrl !== 'undefined') { + payload['termsUrl'] = termsUrl; + } + if (typeof contacts !== 'undefined') { + payload['contacts'] = contacts; + } + if (typeof tagline !== 'undefined') { + payload['tagline'] = tagline; + } + if (typeof tags !== 'undefined') { + payload['tags'] = tags; + } + if (typeof images !== 'undefined') { + payload['images'] = images; + } + if (typeof supportUrl !== 'undefined') { + payload['supportUrl'] = supportUrl; + } + if (typeof dataDeletionUrl !== 'undefined') { + payload['dataDeletionUrl'] = dataDeletionUrl; + } + if (typeof redirectUris !== 'undefined') { + payload['redirectUris'] = redirectUris; + } + if (typeof postLogoutRedirectUris !== 'undefined') { + payload['postLogoutRedirectUris'] = postLogoutRedirectUris; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof deviceFlow !== 'undefined') { + payload['deviceFlow'] = deviceFlow; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * List scopes an application can request when installed on a team. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listInstallationScopes(): Promise { + + const apiPath = '/apps/scopes/installations'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List scopes an application can request during the OAuth2 flow. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listOAuth2Scopes(): Promise { + + const apiPath = '/apps/scopes/oauth2'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an application by its unique ID. + * + * @param {string} params.appId - Application unique ID or HTTPS client ID metadata document URL. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { appId: string }): Promise; + /** + * Get an application by its unique ID. + * + * @param {string} appId - Application unique ID or HTTPS client ID metadata document URL. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(appId: string): Promise; + get( + paramsOrFirst: { appId: string } | string + ): Promise { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.name - Application name. + * @param {string} params.description - Application description shown to users during OAuth2 consent. + * @param {string} params.clientUri - Application homepage URL shown to users during OAuth2 consent. + * @param {string} params.logoUri - Application logo URL shown to users during OAuth2 consent. + * @param {string} params.privacyPolicyUrl - Application privacy policy URL shown to users during OAuth2 consent. + * @param {string} params.termsUrl - Application terms of service URL shown to users during OAuth2 consent. + * @param {string[]} params.contacts - Application support or security contact emails. Maximum of 100 contacts are allowed. + * @param {string} params.tagline - Application tagline shown to users during OAuth2 consent. + * @param {string[]} params.tags - Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long. + * @param {string[]} params.images - Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed. + * @param {string} params.supportUrl - Application support URL shown to users during OAuth2 consent. + * @param {string} params.dataDeletionUrl - Application data deletion URL shown to users during OAuth2 consent. + * @param {boolean} params.enabled - Is application enabled? + * @param {string[]} params.redirectUris - Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. + * @param {string[]} params.postLogoutRedirectUris - Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. + * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} params.deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @param {string[]} params.installationScopes - Scopes the application requests when installed on a team. Organization-level and project-level scopes only; use the list scopes endpoint with `type=installation` to discover available values. Maximum of 100 scopes are allowed. + * @param {string} params.installationRedirectUrl - URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string }): Promise; + /** + * Update an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} name - Application name. + * @param {string} description - Application description shown to users during OAuth2 consent. + * @param {string} clientUri - Application homepage URL shown to users during OAuth2 consent. + * @param {string} logoUri - Application logo URL shown to users during OAuth2 consent. + * @param {string} privacyPolicyUrl - Application privacy policy URL shown to users during OAuth2 consent. + * @param {string} termsUrl - Application terms of service URL shown to users during OAuth2 consent. + * @param {string[]} contacts - Application support or security contact emails. Maximum of 100 contacts are allowed. + * @param {string} tagline - Application tagline shown to users during OAuth2 consent. + * @param {string[]} tags - Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long. + * @param {string[]} images - Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed. + * @param {string} supportUrl - Application support URL shown to users during OAuth2 consent. + * @param {string} dataDeletionUrl - Application data deletion URL shown to users during OAuth2 consent. + * @param {boolean} enabled - Is application enabled? + * @param {string[]} redirectUris - Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment. + * @param {string[]} postLogoutRedirectUris - Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. + * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @param {string[]} installationScopes - Scopes the application requests when installed on a team. Organization-level and project-level scopes only; use the list scopes endpoint with `type=installation` to discover available values. Maximum of 100 scopes are allowed. + * @param {string} installationRedirectUrl - URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string): Promise; + update( + paramsOrFirst: { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string[])?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (boolean)?, (string[])?, (string[])?, (string)?, (boolean)?, (string[])?, (string)?] + ): Promise { + let params: { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string }; + } else { + params = { + appId: paramsOrFirst as string, + name: rest[0] as string, + description: rest[1] as string, + clientUri: rest[2] as string, + logoUri: rest[3] as string, + privacyPolicyUrl: rest[4] as string, + termsUrl: rest[5] as string, + contacts: rest[6] as string[], + tagline: rest[7] as string, + tags: rest[8] as string[], + images: rest[9] as string[], + supportUrl: rest[10] as string, + dataDeletionUrl: rest[11] as string, + enabled: rest[12] as boolean, + redirectUris: rest[13] as string[], + postLogoutRedirectUris: rest[14] as string[], + type: rest[15] as string, + deviceFlow: rest[16] as boolean, + installationScopes: rest[17] as string[], + installationRedirectUrl: rest[18] as string + }; + } + + const appId = params.appId; + const name = params.name; + const description = params.description; + const clientUri = params.clientUri; + const logoUri = params.logoUri; + const privacyPolicyUrl = params.privacyPolicyUrl; + const termsUrl = params.termsUrl; + const contacts = params.contacts; + const tagline = params.tagline; + const tags = params.tags; + const images = params.images; + const supportUrl = params.supportUrl; + const dataDeletionUrl = params.dataDeletionUrl; + const enabled = params.enabled; + const redirectUris = params.redirectUris; + const postLogoutRedirectUris = params.postLogoutRedirectUris; + const type = params.type; + const deviceFlow = params.deviceFlow; + const installationScopes = params.installationScopes; + const installationRedirectUrl = params.installationRedirectUrl; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof description !== 'undefined') { + payload['description'] = description; + } + if (typeof clientUri !== 'undefined') { + payload['clientUri'] = clientUri; + } + if (typeof logoUri !== 'undefined') { + payload['logoUri'] = logoUri; + } + if (typeof privacyPolicyUrl !== 'undefined') { + payload['privacyPolicyUrl'] = privacyPolicyUrl; + } + if (typeof termsUrl !== 'undefined') { + payload['termsUrl'] = termsUrl; + } + if (typeof contacts !== 'undefined') { + payload['contacts'] = contacts; + } + if (typeof tagline !== 'undefined') { + payload['tagline'] = tagline; + } + if (typeof tags !== 'undefined') { + payload['tags'] = tags; + } + if (typeof images !== 'undefined') { + payload['images'] = images; + } + if (typeof supportUrl !== 'undefined') { + payload['supportUrl'] = supportUrl; + } + if (typeof dataDeletionUrl !== 'undefined') { + payload['dataDeletionUrl'] = dataDeletionUrl; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof redirectUris !== 'undefined') { + payload['redirectUris'] = redirectUris; + } + if (typeof postLogoutRedirectUris !== 'undefined') { + payload['postLogoutRedirectUris'] = postLogoutRedirectUris; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof deviceFlow !== 'undefined') { + payload['deviceFlow'] = deviceFlow; + } + if (typeof installationScopes !== 'undefined') { + payload['installationScopes'] = installationScopes; + } + if (typeof installationRedirectUrl !== 'undefined') { + payload['installationRedirectUrl'] = installationRedirectUrl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { appId: string }): Promise<{}>; + /** + * Delete an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(appId: string): Promise<{}>; + delete( + paramsOrFirst: { appId: string } | string + ): Promise<{}> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List installations of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * + * @param {string} params.appId - Application unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listInstallations(params: { appId: string, queries?: string[], total?: boolean }): Promise; + /** + * List installations of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * + * @param {string} appId - Application unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listInstallations(appId: string, queries?: string[], total?: boolean): Promise; + listInstallations( + paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { appId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const appId = params.appId; + const queries = params.queries; + const total = params.total; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/installations'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an installation of an application by its unique ID. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getInstallation(params: { appId: string, installationId: string }): Promise; + /** + * Get an installation of an application by its unique ID. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * + * @param {string} appId - Application unique ID. + * @param {string} installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInstallation(appId: string, installationId: string): Promise; + getInstallation( + paramsOrFirst: { appId: string, installationId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, installationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, installationId: string }; + } else { + params = { + appId: paramsOrFirst as string, + installationId: rest[0] as string + }; + } + + const appId = params.appId; + const installationId = params.installationId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/apps/{appId}/installations/{installationId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a token for an installation of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. The returned token carries the scopes and authorization details granted to the installation, and can be used as an `Authorization: Bearer` header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + createInstallationToken(params: { appId: string, installationId: string }): Promise; + /** + * Create a token for an installation of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. The returned token carries the scopes and authorization details granted to the installation, and can be used as an `Authorization: Bearer` header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted. + * + * @param {string} appId - Application unique ID. + * @param {string} installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createInstallationToken(appId: string, installationId: string): Promise; + createInstallationToken( + paramsOrFirst: { appId: string, installationId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, installationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, installationId: string }; + } else { + params = { + appId: paramsOrFirst as string, + installationId: rest[0] as string + }; + } + + const appId = params.appId; + const installationId = params.installationId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/apps/{appId}/installations/{installationId}/tokens'.replace('{appId}', encodeURIComponent(String(appId))).replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * List app keys for an application. + * + * @param {string} params.appId - Application unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listKeys(params: { appId: string, queries?: string[], total?: boolean }): Promise; + /** + * List app keys for an application. + * + * @param {string} appId - Application unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listKeys(appId: string, queries?: string[], total?: boolean): Promise; + listKeys( + paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { appId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const appId = params.appId; + const queries = params.queries; + const total = params.total; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/keys'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new app key for an application. App keys carry no scopes; send one in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to list the application's installations and create installation access tokens. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + createKey(params: { appId: string }): Promise; + /** + * Create a new app key for an application. App keys carry no scopes; send one in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to list the application's installations and create installation access tokens. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createKey(appId: string): Promise; + createKey( + paramsOrFirst: { appId: string } | string + ): Promise { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/keys'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an app key by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.keyId - App key unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getKey(params: { appId: string, keyId: string }): Promise; + /** + * Get an app key by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} keyId - App key unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getKey(appId: string, keyId: string): Promise; + getKey( + paramsOrFirst: { appId: string, keyId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, keyId: string }; + } else { + params = { + appId: paramsOrFirst as string, + keyId: rest[0] as string + }; + } + + const appId = params.appId; + const keyId = params.keyId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/apps/{appId}/keys/{keyId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{keyId}', encodeURIComponent(String(keyId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an app key by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.keyId - App key unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteKey(params: { appId: string, keyId: string }): Promise<{}>; + /** + * Delete an app key by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} keyId - App key unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteKey(appId: string, keyId: string): Promise<{}>; + deleteKey( + paramsOrFirst: { appId: string, keyId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { appId: string, keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, keyId: string }; + } else { + params = { + appId: paramsOrFirst as string, + keyId: rest[0] as string + }; + } + + const appId = params.appId; + const keyId = params.keyId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/apps/{appId}/keys/{keyId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{keyId}', encodeURIComponent(String(keyId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the labels of an application. Labels are read-only for clients; only a server SDK using a project API key can set them. Replaces the previous labels. + * + * @param {string} params.appId - Application unique ID. + * @param {string[]} params.labels - Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateLabels(params: { appId: string, labels: string[] }): Promise; + /** + * Update the labels of an application. Labels are read-only for clients; only a server SDK using a project API key can set them. Replaces the previous labels. + * + * @param {string} appId - Application unique ID. + * @param {string[]} labels - Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLabels(appId: string, labels: string[]): Promise; + updateLabels( + paramsOrFirst: { appId: string, labels: string[] } | string, + ...rest: [(string[])?] + ): Promise { + let params: { appId: string, labels: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, labels: string[] }; + } else { + params = { + appId: paramsOrFirst as string, + labels: rest[0] as string[] + }; + } + + const appId = params.appId; + const labels = params.labels; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof labels === 'undefined') { + throw new AppwriteException('Missing required parameter: "labels"'); + } + + const apiPath = '/apps/{appId}/labels'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + if (typeof labels !== 'undefined') { + payload['labels'] = labels; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * List client secrets for an application. + * + * @param {string} params.appId - Application unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listSecrets(params: { appId: string, queries?: string[], total?: boolean }): Promise; + /** + * List client secrets for an application. + * + * @param {string} appId - Application unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSecrets(appId: string, queries?: string[], total?: boolean): Promise; + listSecrets( + paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { appId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const appId = params.appId; + const queries = params.queries; + const total = params.total; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/secrets'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new client secret for an application. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + createSecret(params: { appId: string }): Promise; + /** + * Create a new client secret for an application. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSecret(appId: string): Promise; + createSecret( + paramsOrFirst: { appId: string } | string + ): Promise { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/secrets'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an application client secret by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getSecret(params: { appId: string, secretId: string }): Promise; + /** + * Get an application client secret by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getSecret(appId: string, secretId: string): Promise; + getSecret( + paramsOrFirst: { appId: string, secretId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, secretId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + } else { + params = { + appId: paramsOrFirst as string, + secretId: rest[0] as string + }; + } + + const appId = params.appId; + const secretId = params.secretId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof secretId === 'undefined') { + throw new AppwriteException('Missing required parameter: "secretId"'); + } + + const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{secretId}', encodeURIComponent(String(secretId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an application client secret by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSecret(params: { appId: string, secretId: string }): Promise<{}>; + /** + * Delete an application client secret by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSecret(appId: string, secretId: string): Promise<{}>; + deleteSecret( + paramsOrFirst: { appId: string, secretId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { appId: string, secretId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + } else { + params = { + appId: paramsOrFirst as string, + secretId: rest[0] as string + }; + } + + const appId = params.appId; + const secretId = params.secretId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof secretId === 'undefined') { + throw new AppwriteException('Missing required parameter: "secretId"'); + } + + const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{secretId}', encodeURIComponent(String(secretId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Transfer an application to another team by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.teamId - Team ID of the team to transfer application to. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateTeam(params: { appId: string, teamId: string }): Promise; + /** + * Transfer an application to another team by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} teamId - Team ID of the team to transfer application to. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTeam(appId: string, teamId: string): Promise; + updateTeam( + paramsOrFirst: { appId: string, teamId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, teamId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, teamId: string }; + } else { + params = { + appId: paramsOrFirst as string, + teamId: rest[0] as string + }; + } + + const appId = params.appId; + const teamId = params.teamId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/apps/{appId}/team'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Revoke all tokens for an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTokens(params: { appId: string }): Promise<{}>; + /** + * Revoke all tokens for an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTokens(appId: string): Promise<{}>; + deleteTokens( + paramsOrFirst: { appId: string } | string + ): Promise<{}> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/tokens'.replace('{appId}', encodeURIComponent(String(appId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/backups.ts b/src/services/backups.ts index 38b5cc0..ee83d6a 100644 --- a/src/services/backups.ts +++ b/src/services/backups.ts @@ -591,49 +591,58 @@ export class Backups { /** * Create and trigger a new restoration for a backup on a project. * - * When restoring a DocumentsDB or VectorsDB database to a new resource, pass `newSpecification` to provision the restored database on a different specification than the archived one (for example, restoring onto a larger or smaller dedicated database). Use `serverless` to restore onto the shared pool, or a dedicated specification slug to restore onto a dedicated database of that size. The specification must be permitted by the organization's plan. `newSpecification` is not supported for legacy/TablesDB databases or for bucket restores. + * For a backup of one database, the restoration resolves its destination before it is queued. Pass `newResourceId` to restore into that database ID, including the archived database ID to overwrite it. When `newResourceId` is omitted, a new database ID is generated and returned in `options`. + * + * The restoration migration records the archived database in `resourceId` and `resourceType`, and the resolved database in `destinationResourceId` and `destinationResourceType`. Database types are stored canonically as `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave these fields empty because they do not have a single source or destination database. + * + * To list every migration related to one database, use its canonical type in a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and destination relation pairs: `(resourceType, resourceId)`, `(parentResourceType, parentResourceId)`, and `(destinationResourceType, destinationResourceId)`. Legacy and TablesDB databases use `database`; the operational `resourceType` of a table migration is not rewritten to `tablesdb`. + * + * When restoring a DocumentsDB or VectorsDB database to a new resource from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification. * * * @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.newResourceId - Destination resource ID. Omit to generate a new ID, or pass the archived resource ID to overwrite 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.newResourceName - Database name. Max length: 128 chars. - * @param {string} params.newSpecification - Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use `serverless` for the shared pool or a dedicated specification slug. * @throws {AppwriteException} * @returns {Promise} */ - createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string }): Promise; + createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise; /** * Create and trigger a new restoration for a backup on a project. * - * When restoring a DocumentsDB or VectorsDB database to a new resource, pass `newSpecification` to provision the restored database on a different specification than the archived one (for example, restoring onto a larger or smaller dedicated database). Use `serverless` to restore onto the shared pool, or a dedicated specification slug to restore onto a dedicated database of that size. The specification must be permitted by the organization's plan. `newSpecification` is not supported for legacy/TablesDB databases or for bucket restores. + * For a backup of one database, the restoration resolves its destination before it is queued. Pass `newResourceId` to restore into that database ID, including the archived database ID to overwrite it. When `newResourceId` is omitted, a new database ID is generated and returned in `options`. + * + * The restoration migration records the archived database in `resourceId` and `resourceType`, and the resolved database in `destinationResourceId` and `destinationResourceType`. Database types are stored canonically as `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave these fields empty because they do not have a single source or destination database. + * + * To list every migration related to one database, use its canonical type in a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and destination relation pairs: `(resourceType, resourceId)`, `(parentResourceType, parentResourceId)`, and `(destinationResourceType, destinationResourceId)`. Legacy and TablesDB databases use `database`; the operational `resourceType` of a table migration is not rewritten to `tablesdb`. + * + * When restoring a DocumentsDB or VectorsDB database to a new resource from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification. * * * @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} newResourceId - Destination resource ID. Omit to generate a new ID, or pass the archived resource ID to overwrite 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} newResourceName - Database name. Max length: 128 chars. - * @param {string} newSpecification - Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use `serverless` for the shared pool or a dedicated specification slug. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string): Promise; + createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise; createRestoration( - paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string } | string, - ...rest: [(BackupServices[])?, (string)?, (string)?, (string)?] + paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, + ...rest: [(BackupServices[])?, (string)?, (string)?] ): Promise { - let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string, newSpecification?: string }; + 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, newSpecification?: string }; + 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, - newSpecification: rest[3] as string + newResourceName: rest[2] as string }; } @@ -641,7 +650,6 @@ export class Backups { const services = params.services; const newResourceId = params.newResourceId; const newResourceName = params.newResourceName; - const newSpecification = params.newSpecification; if (typeof archiveId === 'undefined') { throw new AppwriteException('Missing required parameter: "archiveId"'); @@ -664,9 +672,6 @@ export class Backups { if (typeof newResourceName !== 'undefined') { payload['newResourceName'] = newResourceName; } - if (typeof newSpecification !== 'undefined') { - payload['newSpecification'] = newSpecification; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/oauth-2.ts b/src/services/oauth-2.ts new file mode 100644 index 0000000..4458be3 --- /dev/null +++ b/src/services/oauth-2.ts @@ -0,0 +1,1097 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Oauth2 { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @param {string} params.authorizationDetails - Enriched `authorization_details` the user consented to, replacing what the client requested. Each entry must use a `type` the project accepts. Optional; omit to keep the originally requested details. + * @param {string} params.scope - Space-separated scopes the user consented to. Must be a subset of the scopes originally requested; identity scopes such as `openid` are always retained. Optional; omit to keep the originally requested scopes. + * @throws {AppwriteException} + * @returns {Promise} + */ + approve(params: { grantId: string, authorizationDetails?: string, scope?: string }): Promise; + /** + * Approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @param {string} authorizationDetails - Enriched `authorization_details` the user consented to, replacing what the client requested. Each entry must use a `type` the project accepts. Optional; omit to keep the originally requested details. + * @param {string} scope - Space-separated scopes the user consented to. Must be a subset of the scopes originally requested; identity scopes such as `openid` are always retained. Optional; omit to keep the originally requested scopes. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + approve(grantId: string, authorizationDetails?: string, scope?: string): Promise; + approve( + paramsOrFirst: { grantId: string, authorizationDetails?: string, scope?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { grantId: string, authorizationDetails?: string, scope?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { grantId: string, authorizationDetails?: string, scope?: string }; + } else { + params = { + grantId: paramsOrFirst as string, + authorizationDetails: rest[0] as string, + scope: rest[1] as string + }; + } + + const grantId = params.grantId; + const authorizationDetails = params.authorizationDetails; + const scope = params.scope; + + if (typeof grantId === 'undefined') { + throw new AppwriteException('Missing required parameter: "grantId"'); + } + + const apiPath = '/oauth2/{project_id}/approve'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof grantId !== 'undefined') { + payload['grant_id'] = grantId; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorization_details'] = authorizationDetails; + } + if (typeof scope !== 'undefined') { + payload['scope'] = scope; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} params.clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} params.redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} params.responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + * @param {string} params.scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + * @param {string} params.state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} params.nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} params.codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} params.codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} params.prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} params.maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + * @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} params.audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @param {string} params.requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint. + * @throws {AppwriteException} + * @returns {Promise} + */ + authorize(params?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }): Promise; + /** + * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + * @param {string} scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + * @param {string} state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + * @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @param {string} requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + authorize(clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string): Promise; + authorize( + paramsOrFirst?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; + } else { + params = { + clientId: paramsOrFirst as string, + redirectUri: rest[0] as string, + responseType: rest[1] as string, + scope: rest[2] as string, + state: rest[3] as string, + nonce: rest[4] as string, + codeChallenge: rest[5] as string, + codeChallengeMethod: rest[6] as string, + prompt: rest[7] as string, + maxAge: rest[8] as number, + authorizationDetails: rest[9] as string, + resource: rest[10] as string, + audience: rest[11] as string, + requestUri: rest[12] as string + }; + } + + const clientId = params.clientId; + const redirectUri = params.redirectUri; + const responseType = params.responseType; + const scope = params.scope; + const state = params.state; + const nonce = params.nonce; + const codeChallenge = params.codeChallenge; + const codeChallengeMethod = params.codeChallengeMethod; + const prompt = params.prompt; + const maxAge = params.maxAge; + const authorizationDetails = params.authorizationDetails; + const resource = params.resource; + const audience = params.audience; + const requestUri = params.requestUri; + + + const apiPath = '/oauth2/{project_id}/authorize'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['client_id'] = clientId; + } + if (typeof redirectUri !== 'undefined') { + payload['redirect_uri'] = redirectUri; + } + if (typeof responseType !== 'undefined') { + payload['response_type'] = responseType; + } + if (typeof scope !== 'undefined') { + payload['scope'] = scope; + } + if (typeof state !== 'undefined') { + payload['state'] = state; + } + if (typeof nonce !== 'undefined') { + payload['nonce'] = nonce; + } + if (typeof codeChallenge !== 'undefined') { + payload['code_challenge'] = codeChallenge; + } + if (typeof codeChallengeMethod !== 'undefined') { + payload['code_challenge_method'] = codeChallengeMethod; + } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } + if (typeof maxAge !== 'undefined') { + payload['max_age'] = maxAge; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorization_details'] = authorizationDetails; + } + if (typeof resource !== 'undefined') { + payload['resource'] = resource; + } + if (typeof audience !== 'undefined') { + payload['audience'] = audience; + } + if (typeof requestUri !== 'undefined') { + payload['request_uri'] = requestUri; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} params.clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} params.redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} params.responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + * @param {string} params.scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + * @param {string} params.state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} params.nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} params.codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} params.codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} params.prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} params.maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + * @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} params.audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @param {string} params.requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint. + * @throws {AppwriteException} + * @returns {Promise} + */ + authorizePost(params?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }): Promise; + /** + * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + * @param {string} scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + * @param {string} state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + * @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @param {string} requestUri - OAuth2 authorization request handle returned by the pushed authorization request endpoint. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + authorizePost(clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string): Promise; + authorizePost( + paramsOrFirst?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; + } else { + params = { + clientId: paramsOrFirst as string, + redirectUri: rest[0] as string, + responseType: rest[1] as string, + scope: rest[2] as string, + state: rest[3] as string, + nonce: rest[4] as string, + codeChallenge: rest[5] as string, + codeChallengeMethod: rest[6] as string, + prompt: rest[7] as string, + maxAge: rest[8] as number, + authorizationDetails: rest[9] as string, + resource: rest[10] as string, + audience: rest[11] as string, + requestUri: rest[12] as string + }; + } + + const clientId = params.clientId; + const redirectUri = params.redirectUri; + const responseType = params.responseType; + const scope = params.scope; + const state = params.state; + const nonce = params.nonce; + const codeChallenge = params.codeChallenge; + const codeChallengeMethod = params.codeChallengeMethod; + const prompt = params.prompt; + const maxAge = params.maxAge; + const authorizationDetails = params.authorizationDetails; + const resource = params.resource; + const audience = params.audience; + const requestUri = params.requestUri; + + + const apiPath = '/oauth2/{project_id}/authorize'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['client_id'] = clientId; + } + if (typeof redirectUri !== 'undefined') { + payload['redirect_uri'] = redirectUri; + } + if (typeof responseType !== 'undefined') { + payload['response_type'] = responseType; + } + if (typeof scope !== 'undefined') { + payload['scope'] = scope; + } + if (typeof state !== 'undefined') { + payload['state'] = state; + } + if (typeof nonce !== 'undefined') { + payload['nonce'] = nonce; + } + if (typeof codeChallenge !== 'undefined') { + payload['code_challenge'] = codeChallenge; + } + if (typeof codeChallengeMethod !== 'undefined') { + payload['code_challenge_method'] = codeChallengeMethod; + } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } + if (typeof maxAge !== 'undefined') { + payload['max_age'] = maxAge; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorization_details'] = authorizationDetails; + } + if (typeof resource !== 'undefined') { + payload['resource'] = resource; + } + if (typeof audience !== 'undefined') { + payload['audience'] = audience; + } + if (typeof requestUri !== 'undefined') { + payload['request_uri'] = requestUri; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Start the OAuth2 Device Authorization Grant. Returns the device code, user code, verification URL, expiration, and polling interval. + * + * @param {string} params.clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} params.scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`. + * @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} params.audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @throws {AppwriteException} + * @returns {Promise} + */ + createDeviceAuthorization(params?: { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string }): Promise; + /** + * Start the OAuth2 Device Authorization Grant. Returns the device code, user code, verification URL, expiration, and polling interval. + * + * @param {string} clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`. + * @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDeviceAuthorization(clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string): Promise; + createDeviceAuthorization( + paramsOrFirst?: { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string }; + } else { + params = { + clientId: paramsOrFirst as string, + scope: rest[0] as string, + authorizationDetails: rest[1] as string, + resource: rest[2] as string, + audience: rest[3] as string + }; + } + + const clientId = params.clientId; + const scope = params.scope; + const authorizationDetails = params.authorizationDetails; + const resource = params.resource; + const audience = params.audience; + + + const apiPath = '/oauth2/{project_id}/device_authorization'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['client_id'] = clientId; + } + if (typeof scope !== 'undefined') { + payload['scope'] = scope; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorization_details'] = authorizationDetails; + } + if (typeof resource !== 'undefined') { + payload['resource'] = resource; + } + if (typeof audience !== 'undefined') { + payload['audience'] = audience; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow. + * + * @param {string} params.userCode - User code displayed on the device. + * @throws {AppwriteException} + * @returns {Promise} + */ + createGrant(params: { userCode: string }): Promise; + /** + * Exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow. + * + * @param {string} userCode - User code displayed on the device. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createGrant(userCode: string): Promise; + createGrant( + paramsOrFirst: { userCode: string } | string + ): Promise { + let params: { userCode: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userCode: string }; + } else { + params = { + userCode: paramsOrFirst as string + }; + } + + const userCode = params.userCode; + + if (typeof userCode === 'undefined') { + throw new AppwriteException('Missing required parameter: "userCode"'); + } + + const apiPath = '/oauth2/{project_id}/grants'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof userCode !== 'undefined') { + payload['user_code'] = userCode; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK. + * + * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise} + */ + getGrant(params: { grantId: string }): Promise; + /** + * Get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK. + * + * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getGrant(grantId: string): Promise; + getGrant( + paramsOrFirst: { grantId: string } | string + ): Promise { + let params: { grantId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { grantId: string }; + } else { + params = { + grantId: paramsOrFirst as string + }; + } + + const grantId = params.grantId; + + if (typeof grantId === 'undefined') { + throw new AppwriteException('Missing required parameter: "grantId"'); + } + + const apiPath = '/oauth2/{project_id}/grants/{grant_id}'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))).replace('{grant_id}', encodeURIComponent(String(grantId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the organizations the OAuth2 access token can access. Resolves the token's `organization` authorization details, expanding the `*` wildcard into the concrete set of organizations the user can see. + * + * @param {number} params.limit - Maximum number of organizations to return. Between 1 and 5000. + * @param {number} params.offset - Number of organizations to skip before returning results. Used for pagination. + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + listOrganizations(params?: { limit?: number, offset?: number, search?: string }): Promise; + /** + * List the organizations the OAuth2 access token can access. Resolves the token's `organization` authorization details, expanding the `*` wildcard into the concrete set of organizations the user can see. + * + * @param {number} limit - Maximum number of organizations to return. Between 1 and 5000. + * @param {number} offset - Number of organizations to skip before returning results. Used for pagination. + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOrganizations(limit?: number, offset?: number, search?: string): Promise; + listOrganizations( + paramsOrFirst?: { limit?: number, offset?: number, search?: string } | number, + ...rest: [(number)?, (string)?] + ): Promise { + let params: { limit?: number, offset?: number, search?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { limit?: number, offset?: number, search?: string }; + } else { + params = { + limit: paramsOrFirst as number, + offset: rest[0] as number, + search: rest[1] as string + }; + } + + const limit = params.limit; + const offset = params.offset; + const search = params.search; + + + const apiPath = '/oauth2/{project_id}/organizations'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Store an OAuth2 authorization request server-side and receive a short-lived request_uri handle for the authorize endpoint. + * + * @param {string} params.clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} params.redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} params.responseType - OAuth2 / OIDC response type. + * @param {string} params.scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + * @param {string} params.state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} params.nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} params.codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} params.codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} params.prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} params.maxAge - OIDC max_age parameter for customization of consent screen. + * @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} params.audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @throws {AppwriteException} + * @returns {Promise} + */ + createPAR(params: { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string }): Promise; + /** + * Store an OAuth2 authorization request server-side and receive a short-lived request_uri handle for the authorize endpoint. + * + * @param {string} clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} responseType - OAuth2 / OIDC response type. + * @param {string} scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`, `phone`. + * @param {string} state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} maxAge - OIDC max_age parameter for customization of consent screen. + * @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @param {string} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPAR(clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string): Promise; + createPAR( + paramsOrFirst: { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string }; + } else { + params = { + clientId: paramsOrFirst as string, + redirectUri: rest[0] as string, + responseType: rest[1] as string, + scope: rest[2] as string, + state: rest[3] as string, + nonce: rest[4] as string, + codeChallenge: rest[5] as string, + codeChallengeMethod: rest[6] as string, + prompt: rest[7] as string, + maxAge: rest[8] as number, + authorizationDetails: rest[9] as string, + resource: rest[10] as string, + audience: rest[11] as string + }; + } + + const clientId = params.clientId; + const redirectUri = params.redirectUri; + const responseType = params.responseType; + const scope = params.scope; + const state = params.state; + const nonce = params.nonce; + const codeChallenge = params.codeChallenge; + const codeChallengeMethod = params.codeChallengeMethod; + const prompt = params.prompt; + const maxAge = params.maxAge; + const authorizationDetails = params.authorizationDetails; + const resource = params.resource; + const audience = params.audience; + + if (typeof clientId === 'undefined') { + throw new AppwriteException('Missing required parameter: "clientId"'); + } + if (typeof redirectUri === 'undefined') { + throw new AppwriteException('Missing required parameter: "redirectUri"'); + } + if (typeof responseType === 'undefined') { + throw new AppwriteException('Missing required parameter: "responseType"'); + } + + const apiPath = '/oauth2/{project_id}/par'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['client_id'] = clientId; + } + if (typeof redirectUri !== 'undefined') { + payload['redirect_uri'] = redirectUri; + } + if (typeof responseType !== 'undefined') { + payload['response_type'] = responseType; + } + if (typeof scope !== 'undefined') { + payload['scope'] = scope; + } + if (typeof state !== 'undefined') { + payload['state'] = state; + } + if (typeof nonce !== 'undefined') { + payload['nonce'] = nonce; + } + if (typeof codeChallenge !== 'undefined') { + payload['code_challenge'] = codeChallenge; + } + if (typeof codeChallengeMethod !== 'undefined') { + payload['code_challenge_method'] = codeChallengeMethod; + } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } + if (typeof maxAge !== 'undefined') { + payload['max_age'] = maxAge; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorization_details'] = authorizationDetails; + } + if (typeof resource !== 'undefined') { + payload['resource'] = resource; + } + if (typeof audience !== 'undefined') { + payload['audience'] = audience; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the projects the OAuth2 access token can access. Resolves the token's `project` authorization details, expanding the `*` wildcard into the concrete set of projects the user can see. + * + * @param {number} params.limit - Maximum number of projects to return. Between 1 and 5000. + * @param {number} params.offset - Number of projects to skip before returning results. Used for pagination. + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + listProjects(params?: { limit?: number, offset?: number, search?: string }): Promise; + /** + * List the projects the OAuth2 access token can access. Resolves the token's `project` authorization details, expanding the `*` wildcard into the concrete set of projects the user can see. + * + * @param {number} limit - Maximum number of projects to return. Between 1 and 5000. + * @param {number} offset - Number of projects to skip before returning results. Used for pagination. + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listProjects(limit?: number, offset?: number, search?: string): Promise; + listProjects( + paramsOrFirst?: { limit?: number, offset?: number, search?: string } | number, + ...rest: [(number)?, (string)?] + ): Promise { + let params: { limit?: number, offset?: number, search?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { limit?: number, offset?: number, search?: string }; + } else { + params = { + limit: paramsOrFirst as number, + offset: rest[0] as number, + search: rest[1] as string + }; + } + + const limit = params.limit; + const offset = params.offset; + const search = params.search; + + + const apiPath = '/oauth2/{project_id}/projects'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Reject an OAuth2 grant when the user denies consent. Returns the `redirectUrl` the end user should be sent to with an `access_denied` error. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise} + */ + reject(params: { grantId: string }): Promise; + /** + * Reject an OAuth2 grant when the user denies consent. Returns the `redirectUrl` the end user should be sent to with an `access_denied` error. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + reject(grantId: string): Promise; + reject( + paramsOrFirst: { grantId: string } | string + ): Promise { + let params: { grantId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { grantId: string }; + } else { + params = { + grantId: paramsOrFirst as string + }; + } + + const grantId = params.grantId; + + if (typeof grantId === 'undefined') { + throw new AppwriteException('Missing required parameter: "grantId"'); + } + + const apiPath = '/oauth2/{project_id}/reject'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof grantId !== 'undefined') { + payload['grant_id'] = grantId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Revoke an OAuth2 access token or refresh token. + * + * @param {string} params.token - The access or refresh token to revoke. + * @param {string} params.tokenTypeHint - Type of token to revoke (access_token or refresh_token). + * @param {string} params.clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} params.clientSecret - OAuth2 client secret. Required for confidential apps; omitted for public apps. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + revoke(params: { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string }): Promise<{}>; + /** + * Revoke an OAuth2 access token or refresh token. + * + * @param {string} token - The access or refresh token to revoke. + * @param {string} tokenTypeHint - Type of token to revoke (access_token or refresh_token). + * @param {string} clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} clientSecret - OAuth2 client secret. Required for confidential apps; omitted for public apps. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + revoke(token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string): Promise<{}>; + revoke( + paramsOrFirst: { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<{}> { + let params: { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string }; + } else { + params = { + token: paramsOrFirst as string, + tokenTypeHint: rest[0] as string, + clientId: rest[1] as string, + clientSecret: rest[2] as string + }; + } + + const token = params.token; + const tokenTypeHint = params.tokenTypeHint; + const clientId = params.clientId; + const clientSecret = params.clientSecret; + + if (typeof token === 'undefined') { + throw new AppwriteException('Missing required parameter: "token"'); + } + + const apiPath = '/oauth2/{project_id}/revoke'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof token !== 'undefined') { + payload['token'] = token; + } + if (typeof tokenTypeHint !== 'undefined') { + payload['token_type_hint'] = tokenTypeHint; + } + if (typeof clientId !== 'undefined') { + payload['client_id'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['client_secret'] = clientSecret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Exchange an OAuth2 authorization code, refresh token, or device code for access and refresh tokens. + * + * @param {string} params.grantType - OAuth2 grant type. Can be one of: `authorization_code`, `refresh_token`, `urn:ietf:params:oauth:grant-type:device_code`. + * @param {string} params.code - Authorization code to be exchanged for access and refresh tokens. Required for `authorization_code` grant type. + * @param {string} params.refreshToken - Refresh token to be exchanged for a new access and refresh tokens. Required for `refresh_token` grant type. + * @param {string} params.deviceCode - Device code obtained from the device authorization endpoint. Required for `urn:ietf:params:oauth:grant-type:device_code` grant type. + * @param {string} params.clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} params.clientSecret - OAuth2 client secret. Required for confidential apps. + * @param {string} params.codeVerifier - PKCE code verifier. Required for public apps. + * @param {string} params.redirectUri - Redirect URI. Required for `authorization_code` grant type. + * @param {string} params.resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} params.audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @throws {AppwriteException} + * @returns {Promise} + */ + createToken(params: { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string }): Promise; + /** + * Exchange an OAuth2 authorization code, refresh token, or device code for access and refresh tokens. + * + * @param {string} grantType - OAuth2 grant type. Can be one of: `authorization_code`, `refresh_token`, `urn:ietf:params:oauth:grant-type:device_code`. + * @param {string} code - Authorization code to be exchanged for access and refresh tokens. Required for `authorization_code` grant type. + * @param {string} refreshToken - Refresh token to be exchanged for a new access and refresh tokens. Required for `refresh_token` grant type. + * @param {string} deviceCode - Device code obtained from the device authorization endpoint. Required for `urn:ietf:params:oauth:grant-type:device_code` grant type. + * @param {string} clientId - OAuth2 client ID. Either a registered app ID or an HTTPS client ID metadata document URL. + * @param {string} clientSecret - OAuth2 client secret. Required for confidential apps. + * @param {string} codeVerifier - PKCE code verifier. Required for public apps. + * @param {string} redirectUri - Redirect URI. Required for `authorization_code` grant type. + * @param {string} resource - RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment. + * @param {string} audience - Compatibility alias for a single OAuth2 resource indicator URI. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createToken(grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string): Promise; + createToken( + paramsOrFirst: { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise { + let params: { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string }; + } else { + params = { + grantType: paramsOrFirst as string, + code: rest[0] as string, + refreshToken: rest[1] as string, + deviceCode: rest[2] as string, + clientId: rest[3] as string, + clientSecret: rest[4] as string, + codeVerifier: rest[5] as string, + redirectUri: rest[6] as string, + resource: rest[7] as string, + audience: rest[8] as string + }; + } + + const grantType = params.grantType; + const code = params.code; + const refreshToken = params.refreshToken; + const deviceCode = params.deviceCode; + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const codeVerifier = params.codeVerifier; + const redirectUri = params.redirectUri; + const resource = params.resource; + const audience = params.audience; + + if (typeof grantType === 'undefined') { + throw new AppwriteException('Missing required parameter: "grantType"'); + } + + const apiPath = '/oauth2/{project_id}/token'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); + const payload: Payload = {}; + if (typeof grantType !== 'undefined') { + payload['grant_type'] = grantType; + } + if (typeof code !== 'undefined') { + payload['code'] = code; + } + if (typeof refreshToken !== 'undefined') { + payload['refresh_token'] = refreshToken; + } + if (typeof deviceCode !== 'undefined') { + payload['device_code'] = deviceCode; + } + if (typeof clientId !== 'undefined') { + payload['client_id'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['client_secret'] = clientSecret; + } + if (typeof codeVerifier !== 'undefined') { + payload['code_verifier'] = codeVerifier; + } + if (typeof redirectUri !== 'undefined') { + payload['redirect_uri'] = redirectUri; + } + if (typeof resource !== 'undefined') { + payload['resource'] = resource; + } + if (typeof audience !== 'undefined') { + payload['audience'] = audience; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/organization.ts b/src/services/organization.ts index 83d4977..e286608 100644 --- a/src/services/organization.ts +++ b/src/services/organization.ts @@ -119,6 +119,301 @@ export class Organization { ); } + /** + * List app installations on the organization. Any organization member can read installations. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listInstallations(params?: { queries?: string[], total?: boolean }): Promise; + /** + * List app installations on the organization. Any organization member can read installations. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listInstallations(queries?: string[], total?: boolean): Promise; + listInstallations( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/organization/installations'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Install an app on the organization. Only organization members with the owner role can install apps. The installation is granted the scopes the app currently requests. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. The Appwrite Console stores authorized project IDs here. + * @throws {AppwriteException} + * @returns {Promise} + */ + createInstallation(params: { appId: string, authorizationDetails?: string }): Promise; + /** + * Install an app on the organization. Only organization members with the owner role can install apps. The installation is granted the scopes the app currently requests. + * + * @param {string} appId - Application unique ID. + * @param {string} authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. The Appwrite Console stores authorized project IDs here. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createInstallation(appId: string, authorizationDetails?: string): Promise; + createInstallation( + paramsOrFirst: { appId: string, authorizationDetails?: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { appId: string, authorizationDetails?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, authorizationDetails?: string }; + } else { + params = { + appId: paramsOrFirst as string, + authorizationDetails: rest[0] as string + }; + } + + const appId = params.appId; + const authorizationDetails = params.authorizationDetails; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/organization/installations'; + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorizationDetails'] = authorizationDetails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an app installation on the organization by its unique ID. Any organization member can read installations. + * + * @param {string} params.installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getInstallation(params: { installationId: string }): Promise; + /** + * Get an app installation on the organization by its unique ID. Any organization member can read installations. + * + * @param {string} installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInstallation(installationId: string): Promise; + getInstallation( + paramsOrFirst: { installationId: string } | string + ): Promise { + let params: { installationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { installationId: string }; + } else { + params = { + installationId: paramsOrFirst as string + }; + } + + const installationId = params.installationId; + + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/organization/installations/{installationId}'.replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an app installation on the organization. Only organization members with the owner role can update installations. The installation's granted scopes are refreshed to the scopes the app currently requests; previously issued installation access tokens are revoked. + * + * @param {string} params.installationId - Installation unique ID. + * @param {string} params.authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. Omit to keep the current value. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateInstallation(params: { installationId: string, authorizationDetails?: string }): Promise; + /** + * Update an app installation on the organization. Only organization members with the owner role can update installations. The installation's granted scopes are refreshed to the scopes the app currently requests; previously issued installation access tokens are revoked. + * + * @param {string} installationId - Installation unique ID. + * @param {string} authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. Omit to keep the current value. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateInstallation(installationId: string, authorizationDetails?: string): Promise; + updateInstallation( + paramsOrFirst: { installationId: string, authorizationDetails?: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { installationId: string, authorizationDetails?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { installationId: string, authorizationDetails?: string }; + } else { + params = { + installationId: paramsOrFirst as string, + authorizationDetails: rest[0] as string + }; + } + + const installationId = params.installationId; + const authorizationDetails = params.authorizationDetails; + + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/organization/installations/{installationId}'.replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + if (typeof authorizationDetails !== 'undefined') { + payload['authorizationDetails'] = authorizationDetails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Uninstall an app from the organization by its installation ID. Only organization members with the owner role can remove installations. Previously issued installation access tokens are revoked. + * + * @param {string} params.installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteInstallation(params: { installationId: string }): Promise<{}>; + /** + * Uninstall an app from the organization by its installation ID. Only organization members with the owner role can remove installations. Previously issued installation access tokens are revoked. + * + * @param {string} installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteInstallation(installationId: string): Promise<{}>; + deleteInstallation( + paramsOrFirst: { installationId: string } | string + ): Promise<{}> { + let params: { installationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { installationId: string }; + } else { + params = { + installationId: paramsOrFirst as string + }; + } + + const installationId = params.installationId; + + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/organization/installations/{installationId}'.replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + /** * Get a list of all API keys from the current organization. * diff --git a/src/services/project.ts b/src/services/project.ts index 1d79f2f..747b541 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -974,6 +974,7 @@ export class Project { * @param {number} params.refreshTokenDuration - Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. * @param {number} params.publicAccessTokenDuration - Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. * @param {number} params.publicRefreshTokenDuration - Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. + * @param {number} params.installationAccessTokenDuration - Access token duration in seconds for app installation access tokens. Leave empty to use default 1 hour. * @param {boolean} params.confidentialPkce - When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. * @param {string} params.verificationUrl - URL to your application page where users enter the device flow user code. Required to enable the Device Authorization Grant. * @param {number} params.userCodeLength - Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. @@ -983,7 +984,7 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }): Promise; + updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }): Promise; /** * Update the OAuth2 server (OIDC provider) configuration. * @@ -995,6 +996,7 @@ export class Project { * @param {number} refreshTokenDuration - Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. * @param {number} publicAccessTokenDuration - Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. * @param {number} publicRefreshTokenDuration - Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. + * @param {number} installationAccessTokenDuration - Access token duration in seconds for app installation access tokens. Leave empty to use default 1 hour. * @param {boolean} confidentialPkce - When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. * @param {string} verificationUrl - URL to your application page where users enter the device flow user code. Required to enable the Device Authorization Grant. * @param {number} userCodeLength - Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. @@ -1005,15 +1007,15 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[]): Promise; + updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[]): Promise; updateOAuth2Server( - paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] } | boolean, - ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?, (string[])?] + paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] } | boolean, + ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?, (string[])?] ): Promise { - let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; + let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; + params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; } else { params = { enabled: paramsOrFirst as boolean, @@ -1024,12 +1026,13 @@ export class Project { refreshTokenDuration: rest[4] as number, publicAccessTokenDuration: rest[5] as number, publicRefreshTokenDuration: rest[6] as number, - confidentialPkce: rest[7] as boolean, - verificationUrl: rest[8] as string, - userCodeLength: rest[9] as number, - userCodeFormat: rest[10] as string, - deviceCodeDuration: rest[11] as number, - defaultScopes: rest[12] as string[] + installationAccessTokenDuration: rest[7] as number, + confidentialPkce: rest[8] as boolean, + verificationUrl: rest[9] as string, + userCodeLength: rest[10] as number, + userCodeFormat: rest[11] as string, + deviceCodeDuration: rest[12] as number, + defaultScopes: rest[13] as string[] }; } @@ -1041,6 +1044,7 @@ export class Project { const refreshTokenDuration = params.refreshTokenDuration; const publicAccessTokenDuration = params.publicAccessTokenDuration; const publicRefreshTokenDuration = params.publicRefreshTokenDuration; + const installationAccessTokenDuration = params.installationAccessTokenDuration; const confidentialPkce = params.confidentialPkce; const verificationUrl = params.verificationUrl; const userCodeLength = params.userCodeLength; @@ -1081,6 +1085,9 @@ export class Project { if (typeof publicRefreshTokenDuration !== 'undefined') { payload['publicRefreshTokenDuration'] = publicRefreshTokenDuration; } + if (typeof installationAccessTokenDuration !== 'undefined') { + payload['installationAccessTokenDuration'] = installationAccessTokenDuration; + } if (typeof confidentialPkce !== 'undefined') { payload['confidentialPkce'] = confidentialPkce; } diff --git a/src/services/sites.ts b/src/services/sites.ts index 314650f..8fde491 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -1337,40 +1337,44 @@ export class Sites { * @param {string} params.siteId - Site ID. * @param {string} params.deploymentId - Deployment ID. * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". + * @param {string} params.token - Presigned source-download token for accessing this deployment without a session (jobs-service). * @throws {AppwriteException} * @returns {Promise} */ - getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise; + getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }): Promise; /** * 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". + * @param {string} token - Presigned source-download token for accessing this deployment without a session (jobs-service). * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): Promise; + getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string): Promise; getDeploymentDownload( - paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType } | string, - ...rest: [(string)?, (DeploymentDownloadType)?] + paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string } | string, + ...rest: [(string)?, (DeploymentDownloadType)?, (string)?] ): Promise { - let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; + let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; } else { params = { siteId: paramsOrFirst as string, deploymentId: rest[0] as string, - type: rest[1] as DeploymentDownloadType + type: rest[1] as DeploymentDownloadType, + token: rest[2] as string }; } const siteId = params.siteId; const deploymentId = params.deploymentId; const type = params.type; + const token = params.token; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); @@ -1384,6 +1388,9 @@ export class Sites { if (typeof type !== 'undefined') { payload['type'] = type; } + if (typeof token !== 'undefined') { + payload['token'] = token; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 57baaf2..70bfec6 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -90,10 +90,11 @@ export class TablesDB { * @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. * @param {string} params.specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. * @throws {AppwriteException} * @returns {Promise} */ - create(params: { databaseId: string, name: string, enabled?: boolean, specification?: string }): Promise; + create(params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }): Promise; /** * Create a new Database. * @@ -102,25 +103,27 @@ export class TablesDB { * @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. * @param {string} specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(databaseId: string, name: string, enabled?: boolean, specification?: string): Promise; + create(databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number): Promise; create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, specification?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?] + paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number } | string, + ...rest: [(string)?, (boolean)?, (string)?, (number)?] ): Promise { - let params: { databaseId: string, name: string, enabled?: boolean, specification?: string }; + let params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, specification?: string }; + params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }; } else { params = { databaseId: paramsOrFirst as string, name: rest[0] as string, enabled: rest[1] as boolean, - specification: rest[2] as string + specification: rest[2] as string, + replicas: rest[3] as number }; } @@ -128,6 +131,7 @@ export class TablesDB { const name = params.name; const enabled = params.enabled; const specification = params.specification; + const replicas = params.replicas; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -150,6 +154,9 @@ export class TablesDB { if (typeof specification !== 'undefined') { payload['specification'] = specification; } + if (typeof replicas !== 'undefined') { + payload['replicas'] = replicas; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -166,6 +173,31 @@ export class TablesDB { ); } + /** + * List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listSpecifications(): Promise { + + const apiPath = '/tablesdb/specifications'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + /** * List transactions across all databases. * @@ -569,40 +601,44 @@ export class TablesDB { * @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. + * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. * @throws {AppwriteException} * @returns {Promise} */ - update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise; + update(params: { databaseId: string, name?: string, enabled?: boolean, replicas?: number }): Promise; /** * 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. + * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name?: string, enabled?: boolean): Promise; + update(databaseId: string, name?: string, enabled?: boolean, replicas?: number): Promise; update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean, replicas?: number } | string, + ...rest: [(string)?, (boolean)?, (number)?] ): Promise { - let params: { databaseId: string, name?: string, enabled?: boolean }; + let params: { databaseId: string, name?: string, enabled?: boolean, replicas?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean, replicas?: number }; } else { params = { databaseId: paramsOrFirst as string, name: rest[0] as string, - enabled: rest[1] as boolean + enabled: rest[1] as boolean, + replicas: rest[2] as number }; } const databaseId = params.databaseId; const name = params.name; const enabled = params.enabled; + const replicas = params.replicas; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -616,6 +652,9 @@ export class TablesDB { if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } + if (typeof replicas !== 'undefined') { + payload['replicas'] = replicas; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -685,6 +724,174 @@ export class TablesDB { ); } + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + */ + createFailover(params: { databaseId: string, targetReplicaId?: string }): Promise; + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. + * + * @param {string} databaseId - Database ID. + * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFailover(databaseId: string, targetReplicaId?: string): Promise; + createFailover( + paramsOrFirst: { databaseId: string, targetReplicaId?: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, targetReplicaId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, targetReplicaId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetReplicaId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const targetReplicaId = params.targetReplicaId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}/failovers'.replace('{databaseId}', encodeURIComponent(String(databaseId))); + const payload: Payload = {}; + if (typeof targetReplicaId !== 'undefined') { + payload['targetReplicaId'] = targetReplicaId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReplicas(params: { databaseId: string }): Promise; + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReplicas(databaseId: string): Promise; + getReplicas( + 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}/replicas'.replace('{databaseId}', encodeURIComponent(String(databaseId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getStatus(params: { databaseId: string }): Promise; + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getStatus(databaseId: string): Promise; + getStatus( + 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}/status'.replace('{databaseId}', encodeURIComponent(String(databaseId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + 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. * diff --git a/src/services/teams.ts b/src/services/teams.ts index 28a9533..a194b2a 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -324,6 +324,338 @@ export class Teams { ); } + /** + * List app installations on a team. Any team member can read installations. + * + * @param {string} params.teamId - Team ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + listInstallations(params: { teamId: string, queries?: string[], total?: boolean }): Promise; + /** + * List app installations on a team. Any team member can read installations. + * + * @param {string} teamId - Team ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listInstallations(teamId: string, queries?: string[], total?: boolean): Promise; + listInstallations( + paramsOrFirst: { teamId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise { + let params: { teamId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], total?: boolean }; + } else { + params = { + teamId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const teamId = params.teamId; + const queries = params.queries; + const total = params.total; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/teams/{teamId}/installations'.replace('{teamId}', encodeURIComponent(String(teamId))); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Install an app on a team. When authenticated as a user, only team members with the owner role can install apps. Requests using an API key or in admin mode can install apps on any team. The installation is granted the scopes the app currently requests. + * + * @param {string} params.teamId - Team ID. + * @param {string} params.appId - Application unique ID. + * @param {string} params.authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. The Appwrite Console stores authorized project IDs here. + * @throws {AppwriteException} + * @returns {Promise} + */ + createInstallation(params: { teamId: string, appId: string, authorizationDetails?: string }): Promise; + /** + * Install an app on a team. When authenticated as a user, only team members with the owner role can install apps. Requests using an API key or in admin mode can install apps on any team. The installation is granted the scopes the app currently requests. + * + * @param {string} teamId - Team ID. + * @param {string} appId - Application unique ID. + * @param {string} authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. The Appwrite Console stores authorized project IDs here. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createInstallation(teamId: string, appId: string, authorizationDetails?: string): Promise; + createInstallation( + paramsOrFirst: { teamId: string, appId: string, authorizationDetails?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { teamId: string, appId: string, authorizationDetails?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, appId: string, authorizationDetails?: string }; + } else { + params = { + teamId: paramsOrFirst as string, + appId: rest[0] as string, + authorizationDetails: rest[1] as string + }; + } + + const teamId = params.teamId; + const appId = params.appId; + const authorizationDetails = params.authorizationDetails; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/teams/{teamId}/installations'.replace('{teamId}', encodeURIComponent(String(teamId))); + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorizationDetails'] = authorizationDetails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an app installation on a team by its unique ID. Any team member can read installations. + * + * @param {string} params.teamId - Team ID. + * @param {string} params.installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getInstallation(params: { teamId: string, installationId: string }): Promise; + /** + * Get an app installation on a team by its unique ID. Any team member can read installations. + * + * @param {string} teamId - Team ID. + * @param {string} installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInstallation(teamId: string, installationId: string): Promise; + getInstallation( + paramsOrFirst: { teamId: string, installationId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { teamId: string, installationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, installationId: string }; + } else { + params = { + teamId: paramsOrFirst as string, + installationId: rest[0] as string + }; + } + + const teamId = params.teamId; + const installationId = params.installationId; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/teams/{teamId}/installations/{installationId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an app installation on a team. Only team members with the owner role can update installations. The installation's granted scopes are refreshed to the scopes the app currently requests; previously issued installation access tokens are revoked. + * + * @param {string} params.teamId - Team ID. + * @param {string} params.installationId - Installation unique ID. + * @param {string} params.authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. Omit to keep the current value. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateInstallation(params: { teamId: string, installationId: string, authorizationDetails?: string }): Promise; + /** + * Update an app installation on a team. Only team members with the owner role can update installations. The installation's granted scopes are refreshed to the scopes the app currently requests; previously issued installation access tokens are revoked. + * + * @param {string} teamId - Team ID. + * @param {string} installationId - Installation unique ID. + * @param {string} authorizationDetails - Authorization details granted to the installation as a JSON array of objects, each with a `type` and app-defined fields. Omit to keep the current value. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateInstallation(teamId: string, installationId: string, authorizationDetails?: string): Promise; + updateInstallation( + paramsOrFirst: { teamId: string, installationId: string, authorizationDetails?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise { + let params: { teamId: string, installationId: string, authorizationDetails?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, installationId: string, authorizationDetails?: string }; + } else { + params = { + teamId: paramsOrFirst as string, + installationId: rest[0] as string, + authorizationDetails: rest[1] as string + }; + } + + const teamId = params.teamId; + const installationId = params.installationId; + const authorizationDetails = params.authorizationDetails; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/teams/{teamId}/installations/{installationId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + if (typeof authorizationDetails !== 'undefined') { + payload['authorizationDetails'] = authorizationDetails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Uninstall an app from a team by its installation ID. Only team members with the owner role can remove installations. Previously issued installation access tokens are revoked. + * + * @param {string} params.teamId - Team ID. + * @param {string} params.installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteInstallation(params: { teamId: string, installationId: string }): Promise<{}>; + /** + * Uninstall an app from a team by its installation ID. Only team members with the owner role can remove installations. Previously issued installation access tokens are revoked. + * + * @param {string} teamId - Team ID. + * @param {string} installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteInstallation(teamId: string, installationId: string): Promise<{}>; + deleteInstallation( + paramsOrFirst: { teamId: string, installationId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { teamId: string, installationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, installationId: string }; + } else { + params = { + teamId: paramsOrFirst as string, + installationId: rest[0] as string + }; + } + + const teamId = params.teamId; + const installationId = params.installationId; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/teams/{teamId}/installations/{installationId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + /** * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. * diff --git a/test/services/account.test.js b/test/services/account.test.js index 21537be..e541ba3 100644 --- a/test/services/account.test.js +++ b/test/services/account.test.js @@ -71,6 +71,116 @@ describe('Account', () => { expect(response).toEqual(data); }); + test('test method listConsents()', async () => { + const data = { + 'total': 5, + 'consents': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.listConsents( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getConsent()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'appId': '5e5ea5c16897e', + 'cimdUrl': 'https://example.com/.well-known/client-metadata.json', + 'scopes': [], + 'resources': [], + 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', + 'expire': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.getConsent( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteConsent()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.deleteConsent( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listConsentTokens()', async () => { + const data = { + 'total': 5, + 'tokens': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.listConsentTokens( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getConsentToken()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'consentId': '5e5ea5c16897e', + 'userId': '5e5ea5c16897e', + 'appId': '5e5ea5c16897e', + 'cimdUrl': 'https://example.com/.well-known/client-metadata.json', + 'scopes': [], + 'resources': [], + 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', + 'expire': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.getConsentToken( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteConsentToken()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.deleteConsentToken( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateEmail()', async () => { const data = { '\$id': '5e5ea5c16897e', diff --git a/test/services/activities.test.js b/test/services/activities.test.js index 2823e41..61bc596 100644 --- a/test/services/activities.test.js +++ b/test/services/activities.test.js @@ -41,10 +41,21 @@ describe('Activities', () => { 'ip': '127.0.0.1', 'mode': 'admin', 'country': 'US', + 'continentCode': 'NA', + 'city': 'Mountain View', + 'subdivisions': 'California', + 'isp': 'Google', + 'autonomousSystemNumber': '15169', + 'autonomousSystemOrganization': 'GOOGLE', + 'connectionType': 'cable', + 'connectionUsageType': 'residential', + 'connectionOrganization': 'Google LLC', 'time': '2020-10-15T06:38:00.000+00:00', 'projectId': '610fc2f985ee0', 'teamId': '610fc2f985ee0', - 'hostname': 'appwrite.io',}; + 'hostname': 'appwrite.io', + 'sdk': 'web', + 'sdkVersion': '14.0.0',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await activities.getEvent( diff --git a/test/services/apps.test.js b/test/services/apps.test.js new file mode 100644 index 0000000..34305b3 --- /dev/null +++ b/test/services/apps.test.js @@ -0,0 +1,502 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Apps } = require("../../dist/services/apps"); + +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); + +describe('Apps', () => { + const client = new Client(); + const apps = new Apps(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'apps': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Application', + 'description': 'Connect your workspace to My Application.', + 'clientUri': 'https://example.com', + 'logoUri': 'https://example.com/logo.png', + 'privacyPolicyUrl': 'https://example.com/privacy', + 'termsUrl': 'https://example.com/terms', + 'contacts': [], + 'tagline': 'Automate your workspace.', + 'tags': [], + 'labels': [], + 'images': [], + 'supportUrl': 'https://example.com/support', + 'dataDeletionUrl': 'https://example.com/data-deletion', + 'redirectUris': [], + 'postLogoutRedirectUris': [], + 'enabled': true, + 'type': 'confidential', + 'deviceFlow': true, + 'teamId': '5e5ea5c16897e', + 'userId': '5e5ea5c16897e', + 'installationScopes': [], + 'installationRedirectUrl': 'https://example.com/setup', + 'secrets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.create( + '', + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listInstallationScopes()', async () => { + const data = { + 'total': 5, + 'scopes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.listInstallationScopes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listOAuth2Scopes()', async () => { + const data = { + 'total': 5, + 'scopes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.listOAuth2Scopes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Application', + 'description': 'Connect your workspace to My Application.', + 'clientUri': 'https://example.com', + 'logoUri': 'https://example.com/logo.png', + 'privacyPolicyUrl': 'https://example.com/privacy', + 'termsUrl': 'https://example.com/terms', + 'contacts': [], + 'tagline': 'Automate your workspace.', + 'tags': [], + 'labels': [], + 'images': [], + 'supportUrl': 'https://example.com/support', + 'dataDeletionUrl': 'https://example.com/data-deletion', + 'redirectUris': [], + 'postLogoutRedirectUris': [], + 'enabled': true, + 'type': 'confidential', + 'deviceFlow': true, + 'teamId': '5e5ea5c16897e', + 'userId': '5e5ea5c16897e', + 'installationScopes': [], + 'installationRedirectUrl': 'https://example.com/setup', + 'secrets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.get( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Application', + 'description': 'Connect your workspace to My Application.', + 'clientUri': 'https://example.com', + 'logoUri': 'https://example.com/logo.png', + 'privacyPolicyUrl': 'https://example.com/privacy', + 'termsUrl': 'https://example.com/terms', + 'contacts': [], + 'tagline': 'Automate your workspace.', + 'tags': [], + 'labels': [], + 'images': [], + 'supportUrl': 'https://example.com/support', + 'dataDeletionUrl': 'https://example.com/data-deletion', + 'redirectUris': [], + 'postLogoutRedirectUris': [], + 'enabled': true, + 'type': 'confidential', + 'deviceFlow': true, + 'teamId': '5e5ea5c16897e', + 'userId': '5e5ea5c16897e', + 'installationScopes': [], + 'installationRedirectUrl': 'https://example.com/setup', + 'secrets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.update( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.delete( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listInstallations()', async () => { + const data = { + 'total': 5, + 'installations': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.listInstallations( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getInstallation()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'teamId': '5e5ea5c16897e', + 'scopes': [], + 'authorizationDetails': {}, + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.getInstallation( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createInstallationToken()', async () => { + const data = { + 'access_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...', + 'token_type': 'Bearer', + 'expires_in': 3600, + 'refresh_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', + 'scope': 'openid email profile',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.createInstallationToken( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listKeys()', async () => { + const data = { + 'total': 5, + 'keys': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.listKeys( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'secret': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + 'hint': 'f5c6c7', + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.createKey( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'secret': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + 'hint': 'f5c6c7', + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.getKey( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteKey()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.deleteKey( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLabels()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Application', + 'description': 'Connect your workspace to My Application.', + 'clientUri': 'https://example.com', + 'logoUri': 'https://example.com/logo.png', + 'privacyPolicyUrl': 'https://example.com/privacy', + 'termsUrl': 'https://example.com/terms', + 'contacts': [], + 'tagline': 'Automate your workspace.', + 'tags': [], + 'labels': [], + 'images': [], + 'supportUrl': 'https://example.com/support', + 'dataDeletionUrl': 'https://example.com/data-deletion', + 'redirectUris': [], + 'postLogoutRedirectUris': [], + 'enabled': true, + 'type': 'confidential', + 'deviceFlow': true, + 'teamId': '5e5ea5c16897e', + 'userId': '5e5ea5c16897e', + 'installationScopes': [], + 'installationRedirectUrl': 'https://example.com/setup', + 'secrets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.updateLabels( + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listSecrets()', async () => { + const data = { + 'total': 5, + 'secrets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.listSecrets( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSecret()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'secret': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + 'hint': 'f5c6c7', + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.createSecret( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getSecret()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'secret': '', + 'hint': 'f5c6c7', + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.getSecret( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteSecret()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.deleteSecret( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTeam()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Application', + 'description': 'Connect your workspace to My Application.', + 'clientUri': 'https://example.com', + 'logoUri': 'https://example.com/logo.png', + 'privacyPolicyUrl': 'https://example.com/privacy', + 'termsUrl': 'https://example.com/terms', + 'contacts': [], + 'tagline': 'Automate your workspace.', + 'tags': [], + 'labels': [], + 'images': [], + 'supportUrl': 'https://example.com/support', + 'dataDeletionUrl': 'https://example.com/data-deletion', + 'redirectUris': [], + 'postLogoutRedirectUris': [], + 'enabled': true, + 'type': 'confidential', + 'deviceFlow': true, + 'teamId': '5e5ea5c16897e', + 'userId': '5e5ea5c16897e', + 'installationScopes': [], + 'installationRedirectUrl': 'https://example.com/setup', + 'secrets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.updateTeam( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteTokens()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.deleteTokens( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/backups.test.js b/test/services/backups.test.js index 46f5814..b37c790 100644 --- a/test/services/backups.test.js +++ b/test/services/backups.test.js @@ -203,7 +203,7 @@ describe('Backups', () => { 'migrationId': 'did8jx6ws45jana098ab7', 'services': [], 'resources': [], - 'options': '{databases.database[{oldId, newId, newName, newSpecification}]}',}; + 'options': '{databases.database[{oldId, newId, newName}]}',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await backups.createRestoration( @@ -244,7 +244,7 @@ describe('Backups', () => { 'migrationId': 'did8jx6ws45jana098ab7', 'services': [], 'resources': [], - 'options': '{databases.database[{oldId, newId, newName, newSpecification}]}',}; + 'options': '{databases.database[{oldId, newId, newName}]}',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await backups.getRestoration( diff --git a/test/services/databases.test.js b/test/services/databases.test.js index 2b20a4f..e4172d2 100644 --- a/test/services/databases.test.js +++ b/test/services/databases.test.js @@ -32,9 +32,7 @@ describe('Databases', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; + 'type': 'legacy',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await databases.create( @@ -163,9 +161,7 @@ describe('Databases', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; + 'type': 'legacy',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await databases.get( @@ -185,9 +181,7 @@ describe('Databases', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; + 'type': 'legacy',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await databases.update( diff --git a/test/services/oauth2.test.js b/test/services/oauth2.test.js new file mode 100644 index 0000000..b1bf4c4 --- /dev/null +++ b/test/services/oauth2.test.js @@ -0,0 +1,224 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Oauth2 } = require("../../dist/services/oauth-2"); + +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); + +describe('Oauth2', () => { + const client = new Client(); + const oauth2 = new Oauth2(client); + + + test('test method approve()', async () => { + const data = { + 'redirectUrl': 'https://example.com/callback?code=abcde&state=fghij',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.approve( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method authorize()', async () => { + const data = { + 'grantId': '5e5ea5c16897e', + 'redirectUrl': 'https://example.com/callback?code=abcde&state=fghij',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.authorize( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method authorizePost()', async () => { + const data = { + 'grantId': '5e5ea5c16897e', + 'redirectUrl': 'https://example.com/callback?code=abcde&state=fghij',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.authorizePost( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDeviceAuthorization()', async () => { + const data = { + 'device_code': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + 'user_code': 'ABCD-EFGH', + 'verification_uri': 'https://cloud.appwrite.io/console/oauth2/device', + 'verification_uri_complete': 'https://cloud.appwrite.io/console/oauth2/device?user_code=ABCD-EFGH', + 'expires_in': 900, + 'interval': 5,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.createDeviceAuthorization( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createGrant()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'appId': '5e5ea5c16897e', + 'scopes': [], + 'resources': [], + 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', + 'prompt': 'login', + 'redirectUri': 'https://example.com/callback', + 'authTime': 1592981250, + 'expire': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.createGrant( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getGrant()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'appId': '5e5ea5c16897e', + 'scopes': [], + 'resources': [], + 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', + 'prompt': 'login', + 'redirectUri': 'https://example.com/callback', + 'authTime': 1592981250, + 'expire': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.getGrant( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listOrganizations()', async () => { + const data = { + 'total': 5, + 'organizations': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.listOrganizations( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPAR()', async () => { + const data = { + 'request_uri': 'urn:appwrite:oauth2:request:5e5ea5c16897e', + 'expires_in': 600,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.createPAR( + '', + 'https://example.com', + 'code', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listProjects()', async () => { + const data = { + 'total': 5, + 'projects': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.listProjects( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method reject()', async () => { + const data = { + 'redirectUrl': 'https://example.com/callback?error=access_denied&state=fghij',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.reject( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method revoke()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.revoke( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createToken()', async () => { + const data = { + 'access_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...', + 'token_type': 'Bearer', + 'expires_in': 3600, + 'refresh_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', + 'scope': 'openid email profile',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await oauth2.createToken( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/organization.test.js b/test/services/organization.test.js index 69a6ea4..e4d0532 100644 --- a/test/services/organization.test.js +++ b/test/services/organization.test.js @@ -118,6 +118,104 @@ describe('Organization', () => { expect(response).toEqual(data); }); + test('test method listInstallations()', async () => { + const data = { + 'total': 5, + 'installations': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.listInstallations( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createInstallation()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'teamId': '5e5ea5c16897e', + 'scopes': [], + 'authorizationDetails': {}, + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.createInstallation( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getInstallation()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'teamId': '5e5ea5c16897e', + 'scopes': [], + 'authorizationDetails': {}, + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.getInstallation( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateInstallation()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'teamId': '5e5ea5c16897e', + 'scopes': [], + 'authorizationDetails': {}, + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.updateInstallation( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteInstallation()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.deleteInstallation( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listKeys()', async () => { const data = { 'total': 5, @@ -380,7 +478,8 @@ describe('Organization', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await organization.createProject( @@ -422,7 +521,8 @@ describe('Organization', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await organization.getProject( @@ -463,7 +563,8 @@ describe('Organization', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await organization.updateProject( diff --git a/test/services/project.test.js b/test/services/project.test.js index 48aaf8e..3f535e9 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -38,7 +38,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.get( @@ -91,7 +92,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateAuthMethod( @@ -259,7 +261,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateLabels( @@ -400,7 +403,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Server( @@ -1493,7 +1497,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateDenyAliasedEmailPolicy( @@ -1534,7 +1539,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateDenyCorporateEmailPolicy( @@ -1575,7 +1581,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateDenyDisposableEmailPolicy( @@ -1616,7 +1623,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateDenyFreeEmailPolicy( @@ -1657,7 +1665,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateMembershipPrivacyPolicy( @@ -1697,7 +1706,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updatePasswordDictionaryPolicy( @@ -1738,7 +1748,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updatePasswordHistoryPolicy( @@ -1779,7 +1790,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updatePasswordPersonalDataPolicy( @@ -1839,7 +1851,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionAlertPolicy( @@ -1880,7 +1893,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionDurationPolicy( @@ -1921,7 +1935,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionInvalidationPolicy( @@ -1962,7 +1977,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSessionLimitPolicy( @@ -2003,7 +2019,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateUserLimitPolicy( @@ -2060,7 +2077,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateProtocol( @@ -2102,7 +2120,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateService( @@ -2144,7 +2163,8 @@ describe('Project', () => { 'services': [], 'protocols': [], 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateSMTP( diff --git a/test/services/tables-d-b.test.js b/test/services/tables-d-b.test.js index 513c5b7..654a20a 100644 --- a/test/services/tables-d-b.test.js +++ b/test/services/tables-d-b.test.js @@ -32,9 +32,7 @@ describe('TablesDB', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; + 'type': 'legacy',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await tablesDB.create( @@ -48,6 +46,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); + test('test method listSpecifications()', async () => { + const data = { + 'specifications': [], + 'total': 9, + 'pricing': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listSpecifications( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listTransactions()', async () => { const data = { 'total': 5, @@ -163,9 +177,7 @@ describe('TablesDB', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; + 'type': 'legacy',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await tablesDB.get( @@ -185,9 +197,7 @@ describe('TablesDB', () => { '\$createdAt': '2020-10-15T06:38:00.000+00:00', '\$updatedAt': '2020-10-15T06:38:00.000+00:00', 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; + 'type': 'legacy',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await tablesDB.update( @@ -214,6 +224,106 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); + test('test method createFailover()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'projectId': '5e5ea5c16897e', + 'name': 'My Production Database', + 'api': 'postgresql', + 'engine': 'postgresql', + 'version': '16', + 'specification': 's-2vcpu-2gb', + 'backend': 'edge', + 'hostname': 'db-myproject-mydb.fra.appwrite.center', + 'connectionPort': 5432, + 'connectionUser': 'appwrite_user', + 'connectionPassword': '••••••••', + 'connectionString': 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + 'ssl': true, + 'status': 'ready', + 'containerStatus': 'active', + 'lifecycleState': 'active', + 'idleTimeoutMinutes': 15, + 'cpu': 2000, + 'memory': 4096, + 'storage': 100, + 'storageClass': 'ssd', + 'storageMaxGb': 100, + 'nodePool': 'db-pool-4vcpu-8gb', + 'replicas': 2, + 'syncMode': 'async', + 'crossRegionReplicas': 1, + 'networkMaxConnections': 500, + 'networkIdleTimeoutSeconds': 900, + 'networkIPAllowlist': [], + 'backupEnabled': true, + 'pitr': true, + 'pitrRetentionDays': 14, + 'storageAutoscaling': true, + 'storageAutoscalingThresholdPercent': 85, + 'storageAutoscalingMaxGb': 500, + 'maintenanceWindowDay': 'sun', + 'maintenanceWindowHourUtc': 3, + 'metricsEnabled': true, + 'sqlApiEnabled': true, + 'sqlApiAllowedStatements': [], + 'sqlApiMaxRows': 10000, + 'sqlApiMaxBytes': 10485760, + 'sqlApiTimeoutSeconds': 30, + 'error': '',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createFailover( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getReplicas()', async () => { + const data = { + 'replicas': 2, + 'syncMode': 'async', + 'members': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getReplicas( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getStatus()', async () => { + const data = { + 'health': 'healthy', + 'ready': true, + 'engine': 'postgresql', + 'version': '17', + 'uptime': 86400, + 'connections': {}, + 'replicas': [], + 'volumes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getStatus( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listTables()', async () => { const data = { 'total': 5, diff --git a/test/services/teams.test.js b/test/services/teams.test.js index 0054c3e..dfa5365 100644 --- a/test/services/teams.test.js +++ b/test/services/teams.test.js @@ -101,6 +101,109 @@ describe('Teams', () => { expect(response).toEqual(data); }); + test('test method listInstallations()', async () => { + const data = { + 'total': 5, + 'installations': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.listInstallations( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createInstallation()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'teamId': '5e5ea5c16897e', + 'scopes': [], + 'authorizationDetails': {}, + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.createInstallation( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getInstallation()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'teamId': '5e5ea5c16897e', + 'scopes': [], + 'authorizationDetails': {}, + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.getInstallation( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateInstallation()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'teamId': '5e5ea5c16897e', + 'scopes': [], + 'authorizationDetails': {}, + 'createdById': '5e5ea5c16897e', + 'createdByName': 'Walter White',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.updateInstallation( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteInstallation()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.deleteInstallation( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listMemberships()', async () => { const data = { 'total': 5, From 2868e94278101cc37a2fcf28d27bcdf64e7961a9 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 23 Jul 2026 17:01:30 +0530 Subject: [PATCH 06/11] chore: update Node.js SDK to 27.1.0 --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 48121d6..9f7045d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Use Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: '24.14.1' registry-url: 'https://registry.npmjs.org' From 8f69fc5e9e2dcfadd2bfca40b630b16f28f8d47b Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 14 Aug 2026 13:41:09 +0530 Subject: [PATCH 07/11] chore: update Node.js SDK to 28.0.0 --- CHANGELOG.md | 18 + README.md | 2 +- docs/examples/activities/list-events.md | 2 +- .../apps/create-installation-token.md | 2 +- .../delete-installation.md} | 7 +- docs/examples/apps/get-installation.md | 2 +- docs/examples/apps/list-installations.md | 2 +- .../embeddings/create-text-embeddings.md | 15 + ...te-key.md => update-mfa-factors-policy.md} | 10 +- .../project/update-o-auth-2-server.md | 3 +- .../project/update-session-duration-policy.md | 2 +- .../project/update-user-limit-policy.md | 2 +- docs/examples/proxy/create-invalidation.md | 16 + docs/examples/storage/create-file.md | 3 +- docs/examples/tablesdb/create-migration.md | 16 + docs/examples/tablesdb/create.md | 3 +- docs/examples/tablesdb/cutover-migration.md | 15 + docs/examples/tablesdb/delete-migration.md | 15 + docs/examples/tablesdb/get-migration.md | 15 + docs/examples/tablesdb/list-migrations.md | 14 + docs/examples/tablesdb/list-operations.md | 17 + docs/examples/tablesdb/update.md | 4 +- docs/examples/users/get-mfa-challenge.md | 15 + package-lock.json | 621 +++++++++--------- package.json | 7 +- src/client.ts | 21 +- src/enums/authentication-factor.ts | 1 + src/enums/build-runtime.ts | 1 + src/enums/embedding-model.ts | 6 + src/enums/invalidation-type.ts | 5 + src/enums/project-key-scopes.ts | 2 + src/enums/project-policy-id.ts | 1 + src/enums/runtime.ts | 1 + src/index.ts | 3 + src/models.ts | 404 ++++++++++-- src/services/account.ts | 62 +- src/services/activities.ts | 16 +- src/services/apps.ts | 82 ++- src/services/backups.ts | 12 +- src/services/databases.ts | 16 +- src/services/embeddings.ts | 80 +++ src/services/functions.ts | 4 +- src/services/project.ts | 226 ++++--- src/services/proxy.ts | 80 +++ src/services/sites.ts | 4 +- src/services/storage.ts | 27 +- src/services/tables-db.ts | 454 ++++++++++++- src/services/users.ts | 61 ++ test/services/account.test.js | 20 +- test/services/apps.test.js | 15 + test/services/embeddings.test.js | 28 + test/services/organization.test.js | 24 - test/services/project.test.js | 66 +- test/services/proxy.test.js | 19 + test/services/storage.test.js | 6 + test/services/tables-d-b.test.js | 148 ++++- test/services/users.test.js | 26 +- 57 files changed, 2061 insertions(+), 688 deletions(-) rename docs/examples/{account/create-jwt.md => apps/delete-installation.md} (66%) create mode 100644 docs/examples/embeddings/create-text-embeddings.md rename docs/examples/project/{create-key.md => update-mfa-factors-policy.md} (63%) create mode 100644 docs/examples/proxy/create-invalidation.md create mode 100644 docs/examples/tablesdb/create-migration.md create mode 100644 docs/examples/tablesdb/cutover-migration.md create mode 100644 docs/examples/tablesdb/delete-migration.md create mode 100644 docs/examples/tablesdb/get-migration.md create mode 100644 docs/examples/tablesdb/list-migrations.md create mode 100644 docs/examples/tablesdb/list-operations.md create mode 100644 docs/examples/users/get-mfa-challenge.md create mode 100644 src/enums/embedding-model.ts create mode 100644 src/enums/invalidation-type.ts create mode 100644 src/services/embeddings.ts create mode 100644 test/services/embeddings.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index fc35853..6b5d09b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## 28.0.0 + +* Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either +* Breaking: removed `project.createKey`. A leaked key could mint further hidden keys, making a compromise far harder to contain and revoke +* Breaking: `activities.listEvents` `queries` now takes an array instead of a string +* Added: `embeddings` service with `createTextEmbeddings`, plus the `EmbeddingModel` enum +* Added: TablesDB migration methods `listMigrations`, `createMigration`, `getMigration`, `deleteMigration`, `cutoverMigration`, and `listOperations` +* Added: `proxy.createInvalidation` for purging cached edge responses, plus the `InvalidationType` enum +* Added: `apps.deleteInstallation` +* Added: `users.getMFAChallenge` and the `MfaChallengeSecret` model +* Added: `project.updateMFAFactorsPolicy` and the `PolicyMfaFactors` model +* Added: `client.setOrganization` for organization-scoped requests +* Added: `folder` parameter to `storage.createFile` +* Added: `syncMode` parameter to `tablesDB.create` and `tablesDB.update`, and `specification` to `tablesDB.update` +* Added: `installationScopes` parameter to `project.updateOAuth2Server` +* Added: `custom` authentication factor, `node-26` runtime, `mfa-factors` project policy, and the `embeddings.write` and `proxy.invalidations.write` key scopes +* Updated: response format to `1.9.6` + ## 27.1.0 * Added: `Apps` service for managing OAuth2 applications, keys, and installations diff --git a/README.md b/README.md index 62fd49f..714b8bd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Node.js SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.6-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md index 11407e8..9926395 100644 --- a/docs/examples/activities/list-events.md +++ b/docs/examples/activities/list-events.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const activities = new sdk.Activities(client); const result = await activities.listEvents({ - queries: '' // optional + queries: [] // optional }); ``` diff --git a/docs/examples/apps/create-installation-token.md b/docs/examples/apps/create-installation-token.md index f60d495..2b41452 100644 --- a/docs/examples/apps/create-installation-token.md +++ b/docs/examples/apps/create-installation-token.md @@ -4,7 +4,7 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID - .setKey(''); // Your secret API key + .setSession(''); // The user session to authenticate with const apps = new sdk.Apps(client); diff --git a/docs/examples/account/create-jwt.md b/docs/examples/apps/delete-installation.md similarity index 66% rename from docs/examples/account/create-jwt.md rename to docs/examples/apps/delete-installation.md index c7204e0..b9933fb 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/apps/delete-installation.md @@ -6,9 +6,10 @@ const client = new sdk.Client() .setProject('') // Your project ID .setSession(''); // The user session to authenticate with -const account = new sdk.Account(client); +const apps = new sdk.Apps(client); -const result = await account.createJWT({ - duration: 0 // optional +const result = await apps.deleteInstallation({ + appId: '', + installationId: '' }); ``` diff --git a/docs/examples/apps/get-installation.md b/docs/examples/apps/get-installation.md index eb483b2..ceddee2 100644 --- a/docs/examples/apps/get-installation.md +++ b/docs/examples/apps/get-installation.md @@ -4,7 +4,7 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID - .setKey(''); // Your secret API key + .setSession(''); // The user session to authenticate with const apps = new sdk.Apps(client); diff --git a/docs/examples/apps/list-installations.md b/docs/examples/apps/list-installations.md index e410f66..4bb7197 100644 --- a/docs/examples/apps/list-installations.md +++ b/docs/examples/apps/list-installations.md @@ -4,7 +4,7 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject('') // Your project ID - .setKey(''); // Your secret API key + .setSession(''); // The user session to authenticate with const apps = new sdk.Apps(client); diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md new file mode 100644 index 0000000..5beebf5 --- /dev/null +++ b/docs/examples/embeddings/create-text-embeddings.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const embeddings = new sdk.Embeddings(client); + +const result = await embeddings.createTextEmbeddings({ + texts: [], + model: sdk.EmbeddingModel.NomicEmbedText // optional +}); +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/update-mfa-factors-policy.md similarity index 63% rename from docs/examples/project/create-key.md rename to docs/examples/project/update-mfa-factors-policy.md index 362821b..5fea996 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/update-mfa-factors-policy.md @@ -8,10 +8,10 @@ const client = new sdk.Client() const project = new sdk.Project(client); -const result = await project.createKey({ - keyId: '', - name: '', - scopes: [sdk.ProjectKeyScopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional +const result = await project.updateMFAFactorsPolicy({ + totp: false, // optional + email: false, // optional + phone: false, // optional + custom: false // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index a34a5fc..2ea2f48 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -23,6 +23,7 @@ const result = await project.updateOAuth2Server({ userCodeLength: 6, // optional userCodeFormat: 'numeric', // optional deviceCodeDuration: 60, // optional - defaultScopes: [] // optional + defaultScopes: [], // optional + installationScopes: [] // optional }); ``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md index 2a4873b..35ae13d 100644 --- a/docs/examples/project/update-session-duration-policy.md +++ b/docs/examples/project/update-session-duration-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateSessionDurationPolicy({ - duration: 5 + duration: 60 }); ``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md index bb37204..a631e0f 100644 --- a/docs/examples/project/update-user-limit-policy.md +++ b/docs/examples/project/update-user-limit-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateUserLimitPolicy({ - total: 1 + total: 0 }); ``` diff --git a/docs/examples/proxy/create-invalidation.md b/docs/examples/proxy/create-invalidation.md new file mode 100644 index 0000000..8239fc4 --- /dev/null +++ b/docs/examples/proxy/create-invalidation.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.createInvalidation({ + domain: '', + type: sdk.InvalidationType.Tag, + reference: '' // optional +}); +``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 055e5ab..6a09ee7 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -13,6 +13,7 @@ const result = await storage.createFile({ bucketId: '', fileId: '', file: InputFile.fromPath('/path/to/file', 'filename'), - permissions: [sdk.Permission.read(sdk.Role.any())] // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + folder: '' // optional }); ``` diff --git a/docs/examples/tablesdb/create-migration.md b/docs/examples/tablesdb/create-migration.md new file mode 100644 index 0000000..8338b36 --- /dev/null +++ b/docs/examples/tablesdb/create-migration.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createMigration({ + databaseId: '', + specification: 's-1vcpu-1gb', + autoCutover: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 27bf661..cd18253 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -13,6 +13,7 @@ const result = await tablesDB.create({ name: '', enabled: false, // optional specification: 'serverless', // optional - replicas: 0 // optional + replicas: 0, // optional + syncMode: 'async' // optional }); ``` diff --git a/docs/examples/tablesdb/cutover-migration.md b/docs/examples/tablesdb/cutover-migration.md new file mode 100644 index 0000000..1cf0216 --- /dev/null +++ b/docs/examples/tablesdb/cutover-migration.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.cutoverMigration({ + databaseId: '', + migrationId: '' +}); +``` diff --git a/docs/examples/tablesdb/delete-migration.md b/docs/examples/tablesdb/delete-migration.md new file mode 100644 index 0000000..7a85305 --- /dev/null +++ b/docs/examples/tablesdb/delete-migration.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.deleteMigration({ + databaseId: '', + migrationId: '' +}); +``` diff --git a/docs/examples/tablesdb/get-migration.md b/docs/examples/tablesdb/get-migration.md new file mode 100644 index 0000000..8900aa6 --- /dev/null +++ b/docs/examples/tablesdb/get-migration.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getMigration({ + databaseId: '', + migrationId: '' +}); +``` diff --git a/docs/examples/tablesdb/list-migrations.md b/docs/examples/tablesdb/list-migrations.md new file mode 100644 index 0000000..c3275a5 --- /dev/null +++ b/docs/examples/tablesdb/list-migrations.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listMigrations({ + databaseId: '' +}); +``` diff --git a/docs/examples/tablesdb/list-operations.md b/docs/examples/tablesdb/list-operations.md new file mode 100644 index 0000000..62fcb0c --- /dev/null +++ b/docs/examples/tablesdb/list-operations.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listOperations({ + databaseId: '', + status: 'running', // optional + limit: 1, // optional + offset: 0 // optional +}); +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 034eb94..8be0bfd 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -12,6 +12,8 @@ const result = await tablesDB.update({ databaseId: '', name: '', // optional enabled: false, // optional - replicas: 0 // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async' // optional }); ``` diff --git a/docs/examples/users/get-mfa-challenge.md b/docs/examples/users/get-mfa-challenge.md new file mode 100644 index 0000000..b20e2c2 --- /dev/null +++ b/docs/examples/users/get-mfa-challenge.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.getMFAChallenge({ + userId: '', + challengeId: '' +}); +``` diff --git a/package-lock.json b/package-lock.json index 5e4de24..ddaddf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "node-appwrite", - "version": "27.1.0", + "version": "28.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "27.1.0", + "version": "28.0.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0", @@ -14,7 +14,7 @@ }, "devDependencies": { "@types/json-bigint": "1.0.4", - "@types/node": "26.1.1", + "@types/node": "26.2.0", "esbuild-plugin-file-path-extensions": "^2.0.0", "jest": "^30.4.2", "tslib": "2.8.1", @@ -23,7 +23,8 @@ }, "overrides": { "esbuild": "^0.28.1", - "js-yaml": "^4.2.0" + "js-yaml": "^4.2.0", + "brace-expansion": "5.0.9" } }, "node_modules/@babel/code-frame": { @@ -83,14 +84,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz", - "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==", + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", + "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.7", - "@babel/types": "^7.29.7", + "@babel/parser": "^7.29.8", + "@babel/types": "^7.29.8", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" @@ -213,13 +214,13 @@ } }, "node_modules/@babel/parser": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", - "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", + "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.29.7" + "@babel/types": "^7.29.8" }, "bin": { "parser": "bin/babel-parser.js" @@ -483,18 +484,18 @@ } }, "node_modules/@babel/traverse": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz", - "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==", + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", + "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", - "@babel/generator": "^7.29.7", + "@babel/generator": "^7.29.8", "@babel/helper-globals": "^7.29.7", - "@babel/parser": "^7.29.7", + "@babel/parser": "^7.29.8", "@babel/template": "^7.29.7", - "@babel/types": "^7.29.7", + "@babel/types": "^7.29.8", "debug": "^4.3.1" }, "engines": { @@ -502,9 +503,9 @@ } }, "node_modules/@babel/types": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", - "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", "dev": true, "license": "MIT", "dependencies": { @@ -557,9 +558,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", - "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", "cpu": [ "ppc64" ], @@ -574,9 +575,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", - "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", "cpu": [ "arm" ], @@ -591,9 +592,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", - "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", "cpu": [ "arm64" ], @@ -608,9 +609,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", - "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", "cpu": [ "x64" ], @@ -625,9 +626,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", - "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", "cpu": [ "arm64" ], @@ -642,9 +643,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", - "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", "cpu": [ "x64" ], @@ -659,9 +660,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", - "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", "cpu": [ "arm64" ], @@ -676,9 +677,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", - "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", "cpu": [ "x64" ], @@ -693,9 +694,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", - "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", "cpu": [ "arm" ], @@ -710,9 +711,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", - "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", "cpu": [ "arm64" ], @@ -727,9 +728,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", - "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", "cpu": [ "ia32" ], @@ -744,9 +745,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", - "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", "cpu": [ "loong64" ], @@ -761,9 +762,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", - "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", "cpu": [ "mips64el" ], @@ -778,9 +779,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", - "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", "cpu": [ "ppc64" ], @@ -795,9 +796,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", - "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", "cpu": [ "riscv64" ], @@ -812,9 +813,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", - "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", "cpu": [ "s390x" ], @@ -829,9 +830,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", - "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", "cpu": [ "x64" ], @@ -846,9 +847,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", - "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", "cpu": [ "arm64" ], @@ -863,9 +864,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", - "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", "cpu": [ "x64" ], @@ -880,9 +881,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", - "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", "cpu": [ "arm64" ], @@ -897,9 +898,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", - "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", "cpu": [ "x64" ], @@ -914,9 +915,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", - "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", "cpu": [ "arm64" ], @@ -931,9 +932,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", - "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", "cpu": [ "x64" ], @@ -948,9 +949,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", - "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", "cpu": [ "arm64" ], @@ -965,9 +966,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", - "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", "cpu": [ "ia32" ], @@ -982,9 +983,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", - "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", "cpu": [ "x64" ], @@ -1434,23 +1435,46 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, "node_modules/@napi-rs/wasm-runtime": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", - "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.2.tgz", + "integrity": "sha512-JfB4kuJQjaoHuCTseIINHtHWeJnvgEcxjwA5t/Y00ZgaOO1Crz3fjT/p8kT28zA/Caz7oiUMn3d6H2yOVCVwuw==", "dev": true, "license": "MIT", "optional": true, "dependencies": { "@tybys/wasm-util": "^0.10.3" }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, "funding": { "type": "github", "url": "https://github.com/sponsors/Brooooooklyn" }, "peerDependencies": { - "@emnapi/core": "^1.7.1", - "@emnapi/runtime": "^1.7.1" + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" } }, "node_modules/@pkgjs/parseargs": { @@ -1478,9 +1502,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz", - "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.4.tgz", + "integrity": "sha512-RrPokAb7dmbxFoeO3TloqHyOjgye8RkBhSqmp4aJMIex4c9r46ZstPnleDQOq1t46VOVjwIuwNogIqbodV1Vvg==", "cpu": [ "arm" ], @@ -1492,9 +1516,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz", - "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.4.tgz", + "integrity": "sha512-JKuJc+pnpks2pjy7L/N3v/cAkZxYlnmuZoD840ldbMI5KDbC4iO9NKwPKYdjYFCMAIIlBzYSFHxIJVYzRo2/8A==", "cpu": [ "arm64" ], @@ -1506,9 +1530,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz", - "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.4.tgz", + "integrity": "sha512-krw5uS2STmvJ02x0uTXHbqQNuz+9eZ1iw+qXk9dmW2gvV4jV7O2hEoOnuhFrpOPiel1mBFtqbxYZZtC46hXLOw==", "cpu": [ "arm64" ], @@ -1520,9 +1544,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz", - "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.4.tgz", + "integrity": "sha512-wsTxtgApb4PrOsNJIm0FZ1h3WvCC+k9uxLJ4ad75hgoS4NiRes2SoJFlDAyMwiUY8IssDqGcHbXuN0sx1tfF1A==", "cpu": [ "x64" ], @@ -1534,9 +1558,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz", - "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.4.tgz", + "integrity": "sha512-GUOnQlyZe3yAXhWOtOMsn5Qkrv5E5mZXa0thbARWi5Ei2szlVXJFQhddZ4HbAzh8q92w5twp+CQvs/eFanz9YQ==", "cpu": [ "arm64" ], @@ -1548,9 +1572,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz", - "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.4.tgz", + "integrity": "sha512-/Y7f3QuxjzPKsjA/rfEDa3+0vXqyjmJ50Ln8dPpCmWkKTrUoWHG1cWhTqaAMLob2m2nESWuC7yGrREz019Ztqg==", "cpu": [ "x64" ], @@ -1562,9 +1586,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz", - "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.4.tgz", + "integrity": "sha512-81wiiX3v7aqy+T+bT61TJ78yJjRquqFFTTbAPt08imfQQzkPIW8t6aJbkTagtCCrXMNc9D66+geqlK7ydLPNqA==", "cpu": [ "arm" ], @@ -1579,9 +1603,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz", - "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.4.tgz", + "integrity": "sha512-9kmDIvNZqdoHOBZgNtpTBeLWYO/LVipM3H/j62P8848/l/VPEQL6N3uxU9pvP1oZAsXyC2MEnFP3ovRjo7WYNQ==", "cpu": [ "arm" ], @@ -1596,9 +1620,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz", - "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.4.tgz", + "integrity": "sha512-CcnXHWnXg69g+DX5VWL3FHts3qMRN2uVEHX+BZvGLdd07/gXkn3ePjYtO1LDJvxkGKVHMclKBRa1QUTH+6toYQ==", "cpu": [ "arm64" ], @@ -1613,9 +1637,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz", - "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.4.tgz", + "integrity": "sha512-iFOibiHnTRuhrWLlRsOQFdZJJIa7S8OwkneJr4ocALP16u5yk6lWLINFwhHaEqBFMsKDUZofLkGos7+CPzGB3g==", "cpu": [ "arm64" ], @@ -1630,9 +1654,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz", - "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.4.tgz", + "integrity": "sha512-XnWYMI7euHlb5a871xPja+Gm7DRCFU+FGRrtS2sMq9N8FvqtpagUy6gD4YOemC5MRk9xbh8+jYMEJbigFQwsgA==", "cpu": [ "loong64" ], @@ -1647,9 +1671,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz", - "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.4.tgz", + "integrity": "sha512-qGDAlO0U8xedCcsdRm9oaoQY8DAx/QT7uIxJWhCdx0ceIWX783UC9QSYkdpzAe29wNiVfp24+bZdQmn49o45SQ==", "cpu": [ "loong64" ], @@ -1664,9 +1688,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz", - "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.4.tgz", + "integrity": "sha512-ru4H6ezD7ysA5EiEK6qkkaEb4modH8CTej6kUy/gQi20u3kB3G7Zn8snXXkeJSCOFKG/rbPPtM/+9Wgas1961w==", "cpu": [ "ppc64" ], @@ -1681,9 +1705,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz", - "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.4.tgz", + "integrity": "sha512-2W4MO5WQVJnbJaZdvDb9rhBDuFU1nKIepPFpJUBsTh2k1YY2g+ODViaWuyOAjQ5cOP7NvrvLzt3wvHOoiAvc7w==", "cpu": [ "ppc64" ], @@ -1698,9 +1722,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz", - "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.4.tgz", + "integrity": "sha512-+fxjfuoAmVMCYV5QyjoIpu0cp5DOiOTeqYFk1AVaxGr+/ravWLX89XfQmptsoWcaVy/TGf2hexzbUOrCQIL1CQ==", "cpu": [ "riscv64" ], @@ -1715,9 +1739,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz", - "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.4.tgz", + "integrity": "sha512-jTn8JfHGL4djjFxPuM06LmNUJDsst2jeVlsd9OmIH6zc5sC9K6rIuO4YajXatLUpBmBKl6b35ro1QZocLi+tcA==", "cpu": [ "riscv64" ], @@ -1732,9 +1756,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz", - "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.4.tgz", + "integrity": "sha512-oCJCJL4pXsoDcP2QZ+JVlPTIRc6266zsIaeJJsWImmF7HO0W8nb6HuSgZlMWxJwaPf8ehbSw8yo0EUw925hKsA==", "cpu": [ "s390x" ], @@ -1749,9 +1773,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz", - "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.4.tgz", + "integrity": "sha512-W69hukhZ3KKNRCaMIEzKvcFye42hh0FE1+YoYaf5+Ikacuftoco6yO/xouz0hc5d5W/s3yBro5jRiuEE/Q5vUw==", "cpu": [ "x64" ], @@ -1766,9 +1790,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz", - "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.4.tgz", + "integrity": "sha512-qiXbGG2jkjXhzXpsFZSR2Xpb8DN/UaxYsbb/STbuR/6fpaDgRmmaq1B/LmtF2wQFOFOSsK2jdE0RZ3a0zHn4QA==", "cpu": [ "x64" ], @@ -1783,9 +1807,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz", - "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.4.tgz", + "integrity": "sha512-nWeM//hxv8mIo6jD7Hu4o48DVmV9pbV6gsKaWU+4NFyqHoPKwrkRiZGLKUhOBk8qNmDmpwFtPKg80Bo/Tn4xiQ==", "cpu": [ "x64" ], @@ -1797,9 +1821,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz", - "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.4.tgz", + "integrity": "sha512-s62SQ/vgsRSvMwDkOEfTqfgASF0f26ZNaQuTA6Aok5lrikf89yI2W0gFHvZb2Jpgc6N8JnOKZgCK2iciO3CsxQ==", "cpu": [ "arm64" ], @@ -1811,9 +1835,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz", - "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.4.tgz", + "integrity": "sha512-J6wGf8TVGbXJq+HH+ttTvrcfNKPbuZecV6KT1B8I18BC5IURUh5kl4Yl5OEP5eFIUoI5BWxCsyYMhFsDx8kekw==", "cpu": [ "arm64" ], @@ -1825,9 +1849,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz", - "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.4.tgz", + "integrity": "sha512-zmfrQd/0wu6oJs8Vq8KwY/YtsKSsLtKe/HwAP4Wqy8LhWjeT55fHRAkOhYQ12wI3ayS4Tt12d5CDRD7N96SAYQ==", "cpu": [ "ia32" ], @@ -1839,9 +1863,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz", - "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.4.tgz", + "integrity": "sha512-qPzHqdj9rfUD+w79dtE07zi/kFwKyCJqplp5K5ygeLTp7jLpAoc16OAH39HSmRC9UpozaecsleI8uAdEj6v2yw==", "cpu": [ "x64" ], @@ -1853,9 +1877,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz", - "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.4.tgz", + "integrity": "sha512-zD6NdeWEByGE9QF9vCrlJ5YQB4oq9q91kPZS37Jwj5hOkvR1lTBSpsKhKDw4IJtbQ35LsTS1HD9DZYGKIshU1Q==", "cpu": [ "x64" ], @@ -1867,9 +1891,9 @@ ] }, "node_modules/@sinclair/typebox": { - "version": "0.34.51", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.51.tgz", - "integrity": "sha512-Nu4sNPT4G3QgAvxmdUCR/NBmsi23F2tEIcbMOZJVHS+qEgk+rmXxQikEeoKFyaX+UEggAoTvHUvIlj8MfYPzXQ==", + "version": "0.34.52", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.52.tgz", + "integrity": "sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw==", "dev": true, "license": "MIT" }, @@ -1991,9 +2015,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "26.1.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.1.tgz", - "integrity": "sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw==", + "version": "26.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.2.0.tgz", + "integrity": "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==", "dev": true, "license": "MIT", "dependencies": { @@ -2375,9 +2399,9 @@ ] }, "node_modules/acorn": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", - "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz", + "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==", "dev": true, "license": "MIT", "bin": { @@ -2573,16 +2597,19 @@ } }, "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } }, "node_modules/baseline-browser-mapping": { - "version": "2.10.42", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.42.tgz", - "integrity": "sha512-c/jurFrDLyui7o1J86yLkRu4LMsTYcBohveus7/I2Hzdn9KIP2bdJPTue/lR1KH46enoPbD77GKeSYNdyPoD3Q==", + "version": "2.11.13", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.13.tgz", + "integrity": "sha512-k9HNuUVMlqVjQ9UHzfPjIqiDbWw7WqT1AoT7GL8VwvF3r0ZfArtgiSPAlmupyNquNgOJHTuH4CKYf8ttMTWBTQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2602,19 +2629,22 @@ } }, "node_modules/brace-expansion": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.2.tgz", - "integrity": "sha512-w5JZcKgdhDOgOwm8H+KgbosopHMuGcl6qbulwjtz3SM7I7P3yW1eAjzMPLrIE+NQ9vjgANKHWeMHnrT0OXW1oA==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", "dev": true, "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0" + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" } }, "node_modules/browserslist": { - "version": "4.28.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.5.tgz", - "integrity": "sha512-Cu2E6QejHWzuDMTkuwgpABFgDfZrXLQq5V13YOACZx4mFAG4IwGTbTfHPMr4WtxlHoXSM8FIuRwYYCz5XiabaQ==", + "version": "4.28.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", + "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", "dev": true, "funding": [ { @@ -2632,11 +2662,11 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.10.42", - "caniuse-lite": "^1.0.30001800", - "electron-to-chromium": "^1.5.387", - "node-releases": "^2.0.50", - "update-browserslist-db": "^1.2.3" + "baseline-browser-mapping": "^2.11.12", + "caniuse-lite": "^1.0.30001809", + "electron-to-chromium": "^1.5.402", + "node-releases": "^2.0.53", + "update-browserslist-db": "^1.3.0" }, "bin": { "browserslist": "cli.js" @@ -2709,9 +2739,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001803", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001803.tgz", - "integrity": "sha512-g/uHREV2ZpK9qMalCsWaxmA6ol+DX8GYhuf3T40RKoP+oL7vhRJh8LNt73PCjpnR6l14FzfPrB5Yux4PKm2meg==", + "version": "1.0.30001809", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001809.tgz", + "integrity": "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ==", "dev": true, "funding": [ { @@ -2921,13 +2951,6 @@ "node": ">= 6" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, "node_modules/confbox": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", @@ -3028,9 +3051,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.389", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.389.tgz", - "integrity": "sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg==", + "version": "1.5.404", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.404.tgz", + "integrity": "sha512-3WJtd7/lVq2Jnuz6wed1l9+1ZD2u2Tet1/1NBc4Iedkmgbu+I7YuAqdAQ8T+VZtnwysMsAf3IqSq9D1gyZjA2g==", "dev": true, "license": "ISC" }, @@ -3065,9 +3088,9 @@ } }, "node_modules/esbuild": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", - "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -3078,32 +3101,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.28.1", - "@esbuild/android-arm": "0.28.1", - "@esbuild/android-arm64": "0.28.1", - "@esbuild/android-x64": "0.28.1", - "@esbuild/darwin-arm64": "0.28.1", - "@esbuild/darwin-x64": "0.28.1", - "@esbuild/freebsd-arm64": "0.28.1", - "@esbuild/freebsd-x64": "0.28.1", - "@esbuild/linux-arm": "0.28.1", - "@esbuild/linux-arm64": "0.28.1", - "@esbuild/linux-ia32": "0.28.1", - "@esbuild/linux-loong64": "0.28.1", - "@esbuild/linux-mips64el": "0.28.1", - "@esbuild/linux-ppc64": "0.28.1", - "@esbuild/linux-riscv64": "0.28.1", - "@esbuild/linux-s390x": "0.28.1", - "@esbuild/linux-x64": "0.28.1", - "@esbuild/netbsd-arm64": "0.28.1", - "@esbuild/netbsd-x64": "0.28.1", - "@esbuild/openbsd-arm64": "0.28.1", - "@esbuild/openbsd-x64": "0.28.1", - "@esbuild/openharmony-arm64": "0.28.1", - "@esbuild/sunos-x64": "0.28.1", - "@esbuild/win32-arm64": "0.28.1", - "@esbuild/win32-ia32": "0.28.1", - "@esbuild/win32-x64": "0.28.1" + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" } }, "node_modules/esbuild-plugin-file-path-extensions": { @@ -4202,9 +4225,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", - "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "dev": true, "funding": [ { @@ -4484,9 +4507,9 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.51", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz", - "integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==", + "version": "2.0.53", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.53.tgz", + "integrity": "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ==", "dev": true, "license": "MIT", "engines": { @@ -4848,9 +4871,9 @@ }, "node_modules/react-is-19": { "name": "react-is", - "version": "19.2.7", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.7.tgz", - "integrity": "sha512-kZFnouyVv7eP/Phmrlo9FK+zcAdriZJvzxXHF1Sl1P377WSGe2G/JxVolhTrB/jeV47lKImhNUsijjHAAbcl/A==", + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.8.tgz", + "integrity": "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ==", "dev": true, "license": "MIT" }, @@ -4902,9 +4925,9 @@ } }, "node_modules/rollup": { - "version": "4.62.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", - "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==", + "version": "4.62.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.4.tgz", + "integrity": "sha512-RXOqwaPsBGjMNMa4sQjDjHieHEZDFoj/Rdr46l2MU5DfEs16wHJPC2RPTPHWhNl+M3aI472LLqFkFKut4SblOg==", "dev": true, "license": "MIT", "dependencies": { @@ -4918,31 +4941,32 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.62.2", - "@rollup/rollup-android-arm64": "4.62.2", - "@rollup/rollup-darwin-arm64": "4.62.2", - "@rollup/rollup-darwin-x64": "4.62.2", - "@rollup/rollup-freebsd-arm64": "4.62.2", - "@rollup/rollup-freebsd-x64": "4.62.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.62.2", - "@rollup/rollup-linux-arm-musleabihf": "4.62.2", - "@rollup/rollup-linux-arm64-gnu": "4.62.2", - "@rollup/rollup-linux-arm64-musl": "4.62.2", - "@rollup/rollup-linux-loong64-gnu": "4.62.2", - "@rollup/rollup-linux-loong64-musl": "4.62.2", - "@rollup/rollup-linux-ppc64-gnu": "4.62.2", - "@rollup/rollup-linux-ppc64-musl": "4.62.2", - "@rollup/rollup-linux-riscv64-gnu": "4.62.2", - "@rollup/rollup-linux-riscv64-musl": "4.62.2", - "@rollup/rollup-linux-s390x-gnu": "4.62.2", - "@rollup/rollup-linux-x64-gnu": "4.62.2", - "@rollup/rollup-linux-x64-musl": "4.62.2", - "@rollup/rollup-openbsd-x64": "4.62.2", - "@rollup/rollup-openharmony-arm64": "4.62.2", - "@rollup/rollup-win32-arm64-msvc": "4.62.2", - "@rollup/rollup-win32-ia32-msvc": "4.62.2", - "@rollup/rollup-win32-x64-gnu": "4.62.2", - "@rollup/rollup-win32-x64-msvc": "4.62.2", + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.62.4", + "@rollup/rollup-android-arm64": "4.62.4", + "@rollup/rollup-darwin-arm64": "4.62.4", + "@rollup/rollup-darwin-x64": "4.62.4", + "@rollup/rollup-freebsd-arm64": "4.62.4", + "@rollup/rollup-freebsd-x64": "4.62.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.4", + "@rollup/rollup-linux-arm-musleabihf": "4.62.4", + "@rollup/rollup-linux-arm64-gnu": "4.62.4", + "@rollup/rollup-linux-arm64-musl": "4.62.4", + "@rollup/rollup-linux-loong64-gnu": "4.62.4", + "@rollup/rollup-linux-loong64-musl": "4.62.4", + "@rollup/rollup-linux-ppc64-gnu": "4.62.4", + "@rollup/rollup-linux-ppc64-musl": "4.62.4", + "@rollup/rollup-linux-riscv64-gnu": "4.62.4", + "@rollup/rollup-linux-riscv64-musl": "4.62.4", + "@rollup/rollup-linux-s390x-gnu": "4.62.4", + "@rollup/rollup-linux-x64-gnu": "4.62.4", + "@rollup/rollup-linux-x64-musl": "4.62.4", + "@rollup/rollup-openbsd-x64": "4.62.4", + "@rollup/rollup-openharmony-arm64": "4.62.4", + "@rollup/rollup-win32-arm64-msvc": "4.62.4", + "@rollup/rollup-win32-ia32-msvc": "4.62.4", + "@rollup/rollup-win32-x64-gnu": "4.62.4", + "@rollup/rollup-win32-x64-msvc": "4.62.4", "fsevents": "~2.3.2" } }, @@ -5277,17 +5301,6 @@ "node": ">=8" } }, - "node_modules/test-exclude/node_modules/brace-expansion": { - "version": "1.1.16", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", - "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/test-exclude/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -5509,9 +5522,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.27.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz", - "integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==", + "version": "6.28.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.28.0.tgz", + "integrity": "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA==", "license": "MIT", "engines": { "node": ">=18.17" @@ -5563,9 +5576,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", - "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz", + "integrity": "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 898eb6b..7187f8b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "27.1.0", + "version": "28.0.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", @@ -43,7 +43,7 @@ }, "devDependencies": { "@types/json-bigint": "1.0.4", - "@types/node": "26.1.1", + "@types/node": "26.2.0", "tsup": "^8.5.1", "esbuild-plugin-file-path-extensions": "^2.0.0", "tslib": "2.8.1", @@ -56,6 +56,7 @@ }, "overrides": { "esbuild": "^0.28.1", - "js-yaml": "^4.2.0" + "js-yaml": "^4.2.0", + "brace-expansion": "5.0.9" } } diff --git a/src/client.ts b/src/client.ts index 8051af7..3575fc6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -73,7 +73,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/27.1.0'; + let ua = 'AppwriteNodeJSSDK/28.0.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -114,6 +114,7 @@ class Client { selfSigned: false, project: '', key: '', + organization: '', jwt: '', bearer: '', locale: '', @@ -129,9 +130,9 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '27.1.0', + 'x-sdk-version': '28.0.0', 'user-agent' : getUserAgent(), - 'X-Appwrite-Response-Format': '1.9.5', + 'X-Appwrite-Response-Format': '1.9.6', }; /** @@ -232,6 +233,20 @@ class Client { this.config.key = value; return this; } + /** + * Set Organization + * + * Your organization ID + * + * @param value string + * + * @return {this} + */ + setOrganization(value: string): this { + this.headers['X-Appwrite-Organization'] = value; + this.config.organization = value; + return this; + } /** * Set JWT * diff --git a/src/enums/authentication-factor.ts b/src/enums/authentication-factor.ts index 928c407..e3260d7 100644 --- a/src/enums/authentication-factor.ts +++ b/src/enums/authentication-factor.ts @@ -3,4 +3,5 @@ export enum AuthenticationFactor { Phone = 'phone', Totp = 'totp', Recoverycode = 'recoverycode', + Custom = 'custom', } \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index 6c0f000..50f152a 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -9,6 +9,7 @@ export enum BuildRuntime { Node23 = 'node-23', Node24 = 'node-24', Node25 = 'node-25', + Node26 = 'node-26', Php80 = 'php-8.0', Php81 = 'php-8.1', Php82 = 'php-8.2', diff --git a/src/enums/embedding-model.ts b/src/enums/embedding-model.ts new file mode 100644 index 0000000..d06bb77 --- /dev/null +++ b/src/enums/embedding-model.ts @@ -0,0 +1,6 @@ +export enum EmbeddingModel { + Nomicembedtext = 'nomic-embed-text', + Embeddinggemma = 'embedding-gemma', + Allminilm = 'all-minilm', + Bgesmall = 'bge-small', +} \ No newline at end of file diff --git a/src/enums/invalidation-type.ts b/src/enums/invalidation-type.ts new file mode 100644 index 0000000..828f540 --- /dev/null +++ b/src/enums/invalidation-type.ts @@ -0,0 +1,5 @@ +export enum InvalidationType { + Tag = 'tag', + Path = 'path', + All = 'all', +} \ No newline at end of file diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts index b0ac3cd..d4b5c7c 100644 --- a/src/enums/project-key-scopes.ts +++ b/src/enums/project-key-scopes.ts @@ -33,6 +33,7 @@ export enum ProjectKeyScopes { IndexesWrite = 'indexes.write', RowsRead = 'rows.read', RowsWrite = 'rows.write', + EmbeddingsWrite = 'embeddings.write', CollectionsRead = 'collections.read', CollectionsWrite = 'collections.write', AttributesRead = 'attributes.read', @@ -97,6 +98,7 @@ export enum ProjectKeyScopes { WafRulesRead = 'wafRules.read', WafRulesWrite = 'wafRules.write', EventsRead = 'events.read', + ProxyInvalidationsWrite = 'proxy.invalidations.write', AppsRead = 'apps.read', AppsWrite = 'apps.write', Oauth2Read = 'oauth2.read', diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts index 823727a..4e287f4 100644 --- a/src/enums/project-policy-id.ts +++ b/src/enums/project-policy-id.ts @@ -9,6 +9,7 @@ export enum ProjectPolicyId { Sessionlimit = 'session-limit', Userlimit = 'user-limit', Membershipprivacy = 'membership-privacy', + Mfafactors = 'mfa-factors', Denyaliasedemail = 'deny-aliased-email', Denydisposableemail = 'deny-disposable-email', Denyfreeemail = 'deny-free-email', diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index 4061662..63e04b2 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -9,6 +9,7 @@ export enum Runtime { Node23 = 'node-23', Node24 = 'node-24', Node25 = 'node-25', + Node26 = 'node-26', Php80 = 'php-8.0', Php81 = 'php-8.1', Php82 = 'php-8.2', diff --git a/src/index.ts b/src/index.ts index 0226923..58388a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ export { Apps } from './services/apps'; export { Avatars } from './services/avatars'; export { Backups } from './services/backups'; export { Databases } from './services/databases'; +export { Embeddings } from './services/embeddings'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Locale } from './services/locale'; @@ -43,6 +44,7 @@ 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 { EmbeddingModel } from './enums/embedding-model'; export { Runtime } from './enums/runtime'; export { ProjectKeyScopes } from './enums/project-key-scopes'; export { TemplateReferenceType } from './enums/template-reference-type'; @@ -63,6 +65,7 @@ export { ProjectServiceId } from './enums/project-service-id'; export { ProjectSMTPSecure } from './enums/project-smtp-secure'; export { ProjectEmailTemplateId } from './enums/project-email-template-id'; export { ProjectEmailTemplateLocale } from './enums/project-email-template-locale'; +export { InvalidationType } from './enums/invalidation-type'; export { StatusCode } from './enums/status-code'; export { ProxyResourceType } from './enums/proxy-resource-type'; export { Framework } from './enums/framework'; diff --git a/src/models.ts b/src/models.ts index 9100284..14faf01 100644 --- a/src/models.ts +++ b/src/models.ts @@ -497,7 +497,7 @@ export namespace Models { /** * List of policies. */ - policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordStrength | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail | Models.PolicyDenyCorporateEmail)[]; + policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordStrength | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyMfaFactors | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail | Models.PolicyDenyCorporateEmail)[]; } /** @@ -640,6 +640,20 @@ export namespace Models { specifications: Specification[]; } + /** + * Embedding list + */ + export type EmbeddingList = { + /** + * Total number of embeddings that matched your query. + */ + total: number; + /** + * List of embeddings. + */ + embeddings: Embedding[]; + } + /** * Insights List */ @@ -701,7 +715,7 @@ export namespace Models { */ status?: DatabaseStatus; /** - * Underlying engine of the dedicated backing: postgresql, mysql, mariadb, or mongodb. A managed product (tablesdb, documentsdb, vectorsdb) reports the engine it runs on, so its type and engine can differ. Null when the database has no dedicated backing. + * Underlying engine of the dedicated backing: postgresql, mysql, or mongodb. A managed product (tablesdb, documentsdb, vectorsdb) reports the engine it runs on, so its type and engine can differ. Null when the database has no dedicated backing. */ engine?: string; /** @@ -722,6 +736,28 @@ export namespace Models { archives?: BackupArchive[]; } + /** + * Embedding + */ + export type Embedding = { + /** + * Embedding model used to generate embeddings. + */ + model: string; + /** + * Number of dimensions for each embedding vector. + */ + dimension: number; + /** + * Embedding vector values. If an error occurs, this will be an empty array. + */ + embedding: number[]; + /** + * Error message if embedding generation fails. Empty string if no error. + */ + error: string; + } + /** * Collection */ @@ -3427,6 +3463,14 @@ export namespace Models { * File name. */ name: string; + /** + * Virtual folder containing the file, with a trailing slash. Empty for the bucket root. + */ + folder: string; + /** + * Full virtual path of the file: the folder followed by the file name. + */ + key: string; /** * File MD5 signature. */ @@ -4347,6 +4391,10 @@ export namespace Models { * OAuth2 server scopes used when an authorization request omits the scope parameter */ oAuth2ServerDefaultScopes?: string[]; + /** + * Scopes an application may request when installed on a team + */ + oAuth2ServerInstallationScopes?: string[]; /** * OAuth2 server accepted RFC 9396 authorization_details types */ @@ -5805,6 +5853,32 @@ export namespace Models { userAccessedAt: boolean; } + /** + * Policy MFA Factors + */ + export type PolicyMfaFactors = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether TOTP can be used to complete an MFA challenge. + */ + totp: boolean; + /** + * Whether email can be used to complete an MFA challenge. + */ + email: boolean; + /** + * Whether phone (SMS) can be used to complete an MFA challenge. + */ + phone: boolean; + /** + * Whether the custom factor can be used to complete an MFA challenge. + */ + custom: boolean; + } + /** * Platform Web */ @@ -6267,6 +6341,32 @@ export namespace Models { expire: string; } + /** + * MFA Challenge Secret + */ + export type MfaChallengeSecret = { + /** + * 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; + /** + * Challenge code to be delivered to the end user through a custom channel. + */ + code: string; + } + /** * MFA Recovery Codes */ @@ -6311,6 +6411,10 @@ export namespace Models { * Can recovery code be used for MFA challenge for this account. */ recoveryCode: boolean; + /** + * Can custom factor be used for MFA challenge for this account. + */ + custom: boolean; } /** @@ -7006,7 +7110,7 @@ export namespace Models { /** * Members */ - members: number; + members?: number; /** * Webhooks */ @@ -7102,7 +7206,7 @@ export namespace Models { /** * Activity log days */ - activityLogs: number; + activityLogs?: number; /** * Usage history days */ @@ -7198,7 +7302,7 @@ export namespace Models { /** * Does plan support backup policies. */ - backupsEnabled: boolean; + backupsEnabled?: boolean; /** * Whether usage addons are calculated per project. */ @@ -7210,7 +7314,7 @@ export namespace Models { /** * How many policies does plan support */ - backupPolicies: number; + backupPolicies?: number; /** * Maximum function and site deployment size in MB */ @@ -7248,11 +7352,11 @@ export namespace Models { /** * Addon seats */ - seats: BillingPlanAddonDetails; + seats?: BillingPlanAddonDetails; /** * Addon projects */ - projects: BillingPlanAddonDetails; + projects?: BillingPlanAddonDetails; } /** @@ -7278,7 +7382,7 @@ export namespace Models { /** * Price currency */ - currency: string; + currency?: string; /** * Price */ @@ -7457,6 +7561,76 @@ export namespace Models { billingPlan: string; } + /** + * Database Migration + */ + export type DatabaseMigration = { + /** + * Database migration ID. + */ + $id: string; + /** + * Migration creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Migration update time in ISO 8601 format. + */ + $updatedAt: string; + /** + * Project ID that owns the migrating database. + */ + projectId: string; + /** + * Logical database ID being migrated. + */ + databaseId: string; + /** + * Dedicated compute specification provisioned for the migration target. + */ + specification: string; + /** + * Migration phase. Possible values: pending, provisioned, capturing, backfilling, catching_up, verifying, ready_to_cutover, cutover, soaking, done, failed, rolled_back. + */ + phase: string; + /** + * Number of times a migration step has failed and been recorded. + */ + attempt: number; + /** + * Reason the most recent migration step failed, empty while none has. + */ + lastError: string; + /** + * Number of documents still pending replication to the target. + */ + lagDocuments: number; + /** + * Time the migrated data was verified against the source in ISO 8601 format. + */ + verifiedAt: string; + /** + * Time routing was flipped to the target in ISO 8601 format. + */ + cutoverAt: string; + /** + * Time the post-cutover soak window ends in ISO 8601 format. + */ + soakUntil: string; + /** + * Whether the migration cuts over automatically once ready. Set when the migration is created and never changed afterwards, so it always reports what was asked for. + */ + autoCutover: boolean; + /** + * Whether a cutover has been requested and not yet attempted. Set by the cutover endpoint and cleared when the attempt is made, so a cutover that fails a check parks the migration again rather than retrying on its own. + */ + cutoverRequested: boolean; + /** + * Whether the migration is paused. + */ + paused: boolean; + } + /** * DedicatedDatabase */ @@ -7486,7 +7660,7 @@ export namespace Models { */ api: string; /** - * Database engine: postgresql, mysql, mariadb, or mongodb. + * Database engine: postgresql, mysql, or mongodb. Null until the backing reports one. */ engine: string; /** @@ -7506,7 +7680,7 @@ export namespace Models { */ hostname: string; /** - * Database port for connections. + * Database port for connections. Derived from the engine when the backing has not reported one yet. */ connectionPort: number; /** @@ -7582,11 +7756,7 @@ export namespace Models { */ syncMode: string; /** - * Number of cross-region replicas. Cross-region availability is enabled when greater than 0. - */ - crossRegionReplicas: number; - /** - * Maximum concurrent connections. + * Maximum concurrent client connections. This is the limit a client pool may reach; the engine's own max_connections reported by the status endpoint is a smaller backend limit the pooler multiplexes onto and does not constrain a client pool. */ networkMaxConnections: number; /** @@ -7664,7 +7834,7 @@ export namespace Models { */ export type DatabaseStatus = { /** - * Overall health status: healthy, degraded, or unhealthy. + * Overall health status: healthy, degraded, unhealthy, or unknown when nothing could be measured. */ health: string; /** @@ -7672,7 +7842,7 @@ export namespace Models { */ ready: boolean; /** - * Database engine: postgresql, mysql, mariadb, or mongodb. + * Database engine: postgresql, mysql, or mongodb. */ engine: string; /** @@ -7688,7 +7858,31 @@ export namespace Models { */ connections: DatabaseStatusConnections; /** - * List of database replicas and their status. + * Requested replication sync mode. Possible values: async, sync, quorum. Compare with effectiveSyncMode for what the primary is enforcing. + */ + syncMode: string; + /** + * Replication sync mode the primary is actually enforcing. Null when high availability is disabled or the state could not be read. + */ + effectiveSyncMode?: string; + /** + * Whether the enforced replication is weaker than the requested syncMode. + */ + syncDegraded: boolean; + /** + * Number of standby acknowledgements the primary waits for before a write is committed. + */ + syncAcknowledgements: number; + /** + * Number of standbys registered with the primary for synchronous replication. + */ + syncStandbyCount: number; + /** + * Whether the other sync fields are an engine reading rather than a recorded estimate. True when the primary answered what it is enforcing, including when that answer contradicted the record, in which case the contradicted values are replaced by the ones the engine reports. False when the reading could not be taken: the probe did not answer, there was no engine to ask, or the values describe a configuration change just applied rather than anything measured. Absent when no engine was asked at all, so an unprobed database is distinguishable from an unconfirmed one. False never means a standby was found lagging, because it is the absence of a reading rather than a negative one, so draw no conclusion about replication health from it or from a response that omits it. + */ + syncStateConfirmed?: boolean; + /** + * List of database replicas and their status. Every configured member appears, including one the backend has not brought up, which is reported as not healthy. */ replicas: DatabaseStatusReplica[]; /** @@ -7706,17 +7900,81 @@ export namespace Models { */ $id: string; /** - * Member role. Possible values: primary (accepts reads and writes), replica (read-only follower). + * Member role. Possible values: primary (accepts reads and writes), replica (read-only follower), unknown (placement not established; reported while a transition is moving or restarting the topology and this member has not been probed, so no member can be named the write target). */ role: string; /** - * Member pod status. Possible values: provisioning (pod missing or Pending), starting (Running but not Ready), active (Running and Ready), failed (Failed phase or CrashLoopBackOff container), or the lowercased pod phase reported by the cluster. + * Member pod status. Possible values: pending (configured but absent from the backend topology, so nothing is bringing it up), provisioning (pod missing or Pending), starting (Running but not Ready), active (Running and Ready), failed (Failed phase or CrashLoopBackOff container), or the lowercased pod phase reported by the cluster. */ status: string; /** - * Replication lag in seconds. + * Replication lag in seconds. Null when the lag is not known: a primary has none to report, and a member the backend has not probed has none yet. */ - lagSeconds: number; + lagSeconds?: number; + } + + /** + * Operation + */ + export type DedicatedDatabaseOperation = { + /** + * Operation ID. + */ + $id: string; + /** + * Operation creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Database ID the operation ran against. + */ + databaseId: string; + /** + * Operation type, such as provision, update, restore, pausing, resuming, failover, backup-create or cross-region-enable. + */ + type: string; + /** + * Operation status. Possible values: running (in progress), completed (finished successfully), failed (ended in an error). + */ + status: string; + /** + * Number of times this operation has been attempted. + */ + attempts: number; + /** + * Time the operation was requested, in ISO 8601 format. + */ + requestedAt?: string; + /** + * Time the operation started, in ISO 8601 format. + */ + startedAt?: string; + /** + * Time the operation reached a terminal state, in ISO 8601 format. + */ + completedAt?: string; + /** + * Machine-readable failure code. `Interrupted` marks an attempt that ended before its outcome could be confirmed. + */ + errorCode: string; + /** + * Failure message if the operation failed. + */ + errorMessage: string; + } + + /** + * OperationList + */ + export type DedicatedDatabaseOperationList = { + /** + * Total number of operations. + */ + total: number; + /** + * List of operations. + */ + operations: DedicatedDatabaseOperation[]; } /** @@ -7728,15 +7986,57 @@ export namespace Models { */ replicas: number; /** - * Replication sync mode. Possible values: async (asynchronous, fastest), sync (synchronous, strong consistency), quorum (quorum-based, majority of replicas must confirm). + * Requested replication sync mode. Possible values: async (asynchronous, fastest), sync (synchronous, strong consistency), quorum (quorum-based, majority of replicas must confirm). This is what was asked for; compare it with effectiveSyncMode for what the primary is enforcing. */ syncMode: string; + /** + * Replication sync mode the primary is actually enforcing. Null when high availability is disabled or the state could not be read. A value below the requested syncMode means writes are being acknowledged with weaker durability than configured. + */ + effectiveSyncMode?: string; + /** + * Whether the enforced replication is weaker than the requested syncMode. + */ + syncDegraded: boolean; + /** + * Number of standby acknowledgements the primary waits for before a write is committed. Zero means writes are acknowledged locally. + */ + syncAcknowledgements: number; + /** + * Number of standbys registered with the primary for synchronous replication. + */ + syncStandbyCount: number; + /** + * Whether the other sync fields are an engine reading rather than a recorded estimate. True when the primary answered what it is enforcing, including when that answer contradicted the record, in which case the contradicted values are replaced by the ones the engine reports. False when the reading could not be taken: the probe did not answer, there was no engine to ask, or the values describe a configuration change just applied rather than anything measured. Absent when no engine was asked at all, so an unprobed database is distinguishable from an unconfirmed one. False never means a standby was found lagging, because it is the absence of a reading rather than a negative one, so draw no conclusion about replication health from it or from a response that omits it. + */ + syncStateConfirmed?: boolean; /** * Per-pod statuses for the primary and every replica. */ members: DedicatedDatabaseMember[]; } + /** + * Invalidation + */ + export type ProxyInvalidation = { + /** + * Domain name. + */ + domain: string; + /** + * Invalidation type. Possible values are "tag", "path", or "all". + */ + type: string; + /** + * Invalidated reference. Depending on type this is a cache tag name, a URL path, or empty when type is all. + */ + reference: string; + /** + * Invalidation status. + */ + status: string; + } + /** * Organization */ @@ -7766,9 +8066,9 @@ export namespace Models { */ prefs: Preferences; /** - * Project budget limit + * Project budget limit. Null when no budget is set. */ - billingBudget: number; + billingBudget?: number; /** * Project budget limit */ @@ -7804,7 +8104,7 @@ export namespace Models { /** * Start date of trial. */ - billingTrialStartDate: string; + billingTrialStartDate?: string; /** * Number of trial days. */ @@ -7824,11 +8124,11 @@ export namespace Models { /** * Default payment method. */ - billingAddressId: string; + billingAddressId?: string; /** * Backup payment method. */ - backupPaymentMethodId: string; + backupPaymentMethodId?: string; /** * Team status. */ @@ -7836,27 +8136,27 @@ export namespace Models { /** * Remarks on team status. */ - remarks: string; + remarks?: string; /** * Organization agreements */ - agreementBAA: string; + agreementBAA?: string; /** * Program manager's name. */ - programManagerName: string; + programManagerName?: string; /** * Program manager's calendar link. */ - programManagerCalendar: string; + programManagerCalendar?: string; /** * Program's discord channel name. */ - programDiscordChannelName: string; + programDiscordChannelName?: string; /** * Program's discord channel URL. */ - programDiscordChannelUrl: string; + programDiscordChannelUrl?: string; /** * Billing limits reached */ @@ -7864,11 +8164,11 @@ export namespace Models { /** * Billing plan selected for downgrade. */ - billingPlanDowngrade: string; + billingPlanDowngrade?: string; /** * Tax Id */ - billingTaxId: string; + billingTaxId?: string; /** * Marked for deletion */ @@ -8161,10 +8461,6 @@ export namespace Models { * High availability replica price as a fraction of the specification cost. */ replicaRate: number; - /** - * Cross-region replica price as a fraction of the specification cost. - */ - crossRegionReplicaRate: number; /** * Point-in-time recovery price as a fraction of the specification cost. */ @@ -8180,7 +8476,7 @@ export namespace Models { */ current: number; /** - * Maximum allowed connections. + * The engine's own max_connections. On a pooled database this is the backend limit the pooler multiplexes onto, not the ceiling a client pool may reach — that is networkMaxConnections on the database resource. */ max: number; } @@ -8190,11 +8486,11 @@ export namespace Models { */ export type DatabaseStatusReplica = { /** - * StatefulSet pod index (0 = primary, 1+ = replicas). + * Member index within the database. Read `role` for which member accepts writes: a failover moves the primary without renumbering the indexes. */ index: number; /** - * Replica role: primary or replica. + * Member role. Possible values: primary (accepts reads and writes), replica (read-only follower), unknown (placement not established; reported while a transition is moving or restarting the topology, so no member can be named the write target). */ role: string; /** @@ -8244,7 +8540,7 @@ export namespace Models { /** * Member additional resources */ - member: AdditionalResource; + member?: AdditionalResource; /** * Realtime additional resources */ @@ -8256,7 +8552,7 @@ export namespace Models { /** * Realtime bandwidth additional resources */ - realtimeBandwidth: AdditionalResource; + realtimeBandwidth?: AdditionalResource; /** * Storage additional resources */ @@ -8276,7 +8572,7 @@ export namespace Models { /** * Credits additional resources */ - credits: AdditionalResource; + credits?: AdditionalResource; } /** @@ -8989,6 +9285,20 @@ export namespace Models { restorations: BackupRestoration[]; } + /** + * Database Migrations List + */ + export type DatabaseMigrationList = { + /** + * Total number of migrations that matched your query. + */ + total: number; + /** + * List of migrations. + */ + migrations: DatabaseMigration[]; + } + /** * Apps list */ diff --git a/src/services/account.ts b/src/services/account.ts index 3443e13..849902c 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -668,60 +668,6 @@ export class Account { ); } - /** - * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. - * - * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise} - */ - createJWT(params?: { duration?: number }): Promise; - /** - * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. - * - * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createJWT(duration?: number): Promise; - createJWT( - paramsOrFirst?: { duration?: number } | number - ): Promise { - let params: { duration?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { duration?: number }; - } else { - params = { - duration: paramsOrFirst as number - }; - } - - const duration = params.duration; - - - const apiPath = '/account/jwts'; - const payload: Payload = {}; - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - /** * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. * @@ -1190,7 +1136,7 @@ export class Account { /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * - * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`, `custom`. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead. @@ -1199,7 +1145,7 @@ export class Account { /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * - * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`, `custom`. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -1248,7 +1194,7 @@ export class Account { /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * - * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`, `custom`. * @throws {AppwriteException} * @returns {Promise} */ @@ -1256,7 +1202,7 @@ export class Account { /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * - * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`, `custom`. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/services/activities.ts b/src/services/activities.ts index e473154..53fca89 100644 --- a/src/services/activities.ts +++ b/src/services/activities.ts @@ -13,30 +13,30 @@ export class Activities { /** * 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. + * @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} */ - listEvents(params?: { queries?: string }): Promise; + listEvents(params?: { queries?: string[] }): Promise; /** * 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. + * @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} * @deprecated Use the object parameter style method for a better developer experience. */ - listEvents(queries?: string): Promise; + listEvents(queries?: string[]): Promise; listEvents( - paramsOrFirst?: { queries?: string } | string + paramsOrFirst?: { queries?: string[] } | string[] ): Promise { - let params: { queries?: string }; + let params: { queries?: string[] }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string }; + params = (paramsOrFirst || {}) as { queries?: string[] }; } else { params = { - queries: paramsOrFirst as string + queries: paramsOrFirst as string[] }; } diff --git a/src/services/apps.ts b/src/services/apps.ts index bdee84f..f47da03 100644 --- a/src/services/apps.ts +++ b/src/services/apps.ts @@ -314,7 +314,7 @@ export class Apps { /** * Get an application by its unique ID. * - * @param {string} params.appId - Application unique ID or HTTPS client ID metadata document URL. + * @param {string} params.appId - Application unique ID. * @throws {AppwriteException} * @returns {Promise} */ @@ -322,7 +322,7 @@ export class Apps { /** * Get an application by its unique ID. * - * @param {string} appId - Application unique ID or HTTPS client ID metadata document URL. + * @param {string} appId - Application unique ID. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -385,7 +385,7 @@ export class Apps { * @param {string[]} params.postLogoutRedirectUris - Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. * @param {boolean} params.deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - * @param {string[]} params.installationScopes - Scopes the application requests when installed on a team. Organization-level and project-level scopes only; use the list scopes endpoint with `type=installation` to discover available values. Maximum of 100 scopes are allowed. + * @param {string[]} params.installationScopes - Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed. * @param {string} params.installationRedirectUrl - URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. * @throws {AppwriteException} * @returns {Promise} @@ -412,7 +412,7 @@ export class Apps { * @param {string[]} postLogoutRedirectUris - Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list. * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. * @param {boolean} deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - * @param {string[]} installationScopes - Scopes the application requests when installed on a team. Organization-level and project-level scopes only; use the list scopes endpoint with `type=installation` to discover available values. Maximum of 100 scopes are allowed. + * @param {string[]} installationScopes - Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed. * @param {string} installationRedirectUrl - URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect. * @throws {AppwriteException} * @returns {Promise} @@ -610,7 +610,7 @@ export class Apps { } /** - * List installations of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * List installations of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. * * @param {string} params.appId - Application unique ID. * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. @@ -620,7 +620,7 @@ export class Apps { */ listInstallations(params: { appId: string, queries?: string[], total?: boolean }): Promise; /** - * List installations of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * List installations of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. * * @param {string} appId - Application unique ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. @@ -678,7 +678,7 @@ export class Apps { } /** - * Get an installation of an application by its unique ID. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * Get an installation of an application by its unique ID. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. * * @param {string} params.appId - Application unique ID. * @param {string} params.installationId - Installation unique ID. @@ -687,7 +687,7 @@ export class Apps { */ getInstallation(params: { appId: string, installationId: string }): Promise; /** - * Get an installation of an application by its unique ID. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + * Get an installation of an application by its unique ID. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. * * @param {string} appId - Application unique ID. * @param {string} installationId - Installation unique ID. @@ -739,7 +739,69 @@ export class Apps { } /** - * Create a token for an installation of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. The returned token carries the scopes and authorization details granted to the installation, and can be used as an `Authorization: Bearer` header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted. + * Delete an installation of an application by its unique ID. Requires a caller with update access to the app. Previously issued installation access tokens are revoked. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteInstallation(params: { appId: string, installationId: string }): Promise<{}>; + /** + * Delete an installation of an application by its unique ID. Requires a caller with update access to the app. Previously issued installation access tokens are revoked. + * + * @param {string} appId - Application unique ID. + * @param {string} installationId - Installation unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteInstallation(appId: string, installationId: string): Promise<{}>; + deleteInstallation( + paramsOrFirst: { appId: string, installationId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { appId: string, installationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, installationId: string }; + } else { + params = { + appId: paramsOrFirst as string, + installationId: rest[0] as string + }; + } + + const appId = params.appId; + const installationId = params.installationId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof installationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "installationId"'); + } + + const apiPath = '/apps/{appId}/installations/{installationId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{installationId}', encodeURIComponent(String(installationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a token for an installation of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. The returned token carries the scopes and authorization details granted to the installation, and can be used as an `Authorization: Bearer` header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted. * * @param {string} params.appId - Application unique ID. * @param {string} params.installationId - Installation unique ID. @@ -748,7 +810,7 @@ export class Apps { */ createInstallationToken(params: { appId: string, installationId: string }): Promise; /** - * Create a token for an installation of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. The returned token carries the scopes and authorization details granted to the installation, and can be used as an `Authorization: Bearer` header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted. + * Create a token for an installation of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. The returned token carries the scopes and authorization details granted to the installation, and can be used as an `Authorization: Bearer` header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted. * * @param {string} appId - Application unique ID. * @param {string} installationId - Installation unique ID. diff --git a/src/services/backups.ts b/src/services/backups.ts index ee83d6a..7902c67 100644 --- a/src/services/backups.ts +++ b/src/services/backups.ts @@ -591,18 +591,18 @@ export class Backups { /** * Create and trigger a new restoration for a backup on a project. * - * For a backup of one database, the restoration resolves its destination before it is queued. Pass `newResourceId` to restore into that database ID, including the archived database ID to overwrite it. When `newResourceId` is omitted, a new database ID is generated and returned in `options`. + * For a backup of one database, the restoration resolves its destination before it is queued. When `newResourceId` is omitted, the archived database is restored in place and its own ID is returned in `options`. Pass a different `newResourceId` to restore alongside it as a new database instead. * * The restoration migration records the archived database in `resourceId` and `resourceType`, and the resolved database in `destinationResourceId` and `destinationResourceType`. Database types are stored canonically as `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave these fields empty because they do not have a single source or destination database. * * To list every migration related to one database, use its canonical type in a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and destination relation pairs: `(resourceType, resourceId)`, `(parentResourceType, parentResourceId)`, and `(destinationResourceType, destinationResourceId)`. Legacy and TablesDB databases use `database`; the operational `resourceType` of a table migration is not rewritten to `tablesdb`. * - * When restoring a DocumentsDB or VectorsDB database to a new resource from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification. + * When restoring a DocumentsDB or VectorsDB database from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification and lands the data there. An in-place restore swaps the database onto that backing only once the restore has succeeded, and retires the backing it displaced only once that swap is confirmed, so the source keeps serving its own data until the restored data is in place and any failure leaves it untouched. A serverless source has no dedicated backing to clone and restores onto the archived database instead. * * * @param {string} params.archiveId - Backup archive ID to restore * @param {BackupServices[]} params.services - Array of services to restore - * @param {string} params.newResourceId - Destination resource ID. Omit to generate a new ID, or pass the archived resource ID to overwrite 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.newResourceId - Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. Valid 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} @@ -611,18 +611,18 @@ export class Backups { /** * Create and trigger a new restoration for a backup on a project. * - * For a backup of one database, the restoration resolves its destination before it is queued. Pass `newResourceId` to restore into that database ID, including the archived database ID to overwrite it. When `newResourceId` is omitted, a new database ID is generated and returned in `options`. + * For a backup of one database, the restoration resolves its destination before it is queued. When `newResourceId` is omitted, the archived database is restored in place and its own ID is returned in `options`. Pass a different `newResourceId` to restore alongside it as a new database instead. * * The restoration migration records the archived database in `resourceId` and `resourceType`, and the resolved database in `destinationResourceId` and `destinationResourceType`. Database types are stored canonically as `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave these fields empty because they do not have a single source or destination database. * * To list every migration related to one database, use its canonical type in a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and destination relation pairs: `(resourceType, resourceId)`, `(parentResourceType, parentResourceId)`, and `(destinationResourceType, destinationResourceId)`. Legacy and TablesDB databases use `database`; the operational `resourceType` of a table migration is not rewritten to `tablesdb`. * - * When restoring a DocumentsDB or VectorsDB database to a new resource from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification. + * When restoring a DocumentsDB or VectorsDB database from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification and lands the data there. An in-place restore swaps the database onto that backing only once the restore has succeeded, and retires the backing it displaced only once that swap is confirmed, so the source keeps serving its own data until the restored data is in place and any failure leaves it untouched. A serverless source has no dedicated backing to clone and restores onto the archived database instead. * * * @param {string} archiveId - Backup archive ID to restore * @param {BackupServices[]} services - Array of services to restore - * @param {string} newResourceId - Destination resource ID. Omit to generate a new ID, or pass the archived resource ID to overwrite 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} newResourceId - Destination resource ID. Omit to restore the archived resource in place, or pass a different ID to restore alongside it as a new resource. Valid 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} diff --git a/src/services/databases.ts b/src/services/databases.ts index ee501f8..6a3ee13 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -774,7 +774,7 @@ export class Databases { * @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.attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), 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} @@ -790,7 +790,7 @@ export class Databases { * @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[]} attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), 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} @@ -3825,11 +3825,11 @@ export class Databases { * @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 {RelationshipType} params.type - Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany. * @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 + * @param {RelationMutate} params.onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @throws {AppwriteException} * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. @@ -3842,11 +3842,11 @@ export class Databases { * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. * @param {string} relatedCollectionId - Related Collection ID. - * @param {RelationshipType} type - Relation type + * @param {RelationshipType} type - Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany. * @param {boolean} twoWay - Is Two Way? * @param {string} key - Attribute Key. * @param {string} twoWayKey - Two Way Attribute Key. - * @param {RelationMutate} onDelete - Constraints option + * @param {RelationMutate} onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -3938,7 +3938,7 @@ export class Databases { * @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 {RelationMutate} params.onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @param {string} params.newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} @@ -3952,7 +3952,7 @@ export class Databases { * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. * @param {string} key - Attribute Key. - * @param {RelationMutate} onDelete - Constraints option + * @param {RelationMutate} onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @param {string} newKey - New Attribute Key. * @throws {AppwriteException} * @returns {Promise} diff --git a/src/services/embeddings.ts b/src/services/embeddings.ts new file mode 100644 index 0000000..0a38c3a --- /dev/null +++ b/src/services/embeddings.ts @@ -0,0 +1,80 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { EmbeddingModel } from '../enums/embedding-model'; + +export class Embeddings { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. + * + * + * @param {string[]} params.texts - Array of text to generate embeddings. + * @param {EmbeddingModel} params.model - The embedding model to use for generating vector embeddings. + * @throws {AppwriteException} + * @returns {Promise} + */ + createTextEmbeddings(params: { texts: string[], model?: EmbeddingModel }): Promise; + /** + * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. + * + * + * @param {string[]} texts - Array of text to generate embeddings. + * @param {EmbeddingModel} model - The embedding model to use for generating vector embeddings. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextEmbeddings(texts: string[], model?: EmbeddingModel): Promise; + createTextEmbeddings( + paramsOrFirst: { texts: string[], model?: EmbeddingModel } | string[], + ...rest: [(EmbeddingModel)?] + ): Promise { + let params: { texts: string[], model?: EmbeddingModel }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { texts: string[], model?: EmbeddingModel }; + } else { + params = { + texts: paramsOrFirst as string[], + model: rest[0] as EmbeddingModel + }; + } + + const texts = params.texts; + const model = params.model; + + if (typeof texts === 'undefined') { + throw new AppwriteException('Missing required parameter: "texts"'); + } + + const apiPath = '/embeddings/text'; + const payload: Payload = {}; + if (typeof texts !== 'undefined') { + payload['texts'] = texts; + } + if (typeof model !== 'undefined') { + payload['model'] = model; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/functions.ts b/src/services/functions.ts index 9957381..66c218f 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -324,7 +324,7 @@ export class Functions { /** * List allowed function specifications for this instance. * - * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. + * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. * @throws {AppwriteException} * @returns {Promise} */ @@ -332,7 +332,7 @@ export class Functions { /** * List allowed function specifications for this instance. * - * @param {string} type - Specification type to list. Can be one of: runtimes, builds. + * @param {string} type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/services/project.ts b/src/services/project.ts index 747b541..990a230 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -196,95 +196,6 @@ export class Project { ); } - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create an ephemeral API key if you need a short-lived key instead. - * - * @param {string} params.keyId - Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - * @param {string} params.name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 200 scopes are allowed. - * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise} - */ - createKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }): Promise; - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * 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 {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 200 scopes are allowed. - * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createKey(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise; - createKey( - paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, - ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] - ): Promise { - let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; - } else { - params = { - keyId: paramsOrFirst as string, - name: rest[0] as string, - scopes: rest[1] as ProjectKeyScopes[], - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': '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. * @@ -981,10 +892,11 @@ export class Project { * @param {string} params.userCodeFormat - Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. * @param {number} params.deviceCodeDuration - Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. * @param {string[]} params.defaultScopes - List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long. + * @param {string[]} params.installationScopes - List of scopes an application may request when installed on a team. Omitting the parameter clears the list, so no installation scopes can be granted. Maximum of 100 scopes are allowed, each up to 128 characters long. * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }): Promise; + updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] }): Promise; /** * Update the OAuth2 server (OIDC provider) configuration. * @@ -1003,19 +915,20 @@ export class Project { * @param {string} userCodeFormat - Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. * @param {number} deviceCodeDuration - Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. * @param {string[]} defaultScopes - List of OAuth2 scopes used when an authorization request omits the scope parameter. Every default scope must also be allowed by the OAuth2 server. Maximum of 100 scopes are allowed, each up to 128 characters long. + * @param {string[]} installationScopes - List of scopes an application may request when installed on a team. Omitting the parameter clears the list, so no installation scopes can be granted. Maximum of 100 scopes are allowed, each up to 128 characters long. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[]): Promise; + updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[]): Promise; updateOAuth2Server( - paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] } | boolean, - ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?, (string[])?] + paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] } | boolean, + ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?, (string[])?, (string[])?] ): Promise { - let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; + let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[] }; + params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] }; } else { params = { enabled: paramsOrFirst as boolean, @@ -1032,7 +945,8 @@ export class Project { userCodeLength: rest[10] as number, userCodeFormat: rest[11] as string, deviceCodeDuration: rest[12] as number, - defaultScopes: rest[13] as string[] + defaultScopes: rest[13] as string[], + installationScopes: rest[14] as string[] }; } @@ -1051,6 +965,7 @@ export class Project { const userCodeFormat = params.userCodeFormat; const deviceCodeDuration = params.deviceCodeDuration; const defaultScopes = params.defaultScopes; + const installationScopes = params.installationScopes; if (typeof enabled === 'undefined') { throw new AppwriteException('Missing required parameter: "enabled"'); @@ -1106,6 +1021,9 @@ export class Project { if (typeof defaultScopes !== 'undefined') { payload['defaultScopes'] = defaultScopes; } + if (typeof installationScopes !== 'undefined') { + payload['installationScopes'] = installationScopes; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -5579,6 +5497,82 @@ export class Project { ); } + /** + * Updating this policy allows you to control which factors users can use to complete an MFA challenge. Disabled factors cannot be used to create a challenge and are reported as unavailable when listing factors. The custom factor is disabled by default; enable it to deliver challenge codes through your own channel. Recovery codes always remain available as a fallback. + * + * @param {boolean} params.totp - Set to true to allow TOTP to complete an MFA challenge, or false to disable it. + * @param {boolean} params.email - Set to true to allow email to complete an MFA challenge, or false to disable it. + * @param {boolean} params.phone - Set to true to allow phone (SMS) to complete an MFA challenge, or false to disable it. + * @param {boolean} params.custom - Set to true to allow the custom factor to complete an MFA challenge, or false to disable it. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMFAFactorsPolicy(params?: { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean }): Promise; + /** + * Updating this policy allows you to control which factors users can use to complete an MFA challenge. Disabled factors cannot be used to create a challenge and are reported as unavailable when listing factors. The custom factor is disabled by default; enable it to deliver challenge codes through your own channel. Recovery codes always remain available as a fallback. + * + * @param {boolean} totp - Set to true to allow TOTP to complete an MFA challenge, or false to disable it. + * @param {boolean} email - Set to true to allow email to complete an MFA challenge, or false to disable it. + * @param {boolean} phone - Set to true to allow phone (SMS) to complete an MFA challenge, or false to disable it. + * @param {boolean} custom - Set to true to allow the custom factor to complete an MFA challenge, or false to disable it. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFAFactorsPolicy(totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean): Promise; + updateMFAFactorsPolicy( + paramsOrFirst?: { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean } | boolean, + ...rest: [(boolean)?, (boolean)?, (boolean)?] + ): Promise { + let params: { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean }; + } else { + params = { + totp: paramsOrFirst as boolean, + email: rest[0] as boolean, + phone: rest[1] as boolean, + custom: rest[2] as boolean + }; + } + + const totp = params.totp; + const email = params.email; + const phone = params.phone; + const custom = params.custom; + + + const apiPath = '/project/policies/mfa-factors'; + const payload: Payload = {}; + if (typeof totp !== 'undefined') { + payload['totp'] = totp; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof phone !== 'undefined') { + payload['phone'] = phone; + } + if (typeof custom !== 'undefined') { + payload['custom'] = custom; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': '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. * @@ -5641,7 +5635,7 @@ export class Project { * * 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. + * @param {number} params.total - Set the password history length per user. Value can be between 1 and 20, or null to disable the limit. * @throws {AppwriteException} * @returns {Promise} */ @@ -5651,7 +5645,7 @@ export class Project { * * 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. + * @param {number} total - Set the password history length per user. Value can be between 1 and 20, or null to disable the limit. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -5897,7 +5891,7 @@ export class Project { /** * 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. + * @param {number} params.duration - Maximum session length in seconds. Minium allowed value is 60 seconds, and maximum is 1 year, which is 31536000 seconds. * @throws {AppwriteException} * @returns {Promise} */ @@ -5905,7 +5899,7 @@ export class 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. + * @param {number} duration - Maximum session length in seconds. Minium allowed value is 60 seconds, and maximum is 1 year, which is 31536000 seconds. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -6011,27 +6005,27 @@ export class 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} params.total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. + * @param {number} params.total - Set the maximum number of sessions allowed per user. Value can be between 1 and 100. * @throws {AppwriteException} * @returns {Promise} */ - updateSessionLimitPolicy(params: { total?: number }): Promise; + updateSessionLimitPolicy(params: { total: number }): Promise; /** * 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. + * @param {number} total - Set the maximum number of sessions allowed per user. Value can be between 1 and 100. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSessionLimitPolicy(total?: number): Promise; + updateSessionLimitPolicy(total: number): Promise; updateSessionLimitPolicy( - paramsOrFirst?: { total?: number } | number + paramsOrFirst: { total: number } | number ): Promise { - let params: { total?: number }; + let params: { total: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { total?: number }; + params = (paramsOrFirst || {}) as { total: number }; } else { params = { total: paramsOrFirst as number @@ -6068,7 +6062,7 @@ export class 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} 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. + * @param {number} params.total - Set the maximum number of users allowed in the project. Value can be between 0 and 10000. Use 0 or null to disable the limit. * @throws {AppwriteException} * @returns {Promise} */ @@ -6076,7 +6070,7 @@ export class 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. + * @param {number} total - Set the maximum number of users allowed in the project. Value can be between 0 and 10000. Use 0 or null to disable the limit. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -6125,23 +6119,23 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. + * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - getPolicy(params: { policyId: ProjectPolicyId }): Promise; + getPolicy(params: { policyId: ProjectPolicyId }): Promise; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. + * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: ProjectPolicyId): Promise; + getPolicy(policyId: ProjectPolicyId): Promise; getPolicy( paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId - ): Promise { + ): Promise { let params: { policyId: ProjectPolicyId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { diff --git a/src/services/proxy.ts b/src/services/proxy.ts index 04379aa..7858451 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -2,6 +2,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; +import { InvalidationType } from '../enums/invalidation-type'; import { StatusCode } from '../enums/status-code'; import { ProxyResourceType } from '../enums/proxy-resource-type'; @@ -12,6 +13,85 @@ export class Proxy { this.client = client; } + /** + * Create a new CDN cache invalidation for a domain. Executes a hard purge of cached content. + * + * Depending on type, the invalidation purges a single cache tag, a single URL path, or all cached content for the domain. + * + * @param {string} params.domain - Domain name. + * @param {InvalidationType} params.type - Type of reference passed. Allowed values are: tag, path, all + * @param {string} params.reference - Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all. + * @throws {AppwriteException} + * @returns {Promise} + */ + createInvalidation(params: { domain: string, type: InvalidationType, reference?: string }): Promise; + /** + * Create a new CDN cache invalidation for a domain. Executes a hard purge of cached content. + * + * Depending on type, the invalidation purges a single cache tag, a single URL path, or all cached content for the domain. + * + * @param {string} domain - Domain name. + * @param {InvalidationType} type - Type of reference passed. Allowed values are: tag, path, all + * @param {string} reference - Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createInvalidation(domain: string, type: InvalidationType, reference?: string): Promise; + createInvalidation( + paramsOrFirst: { domain: string, type: InvalidationType, reference?: string } | string, + ...rest: [(InvalidationType)?, (string)?] + ): Promise { + let params: { domain: string, type: InvalidationType, reference?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string, type: InvalidationType, reference?: string }; + } else { + params = { + domain: paramsOrFirst as string, + type: rest[0] as InvalidationType, + reference: rest[1] as string + }; + } + + const domain = params.domain; + const type = params.type; + const reference = params.reference; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/proxy/invalidations'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + /** * Get a list of all the proxy rules. You can use the query params to filter your results. * diff --git a/src/services/sites.ts b/src/services/sites.ts index 8fde491..f74f2dd 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -334,7 +334,7 @@ export class Sites { /** * List allowed site specifications for this instance. * - * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. + * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. * @throws {AppwriteException} * @returns {Promise} */ @@ -342,7 +342,7 @@ export class Sites { /** * List allowed site specifications for this instance. * - * @param {string} type - Specification type to list. Can be one of: runtimes, builds. + * @param {string} type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/services/storage.ts b/src/services/storage.ts index 7ff1932..8424bfa 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -451,7 +451,7 @@ export class Storage { * Get a list of all the user files. 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.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, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded + * @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, folder, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded * @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} @@ -462,7 +462,7 @@ export class Storage { * Get a list of all the user files. 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[]} 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, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded + * @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, folder, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded * @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} @@ -536,10 +536,11 @@ export class Storage { * @param {string} params.fileId - File 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 {File | InputFile} params.file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). * @param {string[]} params.permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.folder - Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root. * @throws {AppwriteException} * @returns {Promise} */ - createFile(params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void }): Promise; + createFile(params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void }): Promise; /** * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. * @@ -554,35 +555,38 @@ export class Storage { * @param {string} fileId - File 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 {File | InputFile} file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). * @param {string[]} permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} folder - Virtual folder to place the file in, for example "photos/2026". Nest folders with `/`. Defaults to the bucket root. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFile(bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise; + createFile(bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void): Promise; createFile( - paramsOrFirst: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(string)?, (File | InputFile)?, (string[])?,((progress: UploadProgress) => void)?] + paramsOrFirst: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(string)?, (File | InputFile)?, (string[])?, (string)?,((progress: UploadProgress) => void)?] ): Promise { - let params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[] }; + let params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string }; let onProgress: ((progress: UploadProgress) => void); if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[] }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string }; onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, file: rest[1] as File | InputFile, - permissions: rest[2] as string[] + permissions: rest[2] as string[], + folder: rest[3] as string }; - onProgress = rest[3] as ((progress: UploadProgress) => void); + onProgress = rest[4] as ((progress: UploadProgress) => void); } const bucketId = params.bucketId; const fileId = params.fileId; const file = params.file; const permissions = params.permissions; + const folder = params.folder; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -605,6 +609,9 @@ export class Storage { if (typeof permissions !== 'undefined') { payload['permissions'] = permissions; } + if (typeof folder !== 'undefined') { + payload['folder'] = folder; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 70bfec6..ab832a4 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -91,10 +91,11 @@ export class TablesDB { * @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. * @param {string} params.specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. * @throws {AppwriteException} * @returns {Promise} */ - create(params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }): Promise; + create(params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }): Promise; /** * Create a new Database. * @@ -104,26 +105,28 @@ export class TablesDB { * @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. * @param {string} specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number): Promise; + create(databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string): Promise; create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number } | string, - ...rest: [(string)?, (boolean)?, (string)?, (number)?] + paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (number)?, (string)?] ): Promise { - let params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }; + let params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number }; + params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; } else { params = { databaseId: paramsOrFirst as string, name: rest[0] as string, enabled: rest[1] as boolean, specification: rest[2] as string, - replicas: rest[3] as number + replicas: rest[3] as number, + syncMode: rest[4] as string }; } @@ -132,6 +135,7 @@ export class TablesDB { const enabled = params.enabled; const specification = params.specification; const replicas = params.replicas; + const syncMode = params.syncMode; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -157,6 +161,9 @@ export class TablesDB { if (typeof replicas !== 'undefined') { payload['replicas'] = replicas; } + if (typeof syncMode !== 'undefined') { + payload['syncMode'] = syncMode; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -601,44 +608,52 @@ export class TablesDB { * @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. + * @param {string} params.specification - Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. * @throws {AppwriteException} * @returns {Promise} */ - update(params: { databaseId: string, name?: string, enabled?: boolean, replicas?: number }): Promise; + update(params: { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }): Promise; /** * 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. + * @param {string} specification - Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name?: string, enabled?: boolean, replicas?: number): Promise; + update(databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string): Promise; update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean, replicas?: number } | string, - ...rest: [(string)?, (boolean)?, (number)?] + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (number)?, (string)?] ): Promise { - let params: { databaseId: string, name?: string, enabled?: boolean, replicas?: number }; + let params: { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean, replicas?: number }; + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; } else { params = { databaseId: paramsOrFirst as string, name: rest[0] as string, enabled: rest[1] as boolean, - replicas: rest[2] as number + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string }; } const databaseId = params.databaseId; const name = params.name; const enabled = params.enabled; + const specification = params.specification; const replicas = params.replicas; + const syncMode = params.syncMode; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -652,9 +667,15 @@ export class TablesDB { if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; } + if (typeof specification !== 'undefined') { + payload['specification'] = specification; + } if (typeof replicas !== 'undefined') { payload['replicas'] = replicas; } + if (typeof syncMode !== 'undefined') { + payload['syncMode'] = syncMode; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -725,7 +746,7 @@ export class TablesDB { } /** - * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation by a failover that did not finish also accepts this call as a repair, provided `targetReplicaId` names the member to promote. * * @param {string} params.databaseId - Database ID. * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. @@ -734,7 +755,7 @@ export class TablesDB { */ createFailover(params: { databaseId: string, targetReplicaId?: string }): Promise; /** - * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation by a failover that did not finish also accepts this call as a repair, provided `targetReplicaId` names the member to promote. * * @param {string} databaseId - Database ID. * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. @@ -786,6 +807,391 @@ export class TablesDB { ); } + /** + * List the dedicated migrations for a TablesDB database. A database has at most one in-flight migration. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listMigrations(params: { databaseId: string }): Promise; + /** + * List the dedicated migrations for a TablesDB database. A database has at most one in-flight migration. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMigrations(databaseId: string): Promise; + listMigrations( + 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}/migrations'.replace('{databaseId}', encodeURIComponent(String(databaseId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Start migrating a serverless TablesDB database onto a dedicated MySQL compute. Data is copied to the target while the source stays live, with a brief read-only window during cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.specification - Dedicated compute specification to provision as the migration target (e.g. s-2vcpu-4gb). The migration always targets a dedicated compute, so `serverless` is not accepted. + * @param {boolean} params.autoCutover - Whether to cut over automatically once the copy is verified. When disabled the migration parks at ready_to_cutover and holds there until the cutover is performed manually. + * @throws {AppwriteException} + * @returns {Promise} + */ + createMigration(params: { databaseId: string, specification: string, autoCutover?: boolean }): Promise; + /** + * Start migrating a serverless TablesDB database onto a dedicated MySQL compute. Data is copied to the target while the source stays live, with a brief read-only window during cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} specification - Dedicated compute specification to provision as the migration target (e.g. s-2vcpu-4gb). The migration always targets a dedicated compute, so `serverless` is not accepted. + * @param {boolean} autoCutover - Whether to cut over automatically once the copy is verified. When disabled the migration parks at ready_to_cutover and holds there until the cutover is performed manually. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMigration(databaseId: string, specification: string, autoCutover?: boolean): Promise; + createMigration( + paramsOrFirst: { databaseId: string, specification: string, autoCutover?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise { + let params: { databaseId: string, specification: string, autoCutover?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, specification: string, autoCutover?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + specification: rest[0] as string, + autoCutover: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const specification = params.specification; + const autoCutover = params.autoCutover; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof specification === 'undefined') { + throw new AppwriteException('Missing required parameter: "specification"'); + } + + const apiPath = '/tablesdb/{databaseId}/migrations'.replace('{databaseId}', encodeURIComponent(String(databaseId))); + const payload: Payload = {}; + if (typeof specification !== 'undefined') { + payload['specification'] = specification; + } + if (typeof autoCutover !== 'undefined') { + payload['autoCutover'] = autoCutover; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a single dedicated migration for a TablesDB database by its ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.migrationId - Migration ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getMigration(params: { databaseId: string, migrationId: string }): Promise; + /** + * Get a single dedicated migration for a TablesDB database by its ID. + * + * @param {string} databaseId - Database ID. + * @param {string} migrationId - Migration ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMigration(databaseId: string, migrationId: string): Promise; + getMigration( + paramsOrFirst: { databaseId: string, migrationId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, migrationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, migrationId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + migrationId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const migrationId = params.migrationId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof migrationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "migrationId"'); + } + + const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{migrationId}', encodeURIComponent(String(migrationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Abort an in-flight TablesDB dedicated migration. Only allowed before cutover; once the migration has cut over it cannot be aborted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.migrationId - Migration ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMigration(params: { databaseId: string, migrationId: string }): Promise<{}>; + /** + * Abort an in-flight TablesDB dedicated migration. Only allowed before cutover; once the migration has cut over it cannot be aborted. + * + * @param {string} databaseId - Database ID. + * @param {string} migrationId - Migration ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMigration(databaseId: string, migrationId: string): Promise<{}>; + deleteMigration( + paramsOrFirst: { databaseId: string, migrationId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { databaseId: string, migrationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, migrationId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + migrationId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const migrationId = params.migrationId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof migrationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "migrationId"'); + } + + const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{migrationId}', encodeURIComponent(String(migrationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Cut a verified TablesDB migration over to its dedicated compute. Only applies to a migration created with `autoCutover` disabled, which waits at `ready_to_cutover` until this is called. The routing flip happens shortly after this returns, with a brief read-only window. One call buys one attempt: a cutover that fails a check returns the migration to `verifying` and parks it again, so call this once more to retry. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.migrationId - Migration ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + cutoverMigration(params: { databaseId: string, migrationId: string }): Promise; + /** + * Cut a verified TablesDB migration over to its dedicated compute. Only applies to a migration created with `autoCutover` disabled, which waits at `ready_to_cutover` until this is called. The routing flip happens shortly after this returns, with a brief read-only window. One call buys one attempt: a cutover that fails a check returns the migration to `verifying` and parks it again, so call this once more to retry. + * + * @param {string} databaseId - Database ID. + * @param {string} migrationId - Migration ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + cutoverMigration(databaseId: string, migrationId: string): Promise; + cutoverMigration( + paramsOrFirst: { databaseId: string, migrationId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { databaseId: string, migrationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, migrationId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + migrationId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const migrationId = params.migrationId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof migrationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "migrationId"'); + } + + const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}/cutover'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{migrationId}', encodeURIComponent(String(migrationId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by operation status. + * @param {number} params.limit - Maximum number of operations to return. + * @param {number} params.offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listOperations(params: { databaseId: string, status?: string, limit?: number, offset?: number }): Promise; + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by operation status. + * @param {number} limit - Maximum number of operations to return. + * @param {number} offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOperations(databaseId: string, status?: string, limit?: number, offset?: number): Promise; + listOperations( + paramsOrFirst: { databaseId: string, status?: string, limit?: number, offset?: number } | string, + ...rest: [(string)?, (number)?, (number)?] + ): Promise { + let params: { databaseId: string, status?: string, limit?: number, offset?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, status?: string, limit?: number, offset?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + limit: rest[1] as number, + offset: rest[2] as number + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const limit = params.limit; + const offset = params.offset; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}/operations'.replace('{databaseId}', encodeURIComponent(String(databaseId))); + const payload: Payload = {}; + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof limit !== 'undefined') { + payload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + payload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + /** * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. * @@ -976,7 +1382,7 @@ export class TablesDB { * @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.columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), 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} @@ -991,7 +1397,7 @@ export class TablesDB { * @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[]} columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), 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} @@ -3994,11 +4400,11 @@ export class TablesDB { * @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 {RelationshipType} params.type - Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany. * @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 + * @param {RelationMutate} params.onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @throws {AppwriteException} * @returns {Promise} */ @@ -4010,11 +4416,11 @@ export class TablesDB { * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. * @param {string} relatedTableId - Related Table ID. - * @param {RelationshipType} type - Relation type + * @param {RelationshipType} type - Relationship type. Possible values are: oneToOne, oneToMany, manyToOne, manyToMany. * @param {boolean} twoWay - Is Two Way? * @param {string} key - Column Key. * @param {string} twoWayKey - Two Way Column Key. - * @param {RelationMutate} onDelete - Constraints option + * @param {RelationMutate} onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -5083,7 +5489,7 @@ export class TablesDB { * @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 {RelationMutate} params.onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @param {string} params.newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} @@ -5096,7 +5502,7 @@ export class TablesDB { * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. * @param {string} key - Column Key. - * @param {RelationMutate} onDelete - Constraints option + * @param {RelationMutate} onDelete - Delete constraint. Possible values are: cascade, restrict, setNull. * @param {string} newKey - New Column Key. * @throws {AppwriteException} * @returns {Promise} diff --git a/src/services/users.ts b/src/services/users.ts index 6b9985c..a79375f 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -1743,6 +1743,67 @@ export class Users { ); } + /** + * Get a custom MFA challenge for a user, including the code to be delivered through your own channel. + * + * @param {string} params.userId - User ID. + * @param {string} params.challengeId - ID of the challenge. + * @throws {AppwriteException} + * @returns {Promise} + */ + getMFAChallenge(params: { userId: string, challengeId: string }): Promise; + /** + * Get a custom MFA challenge for a user, including the code to be delivered through your own channel. + * + * @param {string} userId - User ID. + * @param {string} challengeId - ID of the challenge. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMFAChallenge(userId: string, challengeId: string): Promise; + getMFAChallenge( + paramsOrFirst: { userId: string, challengeId: string } | string, + ...rest: [(string)?] + ): Promise { + let params: { userId: string, challengeId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, challengeId: string }; + } else { + params = { + userId: paramsOrFirst as string, + challengeId: rest[0] as string + }; + } + + const userId = params.userId; + const challengeId = params.challengeId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof challengeId === 'undefined') { + throw new AppwriteException('Missing required parameter: "challengeId"'); + } + + const apiPath = '/users/{userId}/mfa/challenges/{challengeId}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{challengeId}', encodeURIComponent(String(challengeId))); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + /** * List the factors available on the account to be used as a MFA challange. * diff --git a/test/services/account.test.js b/test/services/account.test.js index e541ba3..0947305 100644 --- a/test/services/account.test.js +++ b/test/services/account.test.js @@ -241,20 +241,6 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method createJWT()', async () => { - const data = { - 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createJWT( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - test('test method listLogs()', async () => { const data = { 'total': 5, @@ -551,7 +537,8 @@ describe('Account', () => { 'totp': true, 'phone': true, 'email': true, - 'recoveryCode': true,}; + 'recoveryCode': true, + 'custom': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await account.listMfaFactors( @@ -568,7 +555,8 @@ describe('Account', () => { 'totp': true, 'phone': true, 'email': true, - 'recoveryCode': true,}; + 'recoveryCode': true, + 'custom': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await account.listMFAFactors( diff --git a/test/services/apps.test.js b/test/services/apps.test.js index 34305b3..2026c43 100644 --- a/test/services/apps.test.js +++ b/test/services/apps.test.js @@ -232,6 +232,21 @@ describe('Apps', () => { expect(response).toEqual(data); }); + test('test method deleteInstallation()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await apps.deleteInstallation( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createInstallationToken()', async () => { const data = { 'access_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...', diff --git a/test/services/embeddings.test.js b/test/services/embeddings.test.js new file mode 100644 index 0000000..02e84ed --- /dev/null +++ b/test/services/embeddings.test.js @@ -0,0 +1,28 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Embeddings } = require("../../dist/services/embeddings"); + +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); + +describe('Embeddings', () => { + const client = new Client(); + const embeddings = new Embeddings(client); + + + test('test method createTextEmbeddings()', async () => { + const data = { + 'total': 5, + 'embeddings': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await embeddings.createTextEmbeddings( + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/organization.test.js b/test/services/organization.test.js index e4d0532..70ae604 100644 --- a/test/services/organization.test.js +++ b/test/services/organization.test.js @@ -18,7 +18,6 @@ describe('Organization', () => { 'name': 'VIP', 'total': 7, 'prefs': {}, - 'billingBudget': 50, 'budgetAlerts': [], 'billingPlan': 'tier-1', 'billingPlanId': 'tier-1', @@ -27,22 +26,11 @@ describe('Organization', () => { 'billingStartDate': '2020-10-15T06:38:00.000+00:00', 'billingCurrentInvoiceDate': '2020-10-15T06:38:00.000+00:00', 'billingNextInvoiceDate': '2020-10-15T06:38:00.000+00:00', - 'billingTrialStartDate': '2020-10-15T06:38:00.000+00:00', 'billingTrialDays': 14, 'billingAggregationId': 'adbc3de4rddfsd', 'billingInvoiceId': 'adbc3de4rddfsd', 'paymentMethodId': 'adbc3de4rddfsd', - 'billingAddressId': 'adbc3de4rddfsd', - 'backupPaymentMethodId': 'adbc3de4rddfsd', 'status': 'active', - 'remarks': 'Pending initial payment', - 'agreementBAA': '', - 'programManagerName': '', - 'programManagerCalendar': '', - 'programDiscordChannelName': '', - 'programDiscordChannelUrl': '', - 'billingPlanDowngrade': 'tier-1', - 'billingTaxId': '', 'markedForDeletion': true, 'platform': 'imagine', 'projects': [],}; @@ -65,7 +53,6 @@ describe('Organization', () => { 'name': 'VIP', 'total': 7, 'prefs': {}, - 'billingBudget': 50, 'budgetAlerts': [], 'billingPlan': 'tier-1', 'billingPlanId': 'tier-1', @@ -74,22 +61,11 @@ describe('Organization', () => { 'billingStartDate': '2020-10-15T06:38:00.000+00:00', 'billingCurrentInvoiceDate': '2020-10-15T06:38:00.000+00:00', 'billingNextInvoiceDate': '2020-10-15T06:38:00.000+00:00', - 'billingTrialStartDate': '2020-10-15T06:38:00.000+00:00', 'billingTrialDays': 14, 'billingAggregationId': 'adbc3de4rddfsd', 'billingInvoiceId': 'adbc3de4rddfsd', 'paymentMethodId': 'adbc3de4rddfsd', - 'billingAddressId': 'adbc3de4rddfsd', - 'backupPaymentMethodId': 'adbc3de4rddfsd', 'status': 'active', - 'remarks': 'Pending initial payment', - 'agreementBAA': '', - 'programManagerName': '', - 'programManagerCalendar': '', - 'programDiscordChannelName': '', - 'programDiscordChannelUrl': '', - 'billingPlanDowngrade': 'tier-1', - 'billingTaxId': '', 'markedForDeletion': true, 'platform': 'imagine', 'projects': [],}; diff --git a/test/services/project.test.js b/test/services/project.test.js index 3f535e9..44703bc 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -122,31 +122,6 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method createKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createKey( - '', - '', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - test('test method createEphemeralKey()', async () => { const data = { '\$id': '5e5ea5c16897e', @@ -1678,6 +1653,47 @@ describe('Project', () => { expect(response).toEqual(data); }); + test('test method updateMFAFactorsPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'region': 'fra', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': 'smtp-password', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'onboarding': {}, + 'authMethods': [], + 'services': [], + 'protocols': [], + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + 'wafEnabled': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateMFAFactorsPolicy( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updatePasswordDictionaryPolicy()', async () => { const data = { '\$id': '5e5ea5c16897e', diff --git a/test/services/proxy.test.js b/test/services/proxy.test.js index 57aa087..ebe4625 100644 --- a/test/services/proxy.test.js +++ b/test/services/proxy.test.js @@ -10,6 +10,25 @@ describe('Proxy', () => { const proxy = new Proxy(client); + test('test method createInvalidation()', async () => { + const data = { + 'domain': 'appwrite.company.com', + 'type': 'tag', + 'reference': 'products', + 'status': 'success',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.createInvalidation( + '', + 'tag', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listRules()', async () => { const data = { 'total': 5, diff --git a/test/services/storage.test.js b/test/services/storage.test.js index ce79f08..761c156 100644 --- a/test/services/storage.test.js +++ b/test/services/storage.test.js @@ -149,6 +149,8 @@ describe('Storage', () => { '\$updatedAt': '2020-10-15T06:38:00.000+00:00', '\$permissions': [], 'name': 'Pink.png', + 'folder': 'photos/2026/', + 'key': 'photos/2026/Pink.png', 'signature': '5d529fd02b544198ae075bd57c1762bb', 'mimeType': 'image/png', 'sizeOriginal': 17890, @@ -179,6 +181,8 @@ describe('Storage', () => { '\$updatedAt': '2020-10-15T06:38:00.000+00:00', '\$permissions': [], 'name': 'Pink.png', + 'folder': 'photos/2026/', + 'key': 'photos/2026/Pink.png', 'signature': '5d529fd02b544198ae075bd57c1762bb', 'mimeType': 'image/png', 'sizeOriginal': 17890, @@ -208,6 +212,8 @@ describe('Storage', () => { '\$updatedAt': '2020-10-15T06:38:00.000+00:00', '\$permissions': [], 'name': 'Pink.png', + 'folder': 'photos/2026/', + 'key': 'photos/2026/Pink.png', 'signature': '5d529fd02b544198ae075bd57c1762bb', 'mimeType': 'image/png', 'sizeOriginal': 17890, diff --git a/test/services/tables-d-b.test.js b/test/services/tables-d-b.test.js index 654a20a..c039340 100644 --- a/test/services/tables-d-b.test.js +++ b/test/services/tables-d-b.test.js @@ -254,7 +254,6 @@ describe('TablesDB', () => { 'nodePool': 'db-pool-4vcpu-8gb', 'replicas': 2, 'syncMode': 'async', - 'crossRegionReplicas': 1, 'networkMaxConnections': 500, 'networkIdleTimeoutSeconds': 900, 'networkIPAllowlist': [], @@ -285,10 +284,153 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); + test('test method listMigrations()', async () => { + const data = { + 'total': 5, + 'migrations': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listMigrations( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMigration()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'projectId': '5e5ea5c16897e', + 'databaseId': '5e5ea5c16897e', + 'specification': 's-2vcpu-4gb', + 'phase': 'pending', + 'attempt': 0, + 'lastError': '', + 'lagDocuments': 0, + 'verifiedAt': '2020-10-15T06:38:00.000+00:00', + 'cutoverAt': '2020-10-15T06:38:00.000+00:00', + 'soakUntil': '2020-10-15T06:38:00.000+00:00', + 'autoCutover': true, + 'cutoverRequested': true, + 'paused': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createMigration( + '', + 's-1vcpu-1gb', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMigration()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'projectId': '5e5ea5c16897e', + 'databaseId': '5e5ea5c16897e', + 'specification': 's-2vcpu-4gb', + 'phase': 'pending', + 'attempt': 0, + 'lastError': '', + 'lagDocuments': 0, + 'verifiedAt': '2020-10-15T06:38:00.000+00:00', + 'cutoverAt': '2020-10-15T06:38:00.000+00:00', + 'soakUntil': '2020-10-15T06:38:00.000+00:00', + 'autoCutover': true, + 'cutoverRequested': true, + 'paused': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getMigration( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMigration()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.deleteMigration( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method cutoverMigration()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'projectId': '5e5ea5c16897e', + 'databaseId': '5e5ea5c16897e', + 'specification': 's-2vcpu-4gb', + 'phase': 'pending', + 'attempt': 0, + 'lastError': '', + 'lagDocuments': 0, + 'verifiedAt': '2020-10-15T06:38:00.000+00:00', + 'cutoverAt': '2020-10-15T06:38:00.000+00:00', + 'soakUntil': '2020-10-15T06:38:00.000+00:00', + 'autoCutover': true, + 'cutoverRequested': true, + 'paused': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.cutoverMigration( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listOperations()', async () => { + const data = { + 'total': 5, + 'operations': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listOperations( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getReplicas()', async () => { const data = { 'replicas': 2, 'syncMode': 'async', + 'syncDegraded': true, + 'syncAcknowledgements': 1, + 'syncStandbyCount': 2, 'members': [],}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -310,6 +452,10 @@ describe('TablesDB', () => { 'version': '17', 'uptime': 86400, 'connections': {}, + 'syncMode': 'async', + 'syncDegraded': true, + 'syncAcknowledgements': 1, + 'syncStandbyCount': 2, 'replicas': [], 'volumes': [],}; mockedFetch.mockImplementation(() => Response.json(data)); diff --git a/test/services/users.test.js b/test/services/users.test.js index f9ea2b1..04ef422 100644 --- a/test/services/users.test.js +++ b/test/services/users.test.js @@ -592,12 +592,33 @@ describe('Users', () => { expect(response).toEqual(data); }); + test('test method getMFAChallenge()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'code': '446372',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.getMFAChallenge( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listMfaFactors()', async () => { const data = { 'totp': true, 'phone': true, 'email': true, - 'recoveryCode': true,}; + 'recoveryCode': true, + 'custom': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await users.listMfaFactors( @@ -615,7 +636,8 @@ describe('Users', () => { 'totp': true, 'phone': true, 'email': true, - 'recoveryCode': true,}; + 'recoveryCode': true, + 'custom': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await users.listMFAFactors( From c0e5f1832f70afc1d3aee800c21f7002dbddb2f4 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 14 Aug 2026 13:50:04 +0530 Subject: [PATCH 08/11] chore: update Node.js SDK to 28.0.0 --- CHANGELOG.md | 1 - .../embeddings/create-text-embeddings.md | 15 ---- src/enums/embedding-model.ts | 6 -- src/index.ts | 2 - src/models.ts | 36 --------- src/services/embeddings.ts | 80 ------------------- test/services/embeddings.test.js | 28 ------- 7 files changed, 168 deletions(-) delete mode 100644 docs/examples/embeddings/create-text-embeddings.md delete mode 100644 src/enums/embedding-model.ts delete mode 100644 src/services/embeddings.ts delete mode 100644 test/services/embeddings.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b5d09b..23ee508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ * Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either * Breaking: removed `project.createKey`. A leaked key could mint further hidden keys, making a compromise far harder to contain and revoke * Breaking: `activities.listEvents` `queries` now takes an array instead of a string -* Added: `embeddings` service with `createTextEmbeddings`, plus the `EmbeddingModel` enum * Added: TablesDB migration methods `listMigrations`, `createMigration`, `getMigration`, `deleteMigration`, `cutoverMigration`, and `listOperations` * Added: `proxy.createInvalidation` for purging cached edge responses, plus the `InvalidationType` enum * Added: `apps.deleteInstallation` diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md deleted file mode 100644 index 5beebf5..0000000 --- a/docs/examples/embeddings/create-text-embeddings.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const embeddings = new sdk.Embeddings(client); - -const result = await embeddings.createTextEmbeddings({ - texts: [], - model: sdk.EmbeddingModel.NomicEmbedText // optional -}); -``` diff --git a/src/enums/embedding-model.ts b/src/enums/embedding-model.ts deleted file mode 100644 index d06bb77..0000000 --- a/src/enums/embedding-model.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum EmbeddingModel { - Nomicembedtext = 'nomic-embed-text', - Embeddinggemma = 'embedding-gemma', - Allminilm = 'all-minilm', - Bgesmall = 'bge-small', -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 58388a1..b12f93a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,6 @@ export { Apps } from './services/apps'; export { Avatars } from './services/avatars'; export { Backups } from './services/backups'; export { Databases } from './services/databases'; -export { Embeddings } from './services/embeddings'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Locale } from './services/locale'; @@ -44,7 +43,6 @@ 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 { EmbeddingModel } from './enums/embedding-model'; export { Runtime } from './enums/runtime'; export { ProjectKeyScopes } from './enums/project-key-scopes'; export { TemplateReferenceType } from './enums/template-reference-type'; diff --git a/src/models.ts b/src/models.ts index 14faf01..a5d1e88 100644 --- a/src/models.ts +++ b/src/models.ts @@ -640,20 +640,6 @@ export namespace Models { specifications: Specification[]; } - /** - * Embedding list - */ - export type EmbeddingList = { - /** - * Total number of embeddings that matched your query. - */ - total: number; - /** - * List of embeddings. - */ - embeddings: Embedding[]; - } - /** * Insights List */ @@ -736,28 +722,6 @@ export namespace Models { archives?: BackupArchive[]; } - /** - * Embedding - */ - export type Embedding = { - /** - * Embedding model used to generate embeddings. - */ - model: string; - /** - * Number of dimensions for each embedding vector. - */ - dimension: number; - /** - * Embedding vector values. If an error occurs, this will be an empty array. - */ - embedding: number[]; - /** - * Error message if embedding generation fails. Empty string if no error. - */ - error: string; - } - /** * Collection */ diff --git a/src/services/embeddings.ts b/src/services/embeddings.ts deleted file mode 100644 index 0a38c3a..0000000 --- a/src/services/embeddings.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { EmbeddingModel } from '../enums/embedding-model'; - -export class Embeddings { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. - * - * - * @param {string[]} params.texts - Array of text to generate embeddings. - * @param {EmbeddingModel} params.model - The embedding model to use for generating vector embeddings. - * @throws {AppwriteException} - * @returns {Promise} - */ - createTextEmbeddings(params: { texts: string[], model?: EmbeddingModel }): Promise; - /** - * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. - * - * - * @param {string[]} texts - Array of text to generate embeddings. - * @param {EmbeddingModel} model - The embedding model to use for generating vector embeddings. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTextEmbeddings(texts: string[], model?: EmbeddingModel): Promise; - createTextEmbeddings( - paramsOrFirst: { texts: string[], model?: EmbeddingModel } | string[], - ...rest: [(EmbeddingModel)?] - ): Promise { - let params: { texts: string[], model?: EmbeddingModel }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { texts: string[], model?: EmbeddingModel }; - } else { - params = { - texts: paramsOrFirst as string[], - model: rest[0] as EmbeddingModel - }; - } - - const texts = params.texts; - const model = params.model; - - if (typeof texts === 'undefined') { - throw new AppwriteException('Missing required parameter: "texts"'); - } - - const apiPath = '/embeddings/text'; - const payload: Payload = {}; - if (typeof texts !== 'undefined') { - payload['texts'] = texts; - } - if (typeof model !== 'undefined') { - payload['model'] = model; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/test/services/embeddings.test.js b/test/services/embeddings.test.js deleted file mode 100644 index 02e84ed..0000000 --- a/test/services/embeddings.test.js +++ /dev/null @@ -1,28 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Embeddings } = require("../../dist/services/embeddings"); - -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); - -describe('Embeddings', () => { - const client = new Client(); - const embeddings = new Embeddings(client); - - - test('test method createTextEmbeddings()', async () => { - const data = { - 'total': 5, - 'embeddings': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await embeddings.createTextEmbeddings( - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) From 147c3c9b113354a6d46188d0995fc447e52d0687 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 14 Aug 2026 13:59:49 +0530 Subject: [PATCH 09/11] chore: update Node.js SDK to 28.0.0 --- CHANGELOG.md | 1 + .../embeddings/create-text-embeddings.md | 15 ++++ src/enums/embedding-model.ts | 6 ++ src/index.ts | 2 + src/models.ts | 36 +++++++++ src/services/embeddings.ts | 80 +++++++++++++++++++ test/services/embeddings.test.js | 28 +++++++ 7 files changed, 168 insertions(+) create mode 100644 docs/examples/embeddings/create-text-embeddings.md create mode 100644 src/enums/embedding-model.ts create mode 100644 src/services/embeddings.ts create mode 100644 test/services/embeddings.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 23ee508..6b5d09b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either * Breaking: removed `project.createKey`. A leaked key could mint further hidden keys, making a compromise far harder to contain and revoke * Breaking: `activities.listEvents` `queries` now takes an array instead of a string +* Added: `embeddings` service with `createTextEmbeddings`, plus the `EmbeddingModel` enum * Added: TablesDB migration methods `listMigrations`, `createMigration`, `getMigration`, `deleteMigration`, `cutoverMigration`, and `listOperations` * Added: `proxy.createInvalidation` for purging cached edge responses, plus the `InvalidationType` enum * Added: `apps.deleteInstallation` diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md new file mode 100644 index 0000000..5beebf5 --- /dev/null +++ b/docs/examples/embeddings/create-text-embeddings.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const embeddings = new sdk.Embeddings(client); + +const result = await embeddings.createTextEmbeddings({ + texts: [], + model: sdk.EmbeddingModel.NomicEmbedText // optional +}); +``` diff --git a/src/enums/embedding-model.ts b/src/enums/embedding-model.ts new file mode 100644 index 0000000..d06bb77 --- /dev/null +++ b/src/enums/embedding-model.ts @@ -0,0 +1,6 @@ +export enum EmbeddingModel { + Nomicembedtext = 'nomic-embed-text', + Embeddinggemma = 'embedding-gemma', + Allminilm = 'all-minilm', + Bgesmall = 'bge-small', +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index b12f93a..58388a1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ export { Apps } from './services/apps'; export { Avatars } from './services/avatars'; export { Backups } from './services/backups'; export { Databases } from './services/databases'; +export { Embeddings } from './services/embeddings'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Locale } from './services/locale'; @@ -43,6 +44,7 @@ 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 { EmbeddingModel } from './enums/embedding-model'; export { Runtime } from './enums/runtime'; export { ProjectKeyScopes } from './enums/project-key-scopes'; export { TemplateReferenceType } from './enums/template-reference-type'; diff --git a/src/models.ts b/src/models.ts index a5d1e88..14faf01 100644 --- a/src/models.ts +++ b/src/models.ts @@ -640,6 +640,20 @@ export namespace Models { specifications: Specification[]; } + /** + * Embedding list + */ + export type EmbeddingList = { + /** + * Total number of embeddings that matched your query. + */ + total: number; + /** + * List of embeddings. + */ + embeddings: Embedding[]; + } + /** * Insights List */ @@ -722,6 +736,28 @@ export namespace Models { archives?: BackupArchive[]; } + /** + * Embedding + */ + export type Embedding = { + /** + * Embedding model used to generate embeddings. + */ + model: string; + /** + * Number of dimensions for each embedding vector. + */ + dimension: number; + /** + * Embedding vector values. If an error occurs, this will be an empty array. + */ + embedding: number[]; + /** + * Error message if embedding generation fails. Empty string if no error. + */ + error: string; + } + /** * Collection */ diff --git a/src/services/embeddings.ts b/src/services/embeddings.ts new file mode 100644 index 0000000..0a38c3a --- /dev/null +++ b/src/services/embeddings.ts @@ -0,0 +1,80 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { EmbeddingModel } from '../enums/embedding-model'; + +export class Embeddings { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. + * + * + * @param {string[]} params.texts - Array of text to generate embeddings. + * @param {EmbeddingModel} params.model - The embedding model to use for generating vector embeddings. + * @throws {AppwriteException} + * @returns {Promise} + */ + createTextEmbeddings(params: { texts: string[], model?: EmbeddingModel }): Promise; + /** + * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. + * + * + * @param {string[]} texts - Array of text to generate embeddings. + * @param {EmbeddingModel} model - The embedding model to use for generating vector embeddings. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextEmbeddings(texts: string[], model?: EmbeddingModel): Promise; + createTextEmbeddings( + paramsOrFirst: { texts: string[], model?: EmbeddingModel } | string[], + ...rest: [(EmbeddingModel)?] + ): Promise { + let params: { texts: string[], model?: EmbeddingModel }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { texts: string[], model?: EmbeddingModel }; + } else { + params = { + texts: paramsOrFirst as string[], + model: rest[0] as EmbeddingModel + }; + } + + const texts = params.texts; + const model = params.model; + + if (typeof texts === 'undefined') { + throw new AppwriteException('Missing required parameter: "texts"'); + } + + const apiPath = '/embeddings/text'; + const payload: Payload = {}; + if (typeof texts !== 'undefined') { + payload['texts'] = texts; + } + if (typeof model !== 'undefined') { + payload['model'] = model; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/test/services/embeddings.test.js b/test/services/embeddings.test.js new file mode 100644 index 0000000..02e84ed --- /dev/null +++ b/test/services/embeddings.test.js @@ -0,0 +1,28 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Embeddings } = require("../../dist/services/embeddings"); + +const { fetch: mockedFetch, Response } = require("undici"); +jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); + +describe('Embeddings', () => { + const client = new Client(); + const embeddings = new Embeddings(client); + + + test('test method createTextEmbeddings()', async () => { + const data = { + 'total': 5, + 'embeddings': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await embeddings.createTextEmbeddings( + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) From 8657930503c0c50193fe07113c30d2b48a00645d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 27 Aug 2026 18:00:10 +0530 Subject: [PATCH 10/11] chore: update Node.js SDK to 28.1.0-rc.1 --- .prettierignore | 13 + .prettierrc | 4 + CHANGELOG.md | 14 + .../account/create-email-password-session.md | 2 +- docs/examples/account/create-email-token.md | 2 +- .../account/create-email-verification.md | 2 +- .../account/create-magic-url-token.md | 2 +- .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../examples/account/create-o-auth-2-token.md | 2 +- docs/examples/account/create-phone-token.md | 2 +- docs/examples/account/create-recovery.md | 2 +- docs/examples/account/create-session.md | 2 +- docs/examples/account/create-verification.md | 2 +- docs/examples/account/create.md | 2 +- docs/examples/account/delete-consent-token.md | 2 +- docs/examples/account/delete-consent.md | 2 +- docs/examples/account/delete-identity.md | 2 +- .../account/delete-mfa-authenticator.md | 2 +- docs/examples/account/delete-session.md | 2 +- docs/examples/account/get-consent-token.md | 2 +- docs/examples/account/get-consent.md | 2 +- docs/examples/account/get-session.md | 2 +- docs/examples/account/list-consent-tokens.md | 2 +- docs/examples/account/list-consents.md | 2 +- docs/examples/account/list-identities.md | 2 +- docs/examples/account/list-logs.md | 2 +- .../account/update-email-verification.md | 2 +- docs/examples/account/update-email.md | 2 +- .../account/update-magic-url-session.md | 2 +- .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- docs/examples/account/update-mfa.md | 2 +- docs/examples/account/update-name.md | 2 +- docs/examples/account/update-password.md | 2 +- docs/examples/account/update-phone-session.md | 2 +- .../account/update-phone-verification.md | 2 +- docs/examples/account/update-phone.md | 2 +- docs/examples/account/update-prefs.md | 8 +- docs/examples/account/update-recovery.md | 2 +- docs/examples/account/update-session.md | 2 +- docs/examples/account/update-verification.md | 2 +- docs/examples/activities/get-event.md | 2 +- docs/examples/activities/list-events.md | 2 +- docs/examples/advisor/delete-report.md | 2 +- docs/examples/advisor/get-insight.md | 2 +- docs/examples/advisor/get-report.md | 2 +- docs/examples/advisor/list-insights.md | 2 +- docs/examples/advisor/list-reports.md | 2 +- .../apps/create-installation-token.md | 2 +- docs/examples/apps/create-key.md | 2 +- docs/examples/apps/create-secret.md | 2 +- docs/examples/apps/create.md | 2 +- docs/examples/apps/delete-installation.md | 2 +- docs/examples/apps/delete-key.md | 2 +- docs/examples/apps/delete-secret.md | 2 +- docs/examples/apps/delete-tokens.md | 2 +- docs/examples/apps/delete.md | 2 +- docs/examples/apps/get-installation.md | 2 +- docs/examples/apps/get-key.md | 2 +- docs/examples/apps/get-secret.md | 2 +- docs/examples/apps/get.md | 2 +- docs/examples/apps/list-installations.md | 2 +- docs/examples/apps/list-keys.md | 2 +- docs/examples/apps/list-secrets.md | 2 +- docs/examples/apps/list.md | 2 +- docs/examples/apps/update-labels.md | 2 +- docs/examples/apps/update-team.md | 2 +- docs/examples/apps/update.md | 2 +- docs/examples/avatars/get-browser.md | 2 +- docs/examples/avatars/get-credit-card.md | 2 +- docs/examples/avatars/get-favicon.md | 2 +- docs/examples/avatars/get-flag.md | 2 +- docs/examples/avatars/get-image.md | 2 +- docs/examples/avatars/get-initials.md | 2 +- docs/examples/avatars/get-photo.md | 21 + docs/examples/avatars/get-qr.md | 2 +- docs/examples/avatars/get-screenshot.md | 14 +- docs/examples/backups/create-archive.md | 2 +- docs/examples/backups/create-policy.md | 2 +- docs/examples/backups/create-restoration.md | 2 +- docs/examples/backups/delete-archive.md | 2 +- docs/examples/backups/delete-policy.md | 2 +- docs/examples/backups/get-archive.md | 2 +- docs/examples/backups/get-policy.md | 2 +- docs/examples/backups/get-restoration.md | 2 +- docs/examples/backups/list-archives.md | 2 +- docs/examples/backups/list-policies.md | 2 +- docs/examples/backups/list-restorations.md | 2 +- docs/examples/backups/update-policy.md | 2 +- .../databases/create-big-int-attribute.md | 10 +- .../databases/create-boolean-attribute.md | 4 +- docs/examples/databases/create-collection.md | 2 +- .../databases/create-datetime-attribute.md | 4 +- docs/examples/databases/create-document.md | 12 +- docs/examples/databases/create-documents.md | 2 +- .../databases/create-email-attribute.md | 4 +- .../databases/create-enum-attribute.md | 8 +- .../databases/create-float-attribute.md | 10 +- docs/examples/databases/create-index.md | 4 +- .../databases/create-integer-attribute.md | 10 +- .../examples/databases/create-ip-attribute.md | 6 +- .../databases/create-line-attribute.md | 8 +- .../databases/create-longtext-attribute.md | 6 +- .../databases/create-mediumtext-attribute.md | 6 +- docs/examples/databases/create-operations.md | 20 +- .../databases/create-point-attribute.md | 4 +- .../databases/create-polygon-attribute.md | 11 +- .../create-relationship-attribute.md | 6 +- .../databases/create-string-attribute.md | 6 +- .../databases/create-text-attribute.md | 6 +- docs/examples/databases/create-transaction.md | 2 +- .../databases/create-url-attribute.md | 4 +- .../databases/create-varchar-attribute.md | 6 +- docs/examples/databases/create.md | 2 +- .../databases/decrement-document-attribute.md | 8 +- docs/examples/databases/delete-attribute.md | 2 +- docs/examples/databases/delete-collection.md | 2 +- docs/examples/databases/delete-document.md | 2 +- docs/examples/databases/delete-documents.md | 2 +- docs/examples/databases/delete-index.md | 2 +- docs/examples/databases/delete-transaction.md | 2 +- docs/examples/databases/delete.md | 2 +- docs/examples/databases/get-attribute.md | 2 +- docs/examples/databases/get-collection.md | 2 +- docs/examples/databases/get-document.md | 2 +- docs/examples/databases/get-index.md | 2 +- docs/examples/databases/get-transaction.md | 2 +- docs/examples/databases/get.md | 2 +- .../databases/increment-document-attribute.md | 8 +- docs/examples/databases/list-attributes.md | 2 +- docs/examples/databases/list-collections.md | 2 +- docs/examples/databases/list-documents.md | 2 +- docs/examples/databases/list-indexes.md | 2 +- docs/examples/databases/list-transactions.md | 2 +- docs/examples/databases/list.md | 2 +- .../databases/update-big-int-attribute.md | 10 +- .../databases/update-boolean-attribute.md | 4 +- docs/examples/databases/update-collection.md | 2 +- .../databases/update-datetime-attribute.md | 4 +- docs/examples/databases/update-document.md | 12 +- docs/examples/databases/update-documents.md | 12 +- .../databases/update-email-attribute.md | 4 +- .../databases/update-enum-attribute.md | 8 +- .../databases/update-float-attribute.md | 10 +- .../databases/update-integer-attribute.md | 10 +- .../examples/databases/update-ip-attribute.md | 6 +- .../databases/update-line-attribute.md | 10 +- .../databases/update-longtext-attribute.md | 6 +- .../databases/update-mediumtext-attribute.md | 6 +- .../databases/update-point-attribute.md | 4 +- .../databases/update-polygon-attribute.md | 13 +- .../update-relationship-attribute.md | 4 +- .../databases/update-string-attribute.md | 6 +- .../databases/update-text-attribute.md | 6 +- docs/examples/databases/update-transaction.md | 2 +- .../databases/update-url-attribute.md | 4 +- .../databases/update-varchar-attribute.md | 6 +- docs/examples/databases/update.md | 2 +- docs/examples/databases/upsert-document.md | 12 +- docs/examples/databases/upsert-documents.md | 2 +- .../examples/documentsdb/create-collection.md | 21 + docs/examples/documentsdb/create-document.md | 24 + docs/examples/documentsdb/create-documents.md | 16 + docs/examples/documentsdb/create-failover.md | 15 + docs/examples/documentsdb/create-index.md | 20 + .../examples/documentsdb/create-operations.md | 25 + .../documentsdb/create-transaction.md | 14 + docs/examples/documentsdb/create.md | 19 + .../decrement-document-attribute.md | 20 + .../examples/documentsdb/delete-collection.md | 15 + docs/examples/documentsdb/delete-document.md | 17 + docs/examples/documentsdb/delete-documents.md | 17 + docs/examples/documentsdb/delete-index.md | 16 + .../documentsdb/delete-transaction.md | 14 + docs/examples/documentsdb/delete.md | 14 + docs/examples/documentsdb/get-collection.md | 15 + docs/examples/documentsdb/get-document.md | 18 + docs/examples/documentsdb/get-index.md | 16 + docs/examples/documentsdb/get-replicas.md | 14 + docs/examples/documentsdb/get-status.md | 14 + docs/examples/documentsdb/get-transaction.md | 14 + docs/examples/documentsdb/get.md | 14 + .../increment-document-attribute.md | 20 + docs/examples/documentsdb/list-collections.md | 17 + docs/examples/documentsdb/list-documents.md | 19 + docs/examples/documentsdb/list-indexes.md | 17 + docs/examples/documentsdb/list-operations.md | 17 + .../documentsdb/list-specifications.md | 12 + .../examples/documentsdb/list-transactions.md | 14 + docs/examples/documentsdb/list.md | 15 + .../examples/documentsdb/update-collection.md | 20 + docs/examples/documentsdb/update-document.md | 19 + docs/examples/documentsdb/update-documents.md | 18 + .../documentsdb/update-transaction.md | 16 + docs/examples/documentsdb/update.md | 19 + docs/examples/documentsdb/upsert-document.md | 19 + docs/examples/documentsdb/upsert-documents.md | 17 + .../embeddings/create-text-embeddings.md | 2 +- docs/examples/functions/create-deployment.md | 2 +- .../functions/create-duplicate-deployment.md | 2 +- docs/examples/functions/create-execution.md | 2 +- .../functions/create-template-deployment.md | 2 +- docs/examples/functions/create-variable.md | 2 +- .../functions/create-vcs-deployment.md | 2 +- docs/examples/functions/create.md | 10 +- docs/examples/functions/delete-deployment.md | 2 +- docs/examples/functions/delete-execution.md | 2 +- docs/examples/functions/delete-variable.md | 2 +- docs/examples/functions/delete.md | 2 +- .../functions/get-deployment-download.md | 2 +- docs/examples/functions/get-deployment.md | 2 +- docs/examples/functions/get-execution.md | 2 +- docs/examples/functions/get-variable.md | 2 +- docs/examples/functions/get.md | 2 +- docs/examples/functions/list-deployments.md | 2 +- docs/examples/functions/list-executions.md | 2 +- .../examples/functions/list-specifications.md | 2 +- docs/examples/functions/list-variables.md | 2 +- docs/examples/functions/list.md | 2 +- .../functions/update-deployment-status.md | 2 +- .../functions/update-function-deployment.md | 2 +- docs/examples/functions/update-variable.md | 2 +- docs/examples/functions/update.md | 10 +- docs/examples/graphql/mutation.md | 2 +- docs/examples/graphql/query.md | 2 +- .../messaging/create-apns-provider.md | 2 +- docs/examples/messaging/create-email.md | 2 +- .../examples/messaging/create-fcm-provider.md | 2 +- .../messaging/create-mailgun-provider.md | 4 +- .../messaging/create-msg-91-provider.md | 2 +- docs/examples/messaging/create-push.md | 4 +- .../messaging/create-resend-provider.md | 2 +- .../messaging/create-sendgrid-provider.md | 2 +- .../examples/messaging/create-ses-provider.md | 2 +- docs/examples/messaging/create-sms.md | 2 +- .../messaging/create-smtp-provider.md | 4 +- docs/examples/messaging/create-subscriber.md | 2 +- .../messaging/create-telesign-provider.md | 2 +- .../messaging/create-textmagic-provider.md | 2 +- docs/examples/messaging/create-topic.md | 2 +- .../messaging/create-twilio-provider.md | 2 +- .../messaging/create-vonage-provider.md | 2 +- docs/examples/messaging/delete-provider.md | 2 +- docs/examples/messaging/delete-subscriber.md | 2 +- docs/examples/messaging/delete-topic.md | 2 +- docs/examples/messaging/delete.md | 2 +- docs/examples/messaging/get-message.md | 2 +- docs/examples/messaging/get-provider.md | 2 +- docs/examples/messaging/get-subscriber.md | 2 +- docs/examples/messaging/get-topic.md | 2 +- docs/examples/messaging/list-messages.md | 2 +- docs/examples/messaging/list-providers.md | 2 +- docs/examples/messaging/list-subscribers.md | 2 +- docs/examples/messaging/list-targets.md | 2 +- docs/examples/messaging/list-topics.md | 2 +- .../messaging/update-apns-provider.md | 2 +- docs/examples/messaging/update-email.md | 2 +- .../examples/messaging/update-fcm-provider.md | 2 +- .../messaging/update-mailgun-provider.md | 4 +- .../messaging/update-msg-91-provider.md | 2 +- docs/examples/messaging/update-push.md | 4 +- .../messaging/update-resend-provider.md | 2 +- .../messaging/update-sendgrid-provider.md | 2 +- .../examples/messaging/update-ses-provider.md | 2 +- docs/examples/messaging/update-sms.md | 2 +- .../messaging/update-smtp-provider.md | 2 +- .../messaging/update-telesign-provider.md | 2 +- .../messaging/update-textmagic-provider.md | 2 +- docs/examples/messaging/update-topic.md | 2 +- .../messaging/update-twilio-provider.md | 2 +- .../messaging/update-vonage-provider.md | 2 +- docs/examples/mongo/create-backup-policy.md | 20 + docs/examples/mongo/create-backup.md | 15 + docs/examples/mongo/create-branch.md | 16 + docs/examples/mongo/create-failover.md | 15 + docs/examples/mongo/create-migration.md | 16 + docs/examples/mongo/create-restoration.md | 18 + docs/examples/mongo/create-upgrade.md | 15 + docs/examples/mongo/create.md | 27 + docs/examples/mongo/delete-backup-policy.md | 15 + docs/examples/mongo/delete-backup.md | 15 + docs/examples/mongo/delete-branch.md | 15 + docs/examples/mongo/delete.md | 14 + docs/examples/mongo/get-backup-policy.md | 15 + docs/examples/mongo/get-backup.md | 15 + docs/examples/mongo/get-pitr.md | 14 + docs/examples/mongo/get-replicas.md | 14 + docs/examples/mongo/get-restoration.md | 15 + docs/examples/mongo/get-status.md | 14 + docs/examples/mongo/get.md | 14 + docs/examples/mongo/list-backup-policies.md | 15 + docs/examples/mongo/list-backups.md | 15 + docs/examples/mongo/list-branches.md | 14 + docs/examples/mongo/list-operations.md | 17 + docs/examples/mongo/list-restorations.md | 18 + docs/examples/mongo/list-specifications.md | 12 + docs/examples/mongo/list.md | 14 + docs/examples/mongo/update-backup-policy.md | 19 + docs/examples/mongo/update-backup-storage.md | 21 + docs/examples/mongo/update-credentials.md | 14 + docs/examples/mongo/update-maintenance.md | 16 + docs/examples/mongo/update.md | 34 + docs/examples/mysql/create-backup-policy.md | 20 + docs/examples/mysql/create-backup.md | 15 + docs/examples/mysql/create-branch.md | 16 + docs/examples/mysql/create-execution.md | 17 + docs/examples/mysql/create-failover.md | 15 + docs/examples/mysql/create-migration.md | 16 + docs/examples/mysql/create-restoration.md | 18 + docs/examples/mysql/create-upgrade.md | 15 + docs/examples/mysql/create.md | 27 + docs/examples/mysql/delete-backup-policy.md | 15 + docs/examples/mysql/delete-backup.md | 15 + docs/examples/mysql/delete-branch.md | 15 + docs/examples/mysql/delete.md | 14 + docs/examples/mysql/get-backup-policy.md | 15 + docs/examples/mysql/get-backup.md | 15 + docs/examples/mysql/get-pitr.md | 14 + docs/examples/mysql/get-pooler.md | 14 + docs/examples/mysql/get-replicas.md | 14 + docs/examples/mysql/get-restoration.md | 15 + docs/examples/mysql/get-status.md | 14 + docs/examples/mysql/get.md | 14 + docs/examples/mysql/list-backup-policies.md | 15 + docs/examples/mysql/list-backups.md | 15 + docs/examples/mysql/list-branches.md | 14 + docs/examples/mysql/list-operations.md | 17 + docs/examples/mysql/list-restorations.md | 18 + docs/examples/mysql/list-specifications.md | 12 + docs/examples/mysql/list.md | 14 + docs/examples/mysql/update-backup-policy.md | 19 + docs/examples/mysql/update-backup-storage.md | 21 + docs/examples/mysql/update-credentials.md | 14 + docs/examples/mysql/update-maintenance.md | 16 + docs/examples/mysql/update-pooler.md | 22 + docs/examples/mysql/update.md | 34 + docs/examples/oauth2/approve.md | 2 +- docs/examples/oauth2/authorize-post.md | 2 +- docs/examples/oauth2/authorize.md | 2 +- .../oauth2/create-device-authorization.md | 2 +- docs/examples/oauth2/create-grant.md | 2 +- docs/examples/oauth2/create-par.md | 2 +- docs/examples/oauth2/create-token.md | 2 +- docs/examples/oauth2/get-grant.md | 2 +- docs/examples/oauth2/list-organizations.md | 2 +- docs/examples/oauth2/list-projects.md | 2 +- docs/examples/oauth2/reject.md | 2 +- docs/examples/oauth2/revoke.md | 2 +- .../organization/create-installation.md | 2 +- docs/examples/organization/create-key.md | 2 +- .../organization/create-membership.md | 2 +- docs/examples/organization/create-project.md | 4 +- .../organization/delete-installation.md | 2 +- docs/examples/organization/delete-key.md | 2 +- .../organization/delete-membership.md | 2 +- docs/examples/organization/delete-project.md | 2 +- .../examples/organization/get-installation.md | 2 +- docs/examples/organization/get-key.md | 2 +- docs/examples/organization/get-membership.md | 2 +- docs/examples/organization/get-project.md | 2 +- .../organization/list-installations.md | 2 +- docs/examples/organization/list-keys.md | 2 +- .../examples/organization/list-memberships.md | 2 +- docs/examples/organization/list-projects.md | 2 +- .../organization/update-installation.md | 2 +- docs/examples/organization/update-key.md | 2 +- .../organization/update-membership.md | 2 +- docs/examples/organization/update-project.md | 2 +- docs/examples/organization/update.md | 2 +- .../postgresql/create-backup-policy.md | 20 + docs/examples/postgresql/create-backup.md | 15 + docs/examples/postgresql/create-branch.md | 16 + docs/examples/postgresql/create-execution.md | 17 + docs/examples/postgresql/create-extension.md | 15 + docs/examples/postgresql/create-failover.md | 15 + docs/examples/postgresql/create-migration.md | 16 + .../examples/postgresql/create-restoration.md | 18 + docs/examples/postgresql/create-upgrade.md | 15 + docs/examples/postgresql/create.md | 27 + .../postgresql/delete-backup-policy.md | 15 + docs/examples/postgresql/delete-backup.md | 15 + docs/examples/postgresql/delete-branch.md | 15 + docs/examples/postgresql/delete-extension.md | 15 + docs/examples/postgresql/delete.md | 14 + docs/examples/postgresql/get-backup-policy.md | 15 + docs/examples/postgresql/get-backup.md | 15 + docs/examples/postgresql/get-pitr.md | 14 + docs/examples/postgresql/get-pooler.md | 14 + docs/examples/postgresql/get-replicas.md | 14 + docs/examples/postgresql/get-restoration.md | 15 + docs/examples/postgresql/get-status.md | 14 + docs/examples/postgresql/get.md | 14 + .../postgresql/list-backup-policies.md | 15 + docs/examples/postgresql/list-backups.md | 15 + docs/examples/postgresql/list-branches.md | 14 + docs/examples/postgresql/list-extensions.md | 14 + docs/examples/postgresql/list-operations.md | 17 + docs/examples/postgresql/list-restorations.md | 18 + .../postgresql/list-specifications.md | 12 + docs/examples/postgresql/list.md | 14 + .../postgresql/update-backup-policy.md | 19 + .../postgresql/update-backup-storage.md | 21 + .../examples/postgresql/update-credentials.md | 14 + .../examples/postgresql/update-maintenance.md | 16 + docs/examples/postgresql/update-pooler.md | 22 + docs/examples/postgresql/update.md | 34 + docs/examples/presences/delete.md | 2 +- docs/examples/presences/get.md | 2 +- docs/examples/presences/list.md | 2 +- docs/examples/presences/update.md | 2 +- docs/examples/presences/upsert.md | 2 +- .../project/create-android-platform.md | 2 +- .../examples/project/create-apple-platform.md | 2 +- docs/examples/project/create-ephemeral-key.md | 2 +- .../examples/project/create-linux-platform.md | 2 +- docs/examples/project/create-mock-phone.md | 2 +- docs/examples/project/create-smtp-test.md | 2 +- docs/examples/project/create-variable.md | 2 +- docs/examples/project/create-web-platform.md | 2 +- .../project/create-windows-platform.md | 2 +- docs/examples/project/delete-key.md | 2 +- docs/examples/project/delete-mock-phone.md | 2 +- docs/examples/project/delete-platform.md | 2 +- docs/examples/project/delete-variable.md | 2 +- docs/examples/project/get-email-template.md | 2 +- docs/examples/project/get-key.md | 2 +- docs/examples/project/get-mock-phone.md | 2 +- .../examples/project/get-o-auth-2-provider.md | 2 +- docs/examples/project/get-platform.md | 2 +- docs/examples/project/get-policy.md | 2 +- docs/examples/project/get-variable.md | 2 +- docs/examples/project/list-email-templates.md | 2 +- docs/examples/project/list-keys.md | 2 +- docs/examples/project/list-mock-phones.md | 2 +- .../project/list-o-auth-2-providers.md | 2 +- docs/examples/project/list-platforms.md | 2 +- docs/examples/project/list-policies.md | 2 +- docs/examples/project/list-variables.md | 2 +- .../project/update-android-platform.md | 2 +- .../examples/project/update-apple-platform.md | 2 +- docs/examples/project/update-auth-method.md | 2 +- .../update-deny-aliased-email-policy.md | 2 +- .../update-deny-corporate-email-policy.md | 2 +- .../update-deny-disposable-email-policy.md | 2 +- .../project/update-deny-free-email-policy.md | 2 +- .../examples/project/update-email-template.md | 2 +- docs/examples/project/update-key.md | 2 +- docs/examples/project/update-labels.md | 2 +- .../examples/project/update-linux-platform.md | 2 +- .../update-membership-privacy-policy.md | 2 +- .../project/update-mfa-factors-policy.md | 2 +- docs/examples/project/update-mock-phone.md | 2 +- .../project/update-o-auth-2-amazon.md | 2 +- .../examples/project/update-o-auth-2-apple.md | 2 +- .../project/update-o-auth-2-appwrite.md | 2 +- .../project/update-o-auth-2-auth-0.md | 2 +- .../project/update-o-auth-2-authentik.md | 2 +- .../project/update-o-auth-2-autodesk.md | 2 +- .../project/update-o-auth-2-bitbucket.md | 2 +- .../examples/project/update-o-auth-2-bitly.md | 2 +- docs/examples/project/update-o-auth-2-box.md | 2 +- .../project/update-o-auth-2-dailymotion.md | 2 +- .../project/update-o-auth-2-discord.md | 2 +- .../project/update-o-auth-2-disqus.md | 2 +- .../project/update-o-auth-2-dropbox.md | 2 +- docs/examples/project/update-o-auth-2-etsy.md | 2 +- .../project/update-o-auth-2-facebook.md | 2 +- .../examples/project/update-o-auth-2-figma.md | 2 +- .../project/update-o-auth-2-fusion-auth.md | 2 +- .../project/update-o-auth-2-git-hub.md | 2 +- .../project/update-o-auth-2-gitlab.md | 2 +- .../project/update-o-auth-2-google.md | 2 +- .../project/update-o-auth-2-hugging-face.md | 16 + .../project/update-o-auth-2-keycloak.md | 2 +- docs/examples/project/update-o-auth-2-kick.md | 2 +- .../project/update-o-auth-2-linkedin.md | 2 +- .../project/update-o-auth-2-microsoft.md | 2 +- .../project/update-o-auth-2-notion.md | 2 +- docs/examples/project/update-o-auth-2-oidc.md | 2 +- docs/examples/project/update-o-auth-2-okta.md | 4 +- .../project/update-o-auth-2-paypal-sandbox.md | 2 +- .../project/update-o-auth-2-paypal.md | 2 +- .../examples/project/update-o-auth-2-podio.md | 2 +- .../project/update-o-auth-2-salesforce.md | 2 +- .../project/update-o-auth-2-server.md | 2 +- .../examples/project/update-o-auth-2-slack.md | 2 +- .../project/update-o-auth-2-spotify.md | 2 +- .../project/update-o-auth-2-stripe.md | 2 +- .../update-o-auth-2-tradeshift-sandbox.md | 2 +- .../project/update-o-auth-2-tradeshift.md | 2 +- .../project/update-o-auth-2-twitch.md | 2 +- .../project/update-o-auth-2-word-press.md | 2 +- .../examples/project/update-o-auth-2-yahoo.md | 2 +- .../project/update-o-auth-2-yandex.md | 2 +- docs/examples/project/update-o-auth-2-zoho.md | 2 +- docs/examples/project/update-o-auth-2-zoom.md | 2 +- docs/examples/project/update-o-auth-2x.md | 2 +- .../update-password-dictionary-policy.md | 2 +- .../project/update-password-history-policy.md | 2 +- .../update-password-personal-data-policy.md | 2 +- .../update-password-strength-policy.md | 2 +- docs/examples/project/update-protocol.md | 2 +- docs/examples/project/update-service.md | 2 +- .../project/update-session-alert-policy.md | 2 +- .../project/update-session-duration-policy.md | 2 +- .../update-session-invalidation-policy.md | 2 +- .../project/update-session-limit-policy.md | 2 +- docs/examples/project/update-smtp.md | 6 +- .../project/update-user-limit-policy.md | 2 +- docs/examples/project/update-variable.md | 2 +- docs/examples/project/update-web-platform.md | 2 +- .../project/update-windows-platform.md | 2 +- docs/examples/proxy/create-api-rule.md | 2 +- docs/examples/proxy/create-function-rule.md | 4 +- docs/examples/proxy/create-invalidation.md | 4 +- docs/examples/proxy/create-redirect-rule.md | 4 +- docs/examples/proxy/create-site-rule.md | 4 +- docs/examples/proxy/delete-rule.md | 2 +- docs/examples/proxy/get-rule.md | 2 +- docs/examples/proxy/list-rules.md | 2 +- docs/examples/proxy/update-rule-status.md | 2 +- docs/examples/sites/create-deployment.md | 2 +- .../sites/create-duplicate-deployment.md | 2 +- .../sites/create-template-deployment.md | 2 +- docs/examples/sites/create-variable.md | 2 +- docs/examples/sites/create-vcs-deployment.md | 2 +- docs/examples/sites/create.md | 7 +- docs/examples/sites/delete-deployment.md | 2 +- docs/examples/sites/delete-log.md | 2 +- docs/examples/sites/delete-variable.md | 2 +- docs/examples/sites/delete.md | 2 +- .../examples/sites/get-deployment-download.md | 2 +- docs/examples/sites/get-deployment.md | 2 +- docs/examples/sites/get-log.md | 2 +- docs/examples/sites/get-variable.md | 2 +- docs/examples/sites/get.md | 2 +- docs/examples/sites/list-deployments.md | 2 +- docs/examples/sites/list-logs.md | 2 +- docs/examples/sites/list-specifications.md | 2 +- docs/examples/sites/list-variables.md | 2 +- docs/examples/sites/list.md | 2 +- .../sites/update-deployment-status.md | 2 +- docs/examples/sites/update-site-deployment.md | 2 +- docs/examples/sites/update-variable.md | 2 +- docs/examples/sites/update.md | 7 +- docs/examples/storage/create-bucket.md | 2 +- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/delete-bucket.md | 2 +- docs/examples/storage/delete-file.md | 2 +- docs/examples/storage/get-bucket.md | 2 +- docs/examples/storage/get-file-download.md | 2 +- docs/examples/storage/get-file-preview.md | 6 +- docs/examples/storage/get-file-view.md | 2 +- docs/examples/storage/get-file.md | 2 +- docs/examples/storage/list-buckets.md | 2 +- docs/examples/storage/list-files.md | 2 +- docs/examples/storage/update-bucket.md | 2 +- docs/examples/storage/update-file.md | 2 +- .../tablesdb/create-big-int-column.md | 10 +- .../tablesdb/create-boolean-column.md | 4 +- .../tablesdb/create-datetime-column.md | 4 +- docs/examples/tablesdb/create-email-column.md | 4 +- docs/examples/tablesdb/create-enum-column.md | 8 +- docs/examples/tablesdb/create-failover.md | 2 +- docs/examples/tablesdb/create-float-column.md | 10 +- docs/examples/tablesdb/create-index.md | 4 +- .../tablesdb/create-integer-column.md | 10 +- docs/examples/tablesdb/create-ip-column.md | 6 +- docs/examples/tablesdb/create-line-column.md | 8 +- .../tablesdb/create-longtext-column.md | 6 +- .../tablesdb/create-mediumtext-column.md | 6 +- docs/examples/tablesdb/create-migration.md | 2 +- docs/examples/tablesdb/create-operations.md | 20 +- docs/examples/tablesdb/create-point-column.md | 4 +- .../tablesdb/create-polygon-column.md | 11 +- .../tablesdb/create-relationship-column.md | 6 +- docs/examples/tablesdb/create-row.md | 12 +- docs/examples/tablesdb/create-rows.md | 2 +- .../examples/tablesdb/create-string-column.md | 6 +- docs/examples/tablesdb/create-table.md | 2 +- docs/examples/tablesdb/create-text-column.md | 6 +- docs/examples/tablesdb/create-transaction.md | 2 +- docs/examples/tablesdb/create-url-column.md | 4 +- .../tablesdb/create-varchar-column.md | 6 +- docs/examples/tablesdb/create.md | 2 +- docs/examples/tablesdb/cutover-migration.md | 2 +- .../examples/tablesdb/decrement-row-column.md | 8 +- docs/examples/tablesdb/delete-column.md | 2 +- docs/examples/tablesdb/delete-index.md | 2 +- docs/examples/tablesdb/delete-migration.md | 2 +- docs/examples/tablesdb/delete-row.md | 2 +- docs/examples/tablesdb/delete-rows.md | 2 +- docs/examples/tablesdb/delete-table.md | 2 +- docs/examples/tablesdb/delete-transaction.md | 2 +- docs/examples/tablesdb/delete.md | 2 +- docs/examples/tablesdb/get-column.md | 2 +- docs/examples/tablesdb/get-index.md | 2 +- docs/examples/tablesdb/get-migration.md | 2 +- docs/examples/tablesdb/get-replicas.md | 2 +- docs/examples/tablesdb/get-row.md | 2 +- docs/examples/tablesdb/get-status.md | 2 +- docs/examples/tablesdb/get-table.md | 2 +- docs/examples/tablesdb/get-transaction.md | 2 +- docs/examples/tablesdb/get.md | 2 +- .../examples/tablesdb/increment-row-column.md | 8 +- docs/examples/tablesdb/list-columns.md | 2 +- docs/examples/tablesdb/list-indexes.md | 2 +- docs/examples/tablesdb/list-migrations.md | 2 +- docs/examples/tablesdb/list-operations.md | 4 +- docs/examples/tablesdb/list-rows.md | 2 +- docs/examples/tablesdb/list-tables.md | 2 +- docs/examples/tablesdb/list-transactions.md | 2 +- docs/examples/tablesdb/list.md | 2 +- .../tablesdb/update-big-int-column.md | 10 +- .../tablesdb/update-boolean-column.md | 4 +- .../tablesdb/update-datetime-column.md | 4 +- docs/examples/tablesdb/update-email-column.md | 4 +- docs/examples/tablesdb/update-enum-column.md | 8 +- docs/examples/tablesdb/update-float-column.md | 10 +- .../tablesdb/update-integer-column.md | 10 +- docs/examples/tablesdb/update-ip-column.md | 6 +- docs/examples/tablesdb/update-line-column.md | 10 +- .../tablesdb/update-longtext-column.md | 6 +- .../tablesdb/update-mediumtext-column.md | 6 +- docs/examples/tablesdb/update-point-column.md | 4 +- .../tablesdb/update-polygon-column.md | 13 +- .../tablesdb/update-relationship-column.md | 4 +- docs/examples/tablesdb/update-row.md | 12 +- docs/examples/tablesdb/update-rows.md | 12 +- .../examples/tablesdb/update-string-column.md | 6 +- docs/examples/tablesdb/update-table.md | 2 +- docs/examples/tablesdb/update-text-column.md | 6 +- docs/examples/tablesdb/update-transaction.md | 2 +- docs/examples/tablesdb/update-url-column.md | 4 +- .../tablesdb/update-varchar-column.md | 6 +- docs/examples/tablesdb/update.md | 2 +- docs/examples/tablesdb/upsert-row.md | 12 +- docs/examples/tablesdb/upsert-rows.md | 2 +- docs/examples/teams/create-installation.md | 2 +- docs/examples/teams/create-membership.md | 2 +- docs/examples/teams/create.md | 2 +- docs/examples/teams/delete-installation.md | 2 +- docs/examples/teams/delete-membership.md | 2 +- docs/examples/teams/delete.md | 2 +- docs/examples/teams/get-installation.md | 2 +- docs/examples/teams/get-membership.md | 2 +- docs/examples/teams/get-prefs.md | 2 +- docs/examples/teams/get.md | 2 +- docs/examples/teams/list-installations.md | 2 +- docs/examples/teams/list-memberships.md | 2 +- docs/examples/teams/list.md | 2 +- docs/examples/teams/update-installation.md | 2 +- .../teams/update-membership-status.md | 2 +- docs/examples/teams/update-membership.md | 2 +- docs/examples/teams/update-name.md | 2 +- docs/examples/teams/update-prefs.md | 2 +- docs/examples/tokens/create-file-token.md | 2 +- docs/examples/tokens/delete.md | 2 +- docs/examples/tokens/get.md | 2 +- docs/examples/tokens/list.md | 2 +- docs/examples/tokens/update.md | 2 +- docs/examples/users/create-argon-2-user.md | 2 +- docs/examples/users/create-bcrypt-user.md | 2 +- docs/examples/users/create-jwt.md | 4 +- docs/examples/users/create-md-5-user.md | 2 +- .../users/create-mfa-recovery-codes.md | 2 +- docs/examples/users/create-ph-pass-user.md | 2 +- .../users/create-scrypt-modified-user.md | 2 +- docs/examples/users/create-scrypt-user.md | 10 +- docs/examples/users/create-session.md | 2 +- docs/examples/users/create-sha-user.md | 2 +- docs/examples/users/create-target.md | 2 +- docs/examples/users/create-token.md | 2 +- docs/examples/users/create.md | 2 +- docs/examples/users/delete-identity.md | 2 +- .../users/delete-mfa-authenticator.md | 2 +- docs/examples/users/delete-session.md | 2 +- docs/examples/users/delete-sessions.md | 2 +- docs/examples/users/delete-target.md | 2 +- docs/examples/users/delete.md | 2 +- docs/examples/users/get-mfa-challenge.md | 2 +- docs/examples/users/get-mfa-recovery-codes.md | 2 +- docs/examples/users/get-prefs.md | 2 +- docs/examples/users/get-target.md | 2 +- docs/examples/users/get.md | 2 +- docs/examples/users/list-identities.md | 2 +- docs/examples/users/list-logs.md | 2 +- docs/examples/users/list-memberships.md | 2 +- docs/examples/users/list-mfa-factors.md | 2 +- docs/examples/users/list-sessions.md | 2 +- docs/examples/users/list-targets.md | 2 +- docs/examples/users/list.md | 2 +- .../users/update-email-verification.md | 2 +- docs/examples/users/update-email.md | 2 +- docs/examples/users/update-impersonator.md | 2 +- docs/examples/users/update-labels.md | 2 +- .../users/update-mfa-recovery-codes.md | 2 +- docs/examples/users/update-mfa.md | 2 +- docs/examples/users/update-name.md | 2 +- docs/examples/users/update-password.md | 2 +- .../users/update-phone-verification.md | 2 +- docs/examples/users/update-phone.md | 2 +- docs/examples/users/update-prefs.md | 2 +- docs/examples/users/update-status.md | 2 +- docs/examples/users/update-target.md | 2 +- docs/examples/vectorsdb/create-collection.md | 20 + docs/examples/vectorsdb/create-document.md | 23 + docs/examples/vectorsdb/create-documents.md | 16 + docs/examples/vectorsdb/create-failover.md | 15 + docs/examples/vectorsdb/create-index.md | 20 + docs/examples/vectorsdb/create-operations.md | 25 + docs/examples/vectorsdb/create-query.md | 19 + docs/examples/vectorsdb/create-transaction.md | 14 + docs/examples/vectorsdb/create.md | 19 + docs/examples/vectorsdb/delete-collection.md | 15 + docs/examples/vectorsdb/delete-document.md | 17 + docs/examples/vectorsdb/delete-documents.md | 17 + docs/examples/vectorsdb/delete-index.md | 16 + docs/examples/vectorsdb/delete-transaction.md | 14 + docs/examples/vectorsdb/delete.md | 14 + docs/examples/vectorsdb/get-collection.md | 15 + docs/examples/vectorsdb/get-document.md | 18 + docs/examples/vectorsdb/get-index.md | 16 + docs/examples/vectorsdb/get-replicas.md | 14 + docs/examples/vectorsdb/get-status.md | 14 + docs/examples/vectorsdb/get-transaction.md | 14 + docs/examples/vectorsdb/get.md | 14 + docs/examples/vectorsdb/list-collections.md | 17 + docs/examples/vectorsdb/list-documents.md | 19 + docs/examples/vectorsdb/list-indexes.md | 17 + docs/examples/vectorsdb/list-operations.md | 17 + .../examples/vectorsdb/list-specifications.md | 12 + docs/examples/vectorsdb/list-transactions.md | 14 + docs/examples/vectorsdb/list.md | 15 + docs/examples/vectorsdb/update-collection.md | 20 + docs/examples/vectorsdb/update-document.md | 19 + docs/examples/vectorsdb/update-documents.md | 18 + docs/examples/vectorsdb/update-transaction.md | 16 + docs/examples/vectorsdb/update.md | 19 + docs/examples/vectorsdb/upsert-document.md | 19 + docs/examples/vectorsdb/upsert-documents.md | 17 + docs/examples/webhooks/create.md | 4 +- docs/examples/webhooks/delete.md | 2 +- docs/examples/webhooks/get.md | 2 +- docs/examples/webhooks/list.md | 2 +- docs/examples/webhooks/update-secret.md | 2 +- docs/examples/webhooks/update.md | 4 +- eslint.config.mjs | 43 + package-lock.json | 1461 +++- package.json | 126 +- src/client.ts | 244 +- src/enums/adapter.ts | 2 +- src/enums/attribute-status.ts | 2 +- src/enums/authentication-factor.ts | 2 +- src/enums/authenticator-type.ts | 2 +- src/enums/backup-services.ts | 2 +- src/enums/billing-plan-group.ts | 2 +- src/enums/browser-permission.ts | 2 +- src/enums/browser-theme.ts | 2 +- src/enums/browser.ts | 2 +- src/enums/build-runtime.ts | 3 +- src/enums/column-status.ts | 2 +- src/enums/compression.ts | 2 +- src/enums/credit-card.ts | 2 +- src/enums/database-status.ts | 2 +- src/enums/database-type.ts | 2 +- src/enums/databases-index-type.ts | 2 +- src/enums/deployment-download-type.ts | 2 +- src/enums/deployment-status.ts | 2 +- src/enums/documents-db-index-type.ts | 5 + src/enums/embedding-model.ts | 4 +- src/enums/execution-method.ts | 2 +- src/enums/execution-resource-type.ts | 4 + src/enums/execution-status.ts | 2 +- src/enums/execution-trigger.ts | 2 +- src/enums/flag.ts | 2 +- src/enums/framework.ts | 2 +- src/enums/image-format.ts | 2 +- src/enums/image-gravity.ts | 2 +- src/enums/index-status.ts | 2 +- src/enums/invalidation-type.ts | 2 +- src/enums/message-priority.ts | 2 +- src/enums/message-status.ts | 2 +- src/enums/messaging-provider-type.ts | 2 +- src/enums/o-auth-2-google-prompt.ts | 2 +- src/enums/o-auth-2-oidc-prompt.ts | 2 +- src/enums/o-auth-provider.ts | 3 +- src/enums/order-by.ts | 2 +- src/enums/organization-key-scopes.ts | 2 +- src/enums/password-hash.ts | 2 +- src/enums/platform-type.ts | 2 +- src/enums/project-auth-method-id.ts | 2 +- src/enums/project-email-template-id.ts | 2 +- src/enums/project-email-template-locale.ts | 2 +- src/enums/project-key-scopes.ts | 17 +- src/enums/project-o-auth-2-google-prompt.ts | 2 +- src/enums/project-o-auth-2-oidc-prompt.ts | 2 +- src/enums/project-o-auth-provider-id.ts | 3 +- src/enums/project-policy-id.ts | 2 +- src/enums/project-protocol-id.ts | 2 +- src/enums/project-service-id.ts | 2 +- src/enums/project-smtp-secure.ts | 2 +- src/enums/proxy-resource-type.ts | 2 +- .../proxy-rule-deployment-resource-type.ts | 2 +- src/enums/proxy-rule-status.ts | 2 +- src/enums/region.ts | 2 +- src/enums/relation-mutate.ts | 2 +- src/enums/relationship-type.ts | 2 +- src/enums/runtime.ts | 3 +- src/enums/smtp-encryption.ts | 2 +- src/enums/status-code.ts | 2 +- src/enums/tables-db-index-type.ts | 2 +- src/enums/template-reference-type.ts | 2 +- src/enums/timezone.ts | 2 +- src/enums/vcs-reference-type.ts | 2 +- src/enums/vectors-db-index-type.ts | 8 + src/id.ts | 7 +- src/index.ts | 8 + src/inputFile.ts | 260 +- src/models.ts | 1425 +++- src/operator.ts | 542 +- src/permission.ts | 10 +- src/query.ts | 1242 +-- src/role.ts | 61 +- src/services/account.ts | 2484 +++--- src/services/activities.ts | 82 +- src/services/advisor.ts | 273 +- src/services/apps.ts | 1307 +-- src/services/avatars.ts | 877 +- src/services/backups.ts | 677 +- src/services/databases.ts | 7105 +++++++++++----- src/services/documents-db.ts | 3809 +++++++++ src/services/embeddings.ts | 60 +- src/services/functions.ts | 2139 +++-- src/services/graphql.ts | 73 +- src/services/locale.ts | 134 +- src/services/messaging.ts | 5390 ++++++++---- src/services/mongo.ts | 2926 +++++++ src/services/mysql.ts | 3265 ++++++++ src/services/oauth-2.ts | 1122 ++- src/services/organization.ts | 1117 +-- src/services/postgresql.ts | 3477 ++++++++ src/services/presences.ts | 356 +- src/services/project.ts | 6606 +++++++++------ src/services/proxy.ts | 486 +- src/services/sites.ts | 1944 +++-- src/services/storage.ts | 1071 ++- src/services/tables-db.ts | 7361 ++++++++++++----- src/services/teams.ts | 1146 ++- src/services/tokens.ts | 274 +- src/services/users.ts | 3031 ++++--- src/services/vectors-db.ts | 3616 ++++++++ src/services/webhooks.ts | 429 +- test/client.test.js | 31 +- test/id.test.js | 4 +- test/operator.test.js | 232 +- test/permission.test.js | 21 +- test/query.test.js | 136 +- test/role.test.js | 26 +- test/services/account.test.js | 1570 ++-- test/services/activities.test.js | 94 +- test/services/advisor.test.js | 112 +- test/services/apps.test.js | 577 +- test/services/avatars.test.js | 69 +- test/services/backups.test.js | 277 +- test/services/databases.test.js | 1399 ++-- test/services/documents-d-b.test.js | 723 ++ test/services/embeddings.test.js | 27 +- test/services/functions.test.js | 916 +- test/services/graphql.test.js | 30 +- test/services/locale.test.js | 120 +- test/services/messaging.test.js | 1203 ++- test/services/mongo.test.js | 979 +++ test/services/mysql.test.js | 1038 +++ test/services/oauth2.test.js | 211 +- test/services/organization.test.js | 674 +- test/services/postgresql.test.js | 1183 +++ test/services/presences.test.js | 94 +- test/services/project.test.js | 2799 +++---- test/services/proxy.test.js | 271 +- test/services/sites.test.js | 908 +- test/services/storage.test.js | 302 +- test/services/tables-d-b.test.js | 1729 ++-- test/services/teams.test.js | 364 +- test/services/tokens.test.js | 101 +- test/services/users.test.js | 1248 ++- test/services/vectors-d-b.test.js | 695 ++ test/services/webhooks.test.js | 170 +- tsconfig.json | 2 +- tsup.config.ts | 42 +- 891 files changed, 66885 insertions(+), 26416 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 docs/examples/avatars/get-photo.md create mode 100644 docs/examples/documentsdb/create-collection.md create mode 100644 docs/examples/documentsdb/create-document.md create mode 100644 docs/examples/documentsdb/create-documents.md create mode 100644 docs/examples/documentsdb/create-failover.md create mode 100644 docs/examples/documentsdb/create-index.md create mode 100644 docs/examples/documentsdb/create-operations.md create mode 100644 docs/examples/documentsdb/create-transaction.md create mode 100644 docs/examples/documentsdb/create.md create mode 100644 docs/examples/documentsdb/decrement-document-attribute.md create mode 100644 docs/examples/documentsdb/delete-collection.md create mode 100644 docs/examples/documentsdb/delete-document.md create mode 100644 docs/examples/documentsdb/delete-documents.md create mode 100644 docs/examples/documentsdb/delete-index.md create mode 100644 docs/examples/documentsdb/delete-transaction.md create mode 100644 docs/examples/documentsdb/delete.md create mode 100644 docs/examples/documentsdb/get-collection.md create mode 100644 docs/examples/documentsdb/get-document.md create mode 100644 docs/examples/documentsdb/get-index.md create mode 100644 docs/examples/documentsdb/get-replicas.md create mode 100644 docs/examples/documentsdb/get-status.md create mode 100644 docs/examples/documentsdb/get-transaction.md create mode 100644 docs/examples/documentsdb/get.md create mode 100644 docs/examples/documentsdb/increment-document-attribute.md create mode 100644 docs/examples/documentsdb/list-collections.md create mode 100644 docs/examples/documentsdb/list-documents.md create mode 100644 docs/examples/documentsdb/list-indexes.md create mode 100644 docs/examples/documentsdb/list-operations.md create mode 100644 docs/examples/documentsdb/list-specifications.md create mode 100644 docs/examples/documentsdb/list-transactions.md create mode 100644 docs/examples/documentsdb/list.md create mode 100644 docs/examples/documentsdb/update-collection.md create mode 100644 docs/examples/documentsdb/update-document.md create mode 100644 docs/examples/documentsdb/update-documents.md create mode 100644 docs/examples/documentsdb/update-transaction.md create mode 100644 docs/examples/documentsdb/update.md create mode 100644 docs/examples/documentsdb/upsert-document.md create mode 100644 docs/examples/documentsdb/upsert-documents.md create mode 100644 docs/examples/mongo/create-backup-policy.md create mode 100644 docs/examples/mongo/create-backup.md create mode 100644 docs/examples/mongo/create-branch.md create mode 100644 docs/examples/mongo/create-failover.md create mode 100644 docs/examples/mongo/create-migration.md create mode 100644 docs/examples/mongo/create-restoration.md create mode 100644 docs/examples/mongo/create-upgrade.md create mode 100644 docs/examples/mongo/create.md create mode 100644 docs/examples/mongo/delete-backup-policy.md create mode 100644 docs/examples/mongo/delete-backup.md create mode 100644 docs/examples/mongo/delete-branch.md create mode 100644 docs/examples/mongo/delete.md create mode 100644 docs/examples/mongo/get-backup-policy.md create mode 100644 docs/examples/mongo/get-backup.md create mode 100644 docs/examples/mongo/get-pitr.md create mode 100644 docs/examples/mongo/get-replicas.md create mode 100644 docs/examples/mongo/get-restoration.md create mode 100644 docs/examples/mongo/get-status.md create mode 100644 docs/examples/mongo/get.md create mode 100644 docs/examples/mongo/list-backup-policies.md create mode 100644 docs/examples/mongo/list-backups.md create mode 100644 docs/examples/mongo/list-branches.md create mode 100644 docs/examples/mongo/list-operations.md create mode 100644 docs/examples/mongo/list-restorations.md create mode 100644 docs/examples/mongo/list-specifications.md create mode 100644 docs/examples/mongo/list.md create mode 100644 docs/examples/mongo/update-backup-policy.md create mode 100644 docs/examples/mongo/update-backup-storage.md create mode 100644 docs/examples/mongo/update-credentials.md create mode 100644 docs/examples/mongo/update-maintenance.md create mode 100644 docs/examples/mongo/update.md create mode 100644 docs/examples/mysql/create-backup-policy.md create mode 100644 docs/examples/mysql/create-backup.md create mode 100644 docs/examples/mysql/create-branch.md create mode 100644 docs/examples/mysql/create-execution.md create mode 100644 docs/examples/mysql/create-failover.md create mode 100644 docs/examples/mysql/create-migration.md create mode 100644 docs/examples/mysql/create-restoration.md create mode 100644 docs/examples/mysql/create-upgrade.md create mode 100644 docs/examples/mysql/create.md create mode 100644 docs/examples/mysql/delete-backup-policy.md create mode 100644 docs/examples/mysql/delete-backup.md create mode 100644 docs/examples/mysql/delete-branch.md create mode 100644 docs/examples/mysql/delete.md create mode 100644 docs/examples/mysql/get-backup-policy.md create mode 100644 docs/examples/mysql/get-backup.md create mode 100644 docs/examples/mysql/get-pitr.md create mode 100644 docs/examples/mysql/get-pooler.md create mode 100644 docs/examples/mysql/get-replicas.md create mode 100644 docs/examples/mysql/get-restoration.md create mode 100644 docs/examples/mysql/get-status.md create mode 100644 docs/examples/mysql/get.md create mode 100644 docs/examples/mysql/list-backup-policies.md create mode 100644 docs/examples/mysql/list-backups.md create mode 100644 docs/examples/mysql/list-branches.md create mode 100644 docs/examples/mysql/list-operations.md create mode 100644 docs/examples/mysql/list-restorations.md create mode 100644 docs/examples/mysql/list-specifications.md create mode 100644 docs/examples/mysql/list.md create mode 100644 docs/examples/mysql/update-backup-policy.md create mode 100644 docs/examples/mysql/update-backup-storage.md create mode 100644 docs/examples/mysql/update-credentials.md create mode 100644 docs/examples/mysql/update-maintenance.md create mode 100644 docs/examples/mysql/update-pooler.md create mode 100644 docs/examples/mysql/update.md create mode 100644 docs/examples/postgresql/create-backup-policy.md create mode 100644 docs/examples/postgresql/create-backup.md create mode 100644 docs/examples/postgresql/create-branch.md create mode 100644 docs/examples/postgresql/create-execution.md create mode 100644 docs/examples/postgresql/create-extension.md create mode 100644 docs/examples/postgresql/create-failover.md create mode 100644 docs/examples/postgresql/create-migration.md create mode 100644 docs/examples/postgresql/create-restoration.md create mode 100644 docs/examples/postgresql/create-upgrade.md create mode 100644 docs/examples/postgresql/create.md create mode 100644 docs/examples/postgresql/delete-backup-policy.md create mode 100644 docs/examples/postgresql/delete-backup.md create mode 100644 docs/examples/postgresql/delete-branch.md create mode 100644 docs/examples/postgresql/delete-extension.md create mode 100644 docs/examples/postgresql/delete.md create mode 100644 docs/examples/postgresql/get-backup-policy.md create mode 100644 docs/examples/postgresql/get-backup.md create mode 100644 docs/examples/postgresql/get-pitr.md create mode 100644 docs/examples/postgresql/get-pooler.md create mode 100644 docs/examples/postgresql/get-replicas.md create mode 100644 docs/examples/postgresql/get-restoration.md create mode 100644 docs/examples/postgresql/get-status.md create mode 100644 docs/examples/postgresql/get.md create mode 100644 docs/examples/postgresql/list-backup-policies.md create mode 100644 docs/examples/postgresql/list-backups.md create mode 100644 docs/examples/postgresql/list-branches.md create mode 100644 docs/examples/postgresql/list-extensions.md create mode 100644 docs/examples/postgresql/list-operations.md create mode 100644 docs/examples/postgresql/list-restorations.md create mode 100644 docs/examples/postgresql/list-specifications.md create mode 100644 docs/examples/postgresql/list.md create mode 100644 docs/examples/postgresql/update-backup-policy.md create mode 100644 docs/examples/postgresql/update-backup-storage.md create mode 100644 docs/examples/postgresql/update-credentials.md create mode 100644 docs/examples/postgresql/update-maintenance.md create mode 100644 docs/examples/postgresql/update-pooler.md create mode 100644 docs/examples/postgresql/update.md create mode 100644 docs/examples/project/update-o-auth-2-hugging-face.md create mode 100644 docs/examples/vectorsdb/create-collection.md create mode 100644 docs/examples/vectorsdb/create-document.md create mode 100644 docs/examples/vectorsdb/create-documents.md create mode 100644 docs/examples/vectorsdb/create-failover.md create mode 100644 docs/examples/vectorsdb/create-index.md create mode 100644 docs/examples/vectorsdb/create-operations.md create mode 100644 docs/examples/vectorsdb/create-query.md create mode 100644 docs/examples/vectorsdb/create-transaction.md create mode 100644 docs/examples/vectorsdb/create.md create mode 100644 docs/examples/vectorsdb/delete-collection.md create mode 100644 docs/examples/vectorsdb/delete-document.md create mode 100644 docs/examples/vectorsdb/delete-documents.md create mode 100644 docs/examples/vectorsdb/delete-index.md create mode 100644 docs/examples/vectorsdb/delete-transaction.md create mode 100644 docs/examples/vectorsdb/delete.md create mode 100644 docs/examples/vectorsdb/get-collection.md create mode 100644 docs/examples/vectorsdb/get-document.md create mode 100644 docs/examples/vectorsdb/get-index.md create mode 100644 docs/examples/vectorsdb/get-replicas.md create mode 100644 docs/examples/vectorsdb/get-status.md create mode 100644 docs/examples/vectorsdb/get-transaction.md create mode 100644 docs/examples/vectorsdb/get.md create mode 100644 docs/examples/vectorsdb/list-collections.md create mode 100644 docs/examples/vectorsdb/list-documents.md create mode 100644 docs/examples/vectorsdb/list-indexes.md create mode 100644 docs/examples/vectorsdb/list-operations.md create mode 100644 docs/examples/vectorsdb/list-specifications.md create mode 100644 docs/examples/vectorsdb/list-transactions.md create mode 100644 docs/examples/vectorsdb/list.md create mode 100644 docs/examples/vectorsdb/update-collection.md create mode 100644 docs/examples/vectorsdb/update-document.md create mode 100644 docs/examples/vectorsdb/update-documents.md create mode 100644 docs/examples/vectorsdb/update-transaction.md create mode 100644 docs/examples/vectorsdb/update.md create mode 100644 docs/examples/vectorsdb/upsert-document.md create mode 100644 docs/examples/vectorsdb/upsert-documents.md create mode 100644 eslint.config.mjs create mode 100644 src/enums/documents-db-index-type.ts create mode 100644 src/enums/execution-resource-type.ts create mode 100644 src/enums/vectors-db-index-type.ts create mode 100644 src/services/documents-db.ts create mode 100644 src/services/mongo.ts create mode 100644 src/services/mysql.ts create mode 100644 src/services/postgresql.ts create mode 100644 src/services/vectors-db.ts create mode 100644 test/services/documents-d-b.test.js create mode 100644 test/services/mongo.test.js create mode 100644 test/services/mysql.test.js create mode 100644 test/services/postgresql.test.js create mode 100644 test/services/vectors-d-b.test.js diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c14dbf0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +node_modules/ +dist/ +types/ +package-lock.json + +# CI workflow files follow the YAML conventions of the publishing repository, +# not this SDK's source formatting. +.github/ + +# README and CHANGELOG carry caller-supplied markdown verbatim, which this +# SDK's formatter must not rewrite. +README.md +CHANGELOG.md diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..9b0bb43 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 4, + "singleQuote": true +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b5d09b..ba0202b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Change Log +## 28.1.0-rc.1 + +* Added: `documentsDB`, `vectorsDB`, `mysql`, `postgresql`, and `mongo` services, no longer hidden from server SDKs +* Added: `DocumentsDBIndexType` and `VectorsDBIndexType` enums +* Added: dedicated database models for branches, backups, restorations, poolers, PITR windows, extensions, and executions +* Added: `PostgresExtension`, `VectorsdbCollection`, `AttributeObject`, and `AttributeVector` models +* Added: `ExecutionResourceType` enum and `resourceType` on the `Execution` model +* Added: `OAuth2HuggingFace` model and the `huggingface` OAuth provider +* Added: `userId`, `emailHash`, and `name` parameters to `avatars.getPhoto` +* Added: `error`, `containerStatus`, and `lifecycleState` on the `Database` model +* Added: `changelogWatermark` on the `DatabaseMigration` model +* Added: `total` on the `DedicatedDatabaseBranchList` model +* Updated: `DedicatedDatabaseOperation.status` documents the new `queued` state + ## 28.0.0 * Breaking: removed `account.createJWT`; use `users.createJWT` instead. A leaked JWT could mint further JWTs, letting a credential outlive its own expiry — a session cannot duplicate itself to live forever either diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 125d73b..fcc1ff1 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.createEmailPasswordSession({ email: 'email@example.com', - password: 'password' + password: 'password', }); ``` diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index cebf1f6..639d3e1 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -11,6 +11,6 @@ const account = new sdk.Account(client); const result = await account.createEmailToken({ userId: '', email: 'email@example.com', - phrase: false // optional + phrase: false, // optional }); ``` diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md index 6c74da9..15111f2 100644 --- a/docs/examples/account/create-email-verification.md +++ b/docs/examples/account/create-email-verification.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.createEmailVerification({ - url: 'https://example.com' + url: 'https://example.com', }); ``` diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index ee5f143..e1a8501 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -12,6 +12,6 @@ const result = await account.createMagicURLToken({ userId: '', email: 'email@example.com', url: 'https://example.com', // optional - phrase: false // optional + phrase: false, // optional }); ``` diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 25081e2..7574207 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.createMFAAuthenticator({ - type: sdk.AuthenticatorType.Totp + type: sdk.AuthenticatorType.Totp, }); ``` diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index af4e044..d3550e3 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.createMFAChallenge({ - factor: sdk.AuthenticationFactor.Email + factor: sdk.AuthenticationFactor.Email, }); ``` diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index 7bc8a24..40e1d1f 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -12,6 +12,6 @@ const result = await account.createOAuth2Token({ provider: sdk.OAuthProvider.Amazon, success: 'https://example.com', // optional failure: 'https://example.com', // optional - scopes: [] // optional + scopes: [], // optional }); ``` diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 999f3e1..d40e003 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.createPhoneToken({ userId: '', - phone: '+12065550100' + phone: '+12065550100', }); ``` diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 4dd41d7..9b6d8f3 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.createRecovery({ email: 'email@example.com', - url: 'https://example.com' + url: 'https://example.com', }); ``` diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 3ab786f..75a2ee4 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.createSession({ userId: '', - secret: '' + secret: '', }); ``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 95dec7e..abe7084 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.createVerification({ - url: 'https://example.com' + url: 'https://example.com', }); ``` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index abc8c13..2c94473 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -12,6 +12,6 @@ const result = await account.create({ userId: '', email: 'email@example.com', password: 'password', - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/account/delete-consent-token.md b/docs/examples/account/delete-consent-token.md index 3b45b09..5b77617 100644 --- a/docs/examples/account/delete-consent-token.md +++ b/docs/examples/account/delete-consent-token.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.deleteConsentToken({ consentId: '', - tokenId: '' + tokenId: '', }); ``` diff --git a/docs/examples/account/delete-consent.md b/docs/examples/account/delete-consent.md index eb93aba..3265e8f 100644 --- a/docs/examples/account/delete-consent.md +++ b/docs/examples/account/delete-consent.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.deleteConsent({ - consentId: '' + consentId: '', }); ``` diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 53a043b..050134c 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.deleteIdentity({ - identityId: '' + identityId: '', }); ``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 18522f2..b3e5156 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.deleteMFAAuthenticator({ - type: sdk.AuthenticatorType.Totp + type: sdk.AuthenticatorType.Totp, }); ``` diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 7fe49e3..ed992d4 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.deleteSession({ - sessionId: '' + sessionId: '', }); ``` diff --git a/docs/examples/account/get-consent-token.md b/docs/examples/account/get-consent-token.md index 3ae6c1e..f2b7e1e 100644 --- a/docs/examples/account/get-consent-token.md +++ b/docs/examples/account/get-consent-token.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.getConsentToken({ consentId: '', - tokenId: '' + tokenId: '', }); ``` diff --git a/docs/examples/account/get-consent.md b/docs/examples/account/get-consent.md index fc7cb6c..77e8e39 100644 --- a/docs/examples/account/get-consent.md +++ b/docs/examples/account/get-consent.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.getConsent({ - consentId: '' + consentId: '', }); ``` diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index dab8159..7ccfd77 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.getSession({ - sessionId: '' + sessionId: '', }); ``` diff --git a/docs/examples/account/list-consent-tokens.md b/docs/examples/account/list-consent-tokens.md index d271066..0b12b44 100644 --- a/docs/examples/account/list-consent-tokens.md +++ b/docs/examples/account/list-consent-tokens.md @@ -11,6 +11,6 @@ const account = new sdk.Account(client); const result = await account.listConsentTokens({ consentId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/account/list-consents.md b/docs/examples/account/list-consents.md index 12ec54e..7553093 100644 --- a/docs/examples/account/list-consents.md +++ b/docs/examples/account/list-consents.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.listConsents({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 00d60b9..e538a49 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.listIdentities({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index d7e8933..6d99310 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.listLogs({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md index 4fd5953..49f012f 100644 --- a/docs/examples/account/update-email-verification.md +++ b/docs/examples/account/update-email-verification.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updateEmailVerification({ userId: '', - secret: '' + secret: '', }); ``` diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 985c189..ed5188a 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updateEmail({ email: 'email@example.com', - password: 'password' + password: 'password', }); ``` diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index 1811200..790f69f 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updateMagicURLSession({ userId: '', - secret: '' + secret: '', }); ``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index fa34ef4..5f3edbe 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updateMFAAuthenticator({ type: sdk.AuthenticatorType.Totp, - otp: '' + otp: '', }); ``` diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index a584356..01defd1 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updateMFAChallenge({ challengeId: '', - otp: '' + otp: '', }); ``` diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md index 38604a3..63fa217 100644 --- a/docs/examples/account/update-mfa.md +++ b/docs/examples/account/update-mfa.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.updateMFA({ - mfa: false + mfa: false, }); ``` diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 24fb869..20bac30 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.updateName({ - name: '' + name: '', }); ``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index d359b34..cef8c69 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updatePassword({ password: 'password', - oldPassword: 'password' // optional + oldPassword: 'password', // optional }); ``` diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 204c33a..5a2035e 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updatePhoneSession({ userId: '', - secret: '' + secret: '', }); ``` diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index c5e1abd..796cdfa 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updatePhoneVerification({ userId: '', - secret: '' + secret: '', }); ``` diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index c676302..29158e3 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updatePhone({ phone: '+12065550100', - password: 'password' + password: 'password', }); ``` diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index 65c70e0..a4b167f 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -10,9 +10,9 @@ const account = new sdk.Account(client); const result = await account.updatePrefs({ prefs: { - "language": "en", - "timezone": "UTC", - "darkTheme": true - } + language: 'en', + timezone: 'UTC', + darkTheme: true, + }, }); ``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 9008f67..a33078b 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -11,6 +11,6 @@ const account = new sdk.Account(client); const result = await account.updateRecovery({ userId: '', secret: '', - password: 'password' + password: 'password', }); ``` diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 9dfcbf2..1e25727 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const account = new sdk.Account(client); const result = await account.updateSession({ - sessionId: '' + sessionId: '', }); ``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 0486ce3..6a73362 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -10,6 +10,6 @@ const account = new sdk.Account(client); const result = await account.updateVerification({ userId: '', - secret: '' + secret: '', }); ``` diff --git a/docs/examples/activities/get-event.md b/docs/examples/activities/get-event.md index da7c261..0cd3641 100644 --- a/docs/examples/activities/get-event.md +++ b/docs/examples/activities/get-event.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const activities = new sdk.Activities(client); const result = await activities.getEvent({ - eventId: '' + eventId: '', }); ``` diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md index 9926395..97f14e3 100644 --- a/docs/examples/activities/list-events.md +++ b/docs/examples/activities/list-events.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const activities = new sdk.Activities(client); const result = await activities.listEvents({ - queries: [] // optional + queries: [], // optional }); ``` diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md index 8169db0..16929bb 100644 --- a/docs/examples/advisor/delete-report.md +++ b/docs/examples/advisor/delete-report.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const advisor = new sdk.Advisor(client); const result = await advisor.deleteReport({ - reportId: '' + reportId: '', }); ``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md index 7a625d2..882d5ed 100644 --- a/docs/examples/advisor/get-insight.md +++ b/docs/examples/advisor/get-insight.md @@ -10,6 +10,6 @@ const advisor = new sdk.Advisor(client); const result = await advisor.getInsight({ reportId: '', - insightId: '' + insightId: '', }); ``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md index abd111c..a523bdc 100644 --- a/docs/examples/advisor/get-report.md +++ b/docs/examples/advisor/get-report.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const advisor = new sdk.Advisor(client); const result = await advisor.getReport({ - reportId: '' + reportId: '', }); ``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md index a4adefa..6b1d5ea 100644 --- a/docs/examples/advisor/list-insights.md +++ b/docs/examples/advisor/list-insights.md @@ -11,6 +11,6 @@ const advisor = new sdk.Advisor(client); const result = await advisor.listInsights({ reportId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md index 6fa66f1..328570e 100644 --- a/docs/examples/advisor/list-reports.md +++ b/docs/examples/advisor/list-reports.md @@ -10,6 +10,6 @@ const advisor = new sdk.Advisor(client); const result = await advisor.listReports({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/apps/create-installation-token.md b/docs/examples/apps/create-installation-token.md index 2b41452..dca0785 100644 --- a/docs/examples/apps/create-installation-token.md +++ b/docs/examples/apps/create-installation-token.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.createInstallationToken({ appId: '', - installationId: '' + installationId: '', }); ``` diff --git a/docs/examples/apps/create-key.md b/docs/examples/apps/create-key.md index 0b35816..db5d4de 100644 --- a/docs/examples/apps/create-key.md +++ b/docs/examples/apps/create-key.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const apps = new sdk.Apps(client); const result = await apps.createKey({ - appId: '' + appId: '', }); ``` diff --git a/docs/examples/apps/create-secret.md b/docs/examples/apps/create-secret.md index 1f85104..e5a77ea 100644 --- a/docs/examples/apps/create-secret.md +++ b/docs/examples/apps/create-secret.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const apps = new sdk.Apps(client); const result = await apps.createSecret({ - appId: '' + appId: '', }); ``` diff --git a/docs/examples/apps/create.md b/docs/examples/apps/create.md index 80339c5..613325e 100644 --- a/docs/examples/apps/create.md +++ b/docs/examples/apps/create.md @@ -27,6 +27,6 @@ const result = await apps.create({ enabled: false, // optional type: 'public', // optional deviceFlow: false, // optional - teamId: '' // optional + teamId: '', // optional }); ``` diff --git a/docs/examples/apps/delete-installation.md b/docs/examples/apps/delete-installation.md index b9933fb..ca3c470 100644 --- a/docs/examples/apps/delete-installation.md +++ b/docs/examples/apps/delete-installation.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.deleteInstallation({ appId: '', - installationId: '' + installationId: '', }); ``` diff --git a/docs/examples/apps/delete-key.md b/docs/examples/apps/delete-key.md index f4f0bb5..df1050d 100644 --- a/docs/examples/apps/delete-key.md +++ b/docs/examples/apps/delete-key.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.deleteKey({ appId: '', - keyId: '' + keyId: '', }); ``` diff --git a/docs/examples/apps/delete-secret.md b/docs/examples/apps/delete-secret.md index eeb1e43..0fca77d 100644 --- a/docs/examples/apps/delete-secret.md +++ b/docs/examples/apps/delete-secret.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.deleteSecret({ appId: '', - secretId: '' + secretId: '', }); ``` diff --git a/docs/examples/apps/delete-tokens.md b/docs/examples/apps/delete-tokens.md index 757af7d..e495a1d 100644 --- a/docs/examples/apps/delete-tokens.md +++ b/docs/examples/apps/delete-tokens.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const apps = new sdk.Apps(client); const result = await apps.deleteTokens({ - appId: '' + appId: '', }); ``` diff --git a/docs/examples/apps/delete.md b/docs/examples/apps/delete.md index fd9138c..366a2f5 100644 --- a/docs/examples/apps/delete.md +++ b/docs/examples/apps/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const apps = new sdk.Apps(client); const result = await apps.delete({ - appId: '' + appId: '', }); ``` diff --git a/docs/examples/apps/get-installation.md b/docs/examples/apps/get-installation.md index ceddee2..fb25747 100644 --- a/docs/examples/apps/get-installation.md +++ b/docs/examples/apps/get-installation.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.getInstallation({ appId: '', - installationId: '' + installationId: '', }); ``` diff --git a/docs/examples/apps/get-key.md b/docs/examples/apps/get-key.md index afc83cc..f6adfab 100644 --- a/docs/examples/apps/get-key.md +++ b/docs/examples/apps/get-key.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.getKey({ appId: '', - keyId: '' + keyId: '', }); ``` diff --git a/docs/examples/apps/get-secret.md b/docs/examples/apps/get-secret.md index 4d6a0ec..16e7b0e 100644 --- a/docs/examples/apps/get-secret.md +++ b/docs/examples/apps/get-secret.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.getSecret({ appId: '', - secretId: '' + secretId: '', }); ``` diff --git a/docs/examples/apps/get.md b/docs/examples/apps/get.md index 660c4f4..adb7639 100644 --- a/docs/examples/apps/get.md +++ b/docs/examples/apps/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const apps = new sdk.Apps(client); const result = await apps.get({ - appId: '' + appId: '', }); ``` diff --git a/docs/examples/apps/list-installations.md b/docs/examples/apps/list-installations.md index 4bb7197..885c5b5 100644 --- a/docs/examples/apps/list-installations.md +++ b/docs/examples/apps/list-installations.md @@ -11,6 +11,6 @@ const apps = new sdk.Apps(client); const result = await apps.listInstallations({ appId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/apps/list-keys.md b/docs/examples/apps/list-keys.md index 3a2198f..ce9b27d 100644 --- a/docs/examples/apps/list-keys.md +++ b/docs/examples/apps/list-keys.md @@ -11,6 +11,6 @@ const apps = new sdk.Apps(client); const result = await apps.listKeys({ appId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/apps/list-secrets.md b/docs/examples/apps/list-secrets.md index d1155a5..4784753 100644 --- a/docs/examples/apps/list-secrets.md +++ b/docs/examples/apps/list-secrets.md @@ -11,6 +11,6 @@ const apps = new sdk.Apps(client); const result = await apps.listSecrets({ appId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/apps/list.md b/docs/examples/apps/list.md index d594293..ed2c0b1 100644 --- a/docs/examples/apps/list.md +++ b/docs/examples/apps/list.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.list({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/apps/update-labels.md b/docs/examples/apps/update-labels.md index 67a98fc..d0e3cf3 100644 --- a/docs/examples/apps/update-labels.md +++ b/docs/examples/apps/update-labels.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.updateLabels({ appId: '', - labels: [] + labels: [], }); ``` diff --git a/docs/examples/apps/update-team.md b/docs/examples/apps/update-team.md index 65828dc..856e06b 100644 --- a/docs/examples/apps/update-team.md +++ b/docs/examples/apps/update-team.md @@ -10,6 +10,6 @@ const apps = new sdk.Apps(client); const result = await apps.updateTeam({ appId: '', - teamId: '' + teamId: '', }); ``` diff --git a/docs/examples/apps/update.md b/docs/examples/apps/update.md index 2ac2e58..ac8b86a 100644 --- a/docs/examples/apps/update.md +++ b/docs/examples/apps/update.md @@ -28,6 +28,6 @@ const result = await apps.update({ type: 'public', // optional deviceFlow: false, // optional installationScopes: [], // optional - installationRedirectUrl: 'https://example.com' // optional + installationRedirectUrl: 'https://example.com', // optional }); ``` diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 6ffb388..be84bc5 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -12,6 +12,6 @@ const result = await avatars.getBrowser({ code: sdk.Browser.AvantBrowser, width: 0, // optional height: 0, // optional - quality: -1 // optional + quality: -1, // optional }); ``` diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index ea806ba..86c2706 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -12,6 +12,6 @@ const result = await avatars.getCreditCard({ code: sdk.CreditCard.AmericanExpress, width: 0, // optional height: 0, // optional - quality: -1 // optional + quality: -1, // optional }); ``` diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index bd9ae2c..d9ba409 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const avatars = new sdk.Avatars(client); const result = await avatars.getFavicon({ - url: 'https://example.com' + url: 'https://example.com', }); ``` diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index d05b666..bbf954b 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -12,6 +12,6 @@ const result = await avatars.getFlag({ code: sdk.Flag.Afghanistan, width: 0, // optional height: 0, // optional - quality: -1 // optional + quality: -1, // optional }); ``` diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index 6f013db..89b6c73 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -11,6 +11,6 @@ const avatars = new sdk.Avatars(client); const result = await avatars.getImage({ url: 'https://example.com', width: 0, // optional - height: 0 // optional + height: 0, // optional }); ``` diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 3d35c6d..ee56506 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -12,6 +12,6 @@ const result = await avatars.getInitials({ name: '', // optional width: 0, // optional height: 0, // optional - background: '' // optional + background: 'FFFFFF', // optional }); ``` diff --git a/docs/examples/avatars/get-photo.md b/docs/examples/avatars/get-photo.md new file mode 100644 index 0000000..8421fbb --- /dev/null +++ b/docs/examples/avatars/get-photo.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getPhoto({ + width: 0, // optional + height: 0, // optional + quality: 0, // optional + output: 'png', // optional + rating: 'g', // optional + userId: 'current()', // optional + emailHash: '', // optional + name: '', // optional +}); +``` diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md index e4235a3..791202e 100644 --- a/docs/examples/avatars/get-qr.md +++ b/docs/examples/avatars/get-qr.md @@ -12,6 +12,6 @@ const result = await avatars.getQR({ text: '', size: 1, // optional margin: 0, // optional - download: false // optional + download: false, // optional }); ``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index d83f24a..708db1c 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -11,14 +11,15 @@ const avatars = new sdk.Avatars(client); const result = await avatars.getScreenshot({ url: 'https://example.com', headers: { - "Authorization": "Bearer token123", - "X-Custom-Header": "value" + Authorization: 'Bearer token123', + 'X-Custom-Header': 'value', }, // optional viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional theme: sdk.BrowserTheme.Dark, // optional - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional + userAgent: + 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional fullpage: true, // optional locale: 'en-US', // optional timezone: sdk.Timezone.AfricaAbidjan, // optional @@ -26,11 +27,14 @@ const result = await avatars.getScreenshot({ longitude: -122.4194, // optional accuracy: 100, // optional touch: true, // optional - permissions: [sdk.BrowserPermission.Geolocation, sdk.BrowserPermission.Notifications], // optional + permissions: [ + sdk.BrowserPermission.Geolocation, + sdk.BrowserPermission.Notifications, + ], // optional sleep: 3, // optional width: 800, // optional height: 600, // optional quality: 85, // optional - output: sdk.ImageFormat.Jpeg // optional + output: sdk.ImageFormat.Jpeg, // optional }); ``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md index 1a11d45..9a8d2a5 100644 --- a/docs/examples/backups/create-archive.md +++ b/docs/examples/backups/create-archive.md @@ -10,6 +10,6 @@ const backups = new sdk.Backups(client); const result = await backups.createArchive({ services: [sdk.BackupServices.Databases], - resourceId: '' // optional + resourceId: '', // optional }); ``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md index 7167092..46774bf 100644 --- a/docs/examples/backups/create-policy.md +++ b/docs/examples/backups/create-policy.md @@ -15,6 +15,6 @@ const result = await backups.createPolicy({ schedule: '', name: '', // optional resourceId: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index f41a234..40a4447 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -12,6 +12,6 @@ const result = await backups.createRestoration({ archiveId: '', services: [sdk.BackupServices.Databases], newResourceId: '', // optional - newResourceName: '' // optional + newResourceName: '', // optional }); ``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md index f0c5615..babedbc 100644 --- a/docs/examples/backups/delete-archive.md +++ b/docs/examples/backups/delete-archive.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.deleteArchive({ - archiveId: '' + archiveId: '', }); ``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md index 493e89e..69dd413 100644 --- a/docs/examples/backups/delete-policy.md +++ b/docs/examples/backups/delete-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.deletePolicy({ - policyId: '' + policyId: '', }); ``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md index ade4e22..0e8c144 100644 --- a/docs/examples/backups/get-archive.md +++ b/docs/examples/backups/get-archive.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.getArchive({ - archiveId: '' + archiveId: '', }); ``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md index 391c019..838e8d5 100644 --- a/docs/examples/backups/get-policy.md +++ b/docs/examples/backups/get-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.getPolicy({ - policyId: '' + policyId: '', }); ``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md index 46d18f3..37e1c6b 100644 --- a/docs/examples/backups/get-restoration.md +++ b/docs/examples/backups/get-restoration.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.getRestoration({ - restorationId: '' + restorationId: '', }); ``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md index d6f51c5..4e4ff60 100644 --- a/docs/examples/backups/list-archives.md +++ b/docs/examples/backups/list-archives.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.listArchives({ - queries: [] // optional + queries: [], // optional }); ``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md index 7f87b1d..322024b 100644 --- a/docs/examples/backups/list-policies.md +++ b/docs/examples/backups/list-policies.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.listPolicies({ - queries: [] // optional + queries: [], // optional }); ``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md index 4475a17..5ea7e0a 100644 --- a/docs/examples/backups/list-restorations.md +++ b/docs/examples/backups/list-restorations.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const backups = new sdk.Backups(client); const result = await backups.listRestorations({ - queries: [] // optional + queries: [], // optional }); ``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md index 5912b39..69af997 100644 --- a/docs/examples/backups/update-policy.md +++ b/docs/examples/backups/update-policy.md @@ -13,6 +13,6 @@ const result = await backups.updatePolicy({ name: '', // optional retention: 1, // optional schedule: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md index 3d40ce7..f52034e 100644 --- a/docs/examples/databases/create-big-int-attribute.md +++ b/docs/examples/databases/create-big-int-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.createBigIntAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional + min: 0, // optional + max: 1000000, // optional + xdefault: 0, // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 606ca49..88aac35 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.createBooleanAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: false, // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index b58e091..8eda415 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -16,6 +16,6 @@ const result = await databases.createCollection({ documentSecurity: false, // optional enabled: false, // optional attributes: [], // optional - indexes: [] // optional + indexes: [], // optional }); ``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 361ee95..0a90cbc 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.createDatetimeAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: '2020-10-15T06:38:00.000+00:00', // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 3c38b69..f9147df 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -13,13 +13,13 @@ const result = await databases.createDocument({ collectionId: '', documentId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 30, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, }, permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 60f4eab..29f1204 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -12,6 +12,6 @@ const result = await databases.createDocuments({ databaseId: '', collectionId: '', documents: [], - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 13382c3..0f2f7ac 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.createEmailAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: 'email@example.com', // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index fe7abce..fddf585 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.createEnumAttribute({ databaseId: '', collectionId: '', - key: '', - elements: [], + key: '', + elements: ['active', 'inactive'], required: false, - xdefault: '', // optional - array: false // optional + xdefault: 'active', // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index f179528..ebf6ef5 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.createFloatAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional + min: 0, // optional + max: 100, // optional + xdefault: 10.5, // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index ba3bf3a..095bd46 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.createIndex({ databaseId: '', collectionId: '', - key: '', + key: '', type: sdk.DatabasesIndexType.Key, attributes: [], orders: [sdk.OrderBy.Asc], // optional - lengths: [] // optional + lengths: [], // optional }); ``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index d0dbed9..b9f5654 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.createIntegerAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional + min: 0, // optional + max: 100, // optional + xdefault: 10, // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index c21ad54..edcee67 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.createIpAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', // optional - array: false // optional + xdefault: '192.0.2.0', // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 8d61509..01ae03e 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -11,8 +11,12 @@ const databases = new sdk.Databases(client); const result = await databases.createLineAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional + xdefault: [ + [1, 2], + [3, 4], + [5, 6], + ], // optional }); ``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index b49077e..6685fde 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.createLongtextAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 44d9199..ed950b4 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.createMediumtextAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index 06a3c46..42e5189 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -11,15 +11,15 @@ const databases = new sdk.Databases(client); const result = await databases.createOperations({ transactionId: '', operations: [ - { - "action": "create", - "databaseId": "", - "collectionId": "", - "documentId": "", - "data": { - "name": "Walter O'Brien" - } - } - ] // optional + { + action: 'create', + databaseId: '', + collectionId: '', + documentId: '', + data: { + name: "Walter O'Brien", + }, + }, + ], // optional }); ``` diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 5705875..6825bfe 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -11,8 +11,8 @@ const databases = new sdk.Databases(client); const result = await databases.createPointAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: [1, 2] // optional + xdefault: [1, 2], // optional }); ``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index f3562ab..c155e13 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -11,8 +11,15 @@ const databases = new sdk.Databases(client); const result = await databases.createPolygonAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional + xdefault: [ + [ + [1, 2], + [3, 4], + [5, 6], + [1, 2], + ], + ], // optional }); ``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 30d4dfd..4d79cf4 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -14,8 +14,8 @@ const result = await databases.createRelationshipAttribute({ relatedCollectionId: '', type: sdk.RelationshipType.OneToOne, twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: sdk.RelationMutate.Cascade // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: sdk.RelationMutate.Cascade, // optional }); ``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index e0c2cdb..187afaf 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.createStringAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', size: 1, required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index 48fd6de..3dec73c 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.createTextAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md index 8785149..2ef16fc 100644 --- a/docs/examples/databases/create-transaction.md +++ b/docs/examples/databases/create-transaction.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const databases = new sdk.Databases(client); const result = await databases.createTransaction({ - ttl: 60 // optional + ttl: 60, // optional }); ``` diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index f0d1a29..41c5db9 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.createUrlAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: 'https://example.com', // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index 6458274..ce55e84 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.createVarcharAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', size: 1, required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index d35731b..ce42a13 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.create({ databaseId: '', name: '', - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index 80fe248..c48bf9b 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -12,9 +12,9 @@ const result = await databases.decrementDocumentAttribute({ databaseId: '', collectionId: '', documentId: '', - attribute: '', - value: null, // optional - min: null, // optional - transactionId: '' // optional + attribute: '', + value: 1, // optional + min: 0, // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 3050105..89ffcd8 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.deleteAttribute({ databaseId: '', collectionId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 2da5c20..473e92d 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -10,6 +10,6 @@ const databases = new sdk.Databases(client); const result = await databases.deleteCollection({ databaseId: '', - collectionId: '' + collectionId: '', }); ``` diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 22bc714..9ecdbbe 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -12,6 +12,6 @@ const result = await databases.deleteDocument({ databaseId: '', collectionId: '', documentId: '', - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md index 4851243..682c0e7 100644 --- a/docs/examples/databases/delete-documents.md +++ b/docs/examples/databases/delete-documents.md @@ -12,6 +12,6 @@ const result = await databases.deleteDocuments({ databaseId: '', collectionId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index b7a8f0c..861a842 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.deleteIndex({ databaseId: '', collectionId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md index b89214b..8868eb9 100644 --- a/docs/examples/databases/delete-transaction.md +++ b/docs/examples/databases/delete-transaction.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const databases = new sdk.Databases(client); const result = await databases.deleteTransaction({ - transactionId: '' + transactionId: '', }); ``` diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index 0000948..101b224 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const databases = new sdk.Databases(client); const result = await databases.delete({ - databaseId: '' + databaseId: '', }); ``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index eade77d..4cdaa8a 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.getAttribute({ databaseId: '', collectionId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index 8b96aba..ccfc0f0 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -10,6 +10,6 @@ const databases = new sdk.Databases(client); const result = await databases.getCollection({ databaseId: '', - collectionId: '' + collectionId: '', }); ``` diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 9a66df4..2825524 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -13,6 +13,6 @@ const result = await databases.getDocument({ collectionId: '', documentId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 1900b0f..7187267 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.getIndex({ databaseId: '', collectionId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md index 09c0255..0f4bbd4 100644 --- a/docs/examples/databases/get-transaction.md +++ b/docs/examples/databases/get-transaction.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const databases = new sdk.Databases(client); const result = await databases.getTransaction({ - transactionId: '' + transactionId: '', }); ``` diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 9533a73..6b5834e 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const databases = new sdk.Databases(client); const result = await databases.get({ - databaseId: '' + databaseId: '', }); ``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index cb24d70..3f5d7e7 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -12,9 +12,9 @@ const result = await databases.incrementDocumentAttribute({ databaseId: '', collectionId: '', documentId: '', - attribute: '', - value: null, // optional - max: null, // optional - transactionId: '' // optional + attribute: '', + value: 1, // optional + max: 100, // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 635391c..5d9af70 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -12,6 +12,6 @@ const result = await databases.listAttributes({ databaseId: '', collectionId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 38f1f3e..5958510 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -12,6 +12,6 @@ const result = await databases.listCollections({ databaseId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 11fcec2..e395ef1 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -14,6 +14,6 @@ const result = await databases.listDocuments({ queries: [], // optional transactionId: '', // optional total: false, // optional - ttl: 0 // optional + ttl: 0, // optional }); ``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index c641109..0100d77 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -12,6 +12,6 @@ const result = await databases.listIndexes({ databaseId: '', collectionId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index 4707b13..c335682 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const databases = new sdk.Databases(client); const result = await databases.listTransactions({ - queries: [] // optional + queries: [], // optional }); ``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index d88d05e..b2a38df 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.list({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md index 1ff012a..7603578 100644 --- a/docs/examples/databases/update-big-int-attribute.md +++ b/docs/examples/databases/update-big-int-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.updateBigIntAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + xdefault: 0, + min: 0, // optional + max: 1000000, // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index c9b165e..5184217 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateBooleanAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: false, - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index f7f65c3..d33ce0b 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -15,6 +15,6 @@ const result = await databases.updateCollection({ permissions: [sdk.Permission.read(sdk.Role.any())], // optional documentSecurity: false, // optional enabled: false, // optional - purge: false // optional + purge: false, // optional }); ``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 6c65696..f3bb80e 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateDatetimeAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index cae4ccf..7037255 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -13,13 +13,13 @@ const result = await databases.updateDocument({ collectionId: '', documentId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 33, + isAdmin: false, }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index 168074c..b32cc88 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -12,13 +12,13 @@ const result = await databases.updateDocuments({ databaseId: '', collectionId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 33, + isAdmin: false, }, // optional queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index fa6c431..69658e2 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateEmailAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: 'email@example.com', - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 0fc74cd..2463223 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.updateEnumAttribute({ databaseId: '', collectionId: '', - key: '', - elements: [], + key: '', + elements: ['active', 'inactive'], required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'active', + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 894ab66..63af3be 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.updateFloatAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + xdefault: 10.5, + min: 0, // optional + max: 100, // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 10ddb38..14a16a9 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -11,11 +11,11 @@ const databases = new sdk.Databases(client); const result = await databases.updateIntegerAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + xdefault: 10, + min: 0, // optional + max: 100, // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 5e53e5d..1ece665 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateIpAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: '192.0.2.0', + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index c106a03..bd36689 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -11,9 +11,13 @@ const databases = new sdk.Databases(client); const result = await databases.updateLineAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional + xdefault: [ + [1, 2], + [3, 4], + [5, 6], + ], // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md index d21f398..97d3c28 100644 --- a/docs/examples/databases/update-longtext-attribute.md +++ b/docs/examples/databases/update-longtext-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateLongtextAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'Hello World', + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md index 25857d5..5398f71 100644 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateMediumtextAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'Hello World', + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index 96a4ae8..1c64a2c 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updatePointAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: [1, 2], // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 72828a8..9cff577 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -11,9 +11,16 @@ const databases = new sdk.Databases(client); const result = await databases.updatePolygonAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional + xdefault: [ + [ + [1, 2], + [3, 4], + [5, 6], + [1, 2], + ], + ], // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 9dc8ebd..50710f8 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -11,8 +11,8 @@ const databases = new sdk.Databases(client); const result = await databases.updateRelationshipAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', onDelete: sdk.RelationMutate.Cascade, // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 1c509d2..75f269c 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.updateStringAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', + xdefault: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md index 3154f5a..0075135 100644 --- a/docs/examples/databases/update-text-attribute.md +++ b/docs/examples/databases/update-text-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateTextAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'Hello World', + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md index a83cb03..6d31e2e 100644 --- a/docs/examples/databases/update-transaction.md +++ b/docs/examples/databases/update-transaction.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.updateTransaction({ transactionId: '', commit: false, // optional - rollback: false // optional + rollback: false, // optional }); ``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 1cebc2f..96c6953 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -11,9 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.updateUrlAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, xdefault: 'https://example.com', - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md index 43a1cf0..1a2ad8c 100644 --- a/docs/examples/databases/update-varchar-attribute.md +++ b/docs/examples/databases/update-varchar-attribute.md @@ -11,10 +11,10 @@ const databases = new sdk.Databases(client); const result = await databases.updateVarcharAttribute({ databaseId: '', collectionId: '', - key: '', + key: '', required: false, - xdefault: '', + xdefault: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 36ff3bd..6ae2bc1 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -11,6 +11,6 @@ const databases = new sdk.Databases(client); const result = await databases.update({ databaseId: '', name: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 13e882a..580baf2 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -13,13 +13,13 @@ const result = await databases.upsertDocument({ collectionId: '', documentId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 30, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 2a30492..aa25354 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -12,6 +12,6 @@ const result = await databases.upsertDocuments({ databaseId: '', collectionId: '', documents: [], - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md new file mode 100644 index 0000000..5915ae9 --- /dev/null +++ b/docs/examples/documentsdb/create-collection.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.createCollection({ + databaseId: '', + collectionId: '', + name: '', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + attributes: [], // optional + indexes: [], // optional +}); +``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md new file mode 100644 index 0000000..9b3e1d1 --- /dev/null +++ b/docs/examples/documentsdb/create-document.md @@ -0,0 +1,24 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.createDocument({ + databaseId: '', + collectionId: '', + documentId: '', + data: { + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, + }, + permissions: [sdk.Permission.read(sdk.Role.any())], // optional +}); +``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md new file mode 100644 index 0000000..35884cc --- /dev/null +++ b/docs/examples/documentsdb/create-documents.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.createDocuments({ + databaseId: '', + collectionId: '', + documents: [], +}); +``` diff --git a/docs/examples/documentsdb/create-failover.md b/docs/examples/documentsdb/create-failover.md new file mode 100644 index 0000000..a652719 --- /dev/null +++ b/docs/examples/documentsdb/create-failover.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.createFailover({ + databaseId: '', + targetReplicaId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md new file mode 100644 index 0000000..72e4669 --- /dev/null +++ b/docs/examples/documentsdb/create-index.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.createIndex({ + databaseId: '', + collectionId: '', + key: '', + type: sdk.DocumentsDBIndexType.Key, + attributes: [], + orders: [sdk.OrderBy.Asc], // optional + lengths: [], // optional +}); +``` diff --git a/docs/examples/documentsdb/create-operations.md b/docs/examples/documentsdb/create-operations.md new file mode 100644 index 0000000..c874aa3 --- /dev/null +++ b/docs/examples/documentsdb/create-operations.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.createOperations({ + transactionId: '', + operations: [ + { + action: 'create', + databaseId: '', + collectionId: '', + documentId: '', + data: { + name: "Walter O'Brien", + }, + }, + ], // optional +}); +``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md new file mode 100644 index 0000000..241425f --- /dev/null +++ b/docs/examples/documentsdb/create-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.createTransaction({ + ttl: 60, // optional +}); +``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md new file mode 100644 index 0000000..cb0806b --- /dev/null +++ b/docs/examples/documentsdb/create.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.create({ + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async', // optional +}); +``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md new file mode 100644 index 0000000..27f8bdf --- /dev/null +++ b/docs/examples/documentsdb/decrement-document-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.decrementDocumentAttribute({ + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + value: 1, // optional + min: 0, // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md new file mode 100644 index 0000000..5ff38ef --- /dev/null +++ b/docs/examples/documentsdb/delete-collection.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.deleteCollection({ + databaseId: '', + collectionId: '', +}); +``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md new file mode 100644 index 0000000..9fac5c0 --- /dev/null +++ b/docs/examples/documentsdb/delete-document.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.deleteDocument({ + databaseId: '', + collectionId: '', + documentId: '', + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md new file mode 100644 index 0000000..9bb214e --- /dev/null +++ b/docs/examples/documentsdb/delete-documents.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.deleteDocuments({ + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md new file mode 100644 index 0000000..f4c0435 --- /dev/null +++ b/docs/examples/documentsdb/delete-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.deleteIndex({ + databaseId: '', + collectionId: '', + key: '', +}); +``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md new file mode 100644 index 0000000..f8144ce --- /dev/null +++ b/docs/examples/documentsdb/delete-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.deleteTransaction({ + transactionId: '', +}); +``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md new file mode 100644 index 0000000..46b532d --- /dev/null +++ b/docs/examples/documentsdb/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.delete({ + databaseId: '', +}); +``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md new file mode 100644 index 0000000..dc68d3e --- /dev/null +++ b/docs/examples/documentsdb/get-collection.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.getCollection({ + databaseId: '', + collectionId: '', +}); +``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md new file mode 100644 index 0000000..9755fda --- /dev/null +++ b/docs/examples/documentsdb/get-document.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.getDocument({ + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md new file mode 100644 index 0000000..9faf529 --- /dev/null +++ b/docs/examples/documentsdb/get-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.getIndex({ + databaseId: '', + collectionId: '', + key: '', +}); +``` diff --git a/docs/examples/documentsdb/get-replicas.md b/docs/examples/documentsdb/get-replicas.md new file mode 100644 index 0000000..eeda5ea --- /dev/null +++ b/docs/examples/documentsdb/get-replicas.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.getReplicas({ + databaseId: '', +}); +``` diff --git a/docs/examples/documentsdb/get-status.md b/docs/examples/documentsdb/get-status.md new file mode 100644 index 0000000..a40a487 --- /dev/null +++ b/docs/examples/documentsdb/get-status.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.getStatus({ + databaseId: '', +}); +``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md new file mode 100644 index 0000000..132bef3 --- /dev/null +++ b/docs/examples/documentsdb/get-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.getTransaction({ + transactionId: '', +}); +``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md new file mode 100644 index 0000000..092bad4 --- /dev/null +++ b/docs/examples/documentsdb/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.get({ + databaseId: '', +}); +``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md new file mode 100644 index 0000000..11015d8 --- /dev/null +++ b/docs/examples/documentsdb/increment-document-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.incrementDocumentAttribute({ + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + value: 1, // optional + max: 100, // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md new file mode 100644 index 0000000..8d4bb1d --- /dev/null +++ b/docs/examples/documentsdb/list-collections.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.listCollections({ + databaseId: '', + queries: [], // optional + search: '', // optional + total: false, // optional +}); +``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md new file mode 100644 index 0000000..dde50aa --- /dev/null +++ b/docs/examples/documentsdb/list-documents.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.listDocuments({ + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0, // optional +}); +``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md new file mode 100644 index 0000000..32b0aca --- /dev/null +++ b/docs/examples/documentsdb/list-indexes.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.listIndexes({ + databaseId: '', + collectionId: '', + queries: [], // optional + total: false, // optional +}); +``` diff --git a/docs/examples/documentsdb/list-operations.md b/docs/examples/documentsdb/list-operations.md new file mode 100644 index 0000000..a9c6720 --- /dev/null +++ b/docs/examples/documentsdb/list-operations.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.listOperations({ + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/documentsdb/list-specifications.md b/docs/examples/documentsdb/list-specifications.md new file mode 100644 index 0000000..3d6419d --- /dev/null +++ b/docs/examples/documentsdb/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.listSpecifications(); +``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md new file mode 100644 index 0000000..8bc66d4 --- /dev/null +++ b/docs/examples/documentsdb/list-transactions.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.listTransactions({ + queries: [], // optional +}); +``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md new file mode 100644 index 0000000..9ff1cfe --- /dev/null +++ b/docs/examples/documentsdb/list.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.list({ + queries: [], // optional + total: false, // optional +}); +``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md new file mode 100644 index 0000000..beb1cd3 --- /dev/null +++ b/docs/examples/documentsdb/update-collection.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.updateCollection({ + databaseId: '', + collectionId: '', + name: '', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + purge: false, // optional +}); +``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md new file mode 100644 index 0000000..7e9538b --- /dev/null +++ b/docs/examples/documentsdb/update-document.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.updateDocument({ + databaseId: '', + collectionId: '', + documentId: '', + data: {}, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md new file mode 100644 index 0000000..bb5a46e --- /dev/null +++ b/docs/examples/documentsdb/update-documents.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.updateDocuments({ + databaseId: '', + collectionId: '', + data: {}, // optional + queries: [], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md new file mode 100644 index 0000000..5a14917 --- /dev/null +++ b/docs/examples/documentsdb/update-transaction.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.updateTransaction({ + transactionId: '', + commit: false, // optional + rollback: false, // optional +}); +``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md new file mode 100644 index 0000000..1e3c22a --- /dev/null +++ b/docs/examples/documentsdb/update.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.update({ + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async', // optional +}); +``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md new file mode 100644 index 0000000..e9ffed1 --- /dev/null +++ b/docs/examples/documentsdb/upsert-document.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.upsertDocument({ + databaseId: '', + collectionId: '', + documentId: '', + data: {}, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md new file mode 100644 index 0000000..23b5220 --- /dev/null +++ b/docs/examples/documentsdb/upsert-documents.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const documentsDB = new sdk.DocumentsDB(client); + +const result = await documentsDB.upsertDocuments({ + databaseId: '', + collectionId: '', + documents: [], + transactionId: '', // optional +}); +``` diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md index 5beebf5..537a440 100644 --- a/docs/examples/embeddings/create-text-embeddings.md +++ b/docs/examples/embeddings/create-text-embeddings.md @@ -10,6 +10,6 @@ const embeddings = new sdk.Embeddings(client); const result = await embeddings.createTextEmbeddings({ texts: [], - model: sdk.EmbeddingModel.NomicEmbedText // optional + model: sdk.EmbeddingModel.NomicEmbedText, // optional }); ``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 0cd67cb..0a4baff 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -14,6 +14,6 @@ const result = await functions.createDeployment({ code: InputFile.fromPath('/path/to/file', 'filename'), activate: false, entrypoint: '', // optional - commands: '' // optional + commands: '', // optional }); ``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md index f5abb22..179bb37 100644 --- a/docs/examples/functions/create-duplicate-deployment.md +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -11,6 +11,6 @@ const functions = new sdk.Functions(client); const result = await functions.createDuplicateDeployment({ functionId: '', deploymentId: '', - buildId: '' // optional + buildId: '', // optional }); ``` diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index f93d87e..f5c5bc4 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -15,6 +15,6 @@ const result = await functions.createExecution({ xpath: '', // optional method: sdk.ExecutionMethod.GET, // optional headers: {}, // optional - scheduledAt: '' // optional + scheduledAt: '', // optional }); ``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md index 2097755..a3e819f 100644 --- a/docs/examples/functions/create-template-deployment.md +++ b/docs/examples/functions/create-template-deployment.md @@ -15,6 +15,6 @@ const result = await functions.createTemplateDeployment({ rootDirectory: '', type: sdk.TemplateReferenceType.Commit, reference: '', - activate: false // optional + activate: false, // optional }); ``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 21246bb..e6ffd3d 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -13,6 +13,6 @@ const result = await functions.createVariable({ variableId: '', key: '', value: '', - secret: false // optional + secret: false, // optional }); ``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md index 4bf9d23..36672fa 100644 --- a/docs/examples/functions/create-vcs-deployment.md +++ b/docs/examples/functions/create-vcs-deployment.md @@ -12,6 +12,6 @@ const result = await functions.createVcsDeployment({ functionId: '', type: sdk.VCSReferenceType.Branch, reference: '', - activate: false // optional + activate: false, // optional }); ``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index cb9c3e8..7d6e855 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -12,9 +12,9 @@ const result = await functions.create({ functionId: '', name: '', runtime: sdk.Runtime.Node145, - execute: ["any"], // optional + execute: ['any'], // optional events: [], // optional - schedule: '', // optional + schedule: '0 0 * * *', // optional timeout: 1, // optional enabled: false, // optional logging: false, // optional @@ -28,8 +28,8 @@ const result = await functions.create({ providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional + deploymentRetention: 0, // optional }); ``` diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 20120eb..101508c 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.deleteDeployment({ functionId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md index 4d78ad9..bbbc606 100644 --- a/docs/examples/functions/delete-execution.md +++ b/docs/examples/functions/delete-execution.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.deleteExecution({ functionId: '', - executionId: '' + executionId: '', }); ``` diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index b8ed9d5..1882393 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.deleteVariable({ functionId: '', - variableId: '' + variableId: '', }); ``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 446ca2a..b2259a1 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const functions = new sdk.Functions(client); const result = await functions.delete({ - functionId: '' + functionId: '', }); ``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index 6a75bad..e85081a 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -12,6 +12,6 @@ const result = await functions.getDeploymentDownload({ functionId: '', deploymentId: '', type: sdk.DeploymentDownloadType.Source, // optional - token: '' // optional + token: '', // optional }); ``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 29d9b2e..c6b1b88 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.getDeployment({ functionId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index c987772..dae7043 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.getExecution({ functionId: '', - executionId: '' + executionId: '', }); ``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index abc2e91..8f9f37e 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.getVariable({ functionId: '', - variableId: '' + variableId: '', }); ``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index 97050f0..5eb892c 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const functions = new sdk.Functions(client); const result = await functions.get({ - functionId: '' + functionId: '', }); ``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index c53aaa4..966e563 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -12,6 +12,6 @@ const result = await functions.listDeployments({ functionId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index b549100..ad4ea3d 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -11,6 +11,6 @@ const functions = new sdk.Functions(client); const result = await functions.listExecutions({ functionId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index f9bb52b..f779206 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const functions = new sdk.Functions(client); const result = await functions.listSpecifications({ - type: 'runtimes' // optional + type: 'runtimes', // optional }); ``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index d09e5d0..e0f0951 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -11,6 +11,6 @@ const functions = new sdk.Functions(client); const result = await functions.listVariables({ functionId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index faeeaae..db5204e 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -11,6 +11,6 @@ const functions = new sdk.Functions(client); const result = await functions.list({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md index 5d45a02..acbdea4 100644 --- a/docs/examples/functions/update-deployment-status.md +++ b/docs/examples/functions/update-deployment-status.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.updateDeploymentStatus({ functionId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md index 0dfd06f..fc183f8 100644 --- a/docs/examples/functions/update-function-deployment.md +++ b/docs/examples/functions/update-function-deployment.md @@ -10,6 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.updateFunctionDeployment({ functionId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index e0bdec9..61b9662 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -13,6 +13,6 @@ const result = await functions.updateVariable({ variableId: '', key: '', // optional value: '', // optional - secret: false // optional + secret: false, // optional }); ``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 7d64aa2..2f299f2 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -12,9 +12,9 @@ const result = await functions.update({ functionId: '', name: '', runtime: sdk.Runtime.Node145, // optional - execute: ["any"], // optional + execute: ['any'], // optional events: [], // optional - schedule: '', // optional + schedule: '0 0 * * *', // optional timeout: 1, // optional enabled: false, // optional logging: false, // optional @@ -28,8 +28,8 @@ const result = await functions.update({ providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional + deploymentRetention: 0, // optional }); ``` diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 31aa4bf..cb60aa5 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const graphql = new sdk.Graphql(client); const result = await graphql.mutation({ - query: {} + query: {}, }); ``` diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 3bd436e..86ba696 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const graphql = new sdk.Graphql(client); const result = await graphql.query({ - query: {} + query: {}, }); ``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index dc203a3..04e4552 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -16,6 +16,6 @@ const result = await messaging.createAPNSProvider({ teamId: '', // optional bundleId: '', // optional sandbox: false, // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 1662aae..c979b47 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -20,6 +20,6 @@ const result = await messaging.createEmail({ attachments: [], // optional draft: false, // optional html: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 78b6d06..d23e5f4 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -12,6 +12,6 @@ const result = await messaging.createFCMProvider({ providerId: '', name: '', serviceAccountJSON: {}, // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index f2961b6..70f64eb 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -12,12 +12,12 @@ const result = await messaging.createMailgunProvider({ providerId: '', name: '', apiKey: '', // optional - domain: '', // optional + domain: 'example.com', // optional isEuRegion: false, // optional fromName: '', // optional fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: 'email@example.com', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md index ba6829a..ace599e 100644 --- a/docs/examples/messaging/create-msg-91-provider.md +++ b/docs/examples/messaging/create-msg-91-provider.md @@ -14,6 +14,6 @@ const result = await messaging.createMsg91Provider({ templateId: '', // optional senderId: '', // optional authKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 467cde4..6e2fd14 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -22,11 +22,11 @@ const result = await messaging.createPush({ sound: '', // optional color: '', // optional tag: '', // optional - badge: null, // optional + badge: 1, // optional draft: false, // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional critical: false, // optional - priority: sdk.MessagePriority.Normal // optional + priority: sdk.MessagePriority.Normal, // optional }); ``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md index d1c391d..746cdeb 100644 --- a/docs/examples/messaging/create-resend-provider.md +++ b/docs/examples/messaging/create-resend-provider.md @@ -16,6 +16,6 @@ const result = await messaging.createResendProvider({ fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: 'email@example.com', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 9c3be00..18eea0b 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -16,6 +16,6 @@ const result = await messaging.createSendgridProvider({ fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: 'email@example.com', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-ses-provider.md b/docs/examples/messaging/create-ses-provider.md index c25a7fe..2112c28 100644 --- a/docs/examples/messaging/create-ses-provider.md +++ b/docs/examples/messaging/create-ses-provider.md @@ -18,6 +18,6 @@ const result = await messaging.createSesProvider({ fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: 'email@example.com', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 31d75c0..0108af6 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -15,6 +15,6 @@ const result = await messaging.createSMS({ users: [], // optional targets: [], // optional draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index b980c3b..65e264f 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -12,7 +12,7 @@ const result = await messaging.createSMTPProvider({ providerId: '', name: '', host: '', - port: 1, // optional + port: 587, // optional username: '', // optional password: 'password', // optional encryption: sdk.SmtpEncryption.None, // optional @@ -22,6 +22,6 @@ const result = await messaging.createSMTPProvider({ fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: 'email@example.com', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 51410af..cd5027e 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -11,6 +11,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.createSubscriber({ topicId: '', subscriberId: '', - targetId: '' + targetId: '', }); ``` diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index baf83a6..7d2a8e3 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -14,6 +14,6 @@ const result = await messaging.createTelesignProvider({ from: '+12065550100', // optional customerId: '', // optional apiKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 655a224..05b4934 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -14,6 +14,6 @@ const result = await messaging.createTextmagicProvider({ from: '+12065550100', // optional username: '', // optional apiKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index 4625517..5a05064 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -11,6 +11,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.createTopic({ topicId: '', name: '', - subscribe: ["any"] // optional + subscribe: ['any'], // optional }); ``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index 0db5543..4b25a76 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -14,6 +14,6 @@ const result = await messaging.createTwilioProvider({ from: '+12065550100', // optional accountSid: '', // optional authToken: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index cf8cd38..f5f94a5 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -14,6 +14,6 @@ const result = await messaging.createVonageProvider({ from: '+12065550100', // optional apiKey: '', // optional apiSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 53fc2ae..d1bc607 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const messaging = new sdk.Messaging(client); const result = await messaging.deleteProvider({ - providerId: '' + providerId: '', }); ``` diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 99c61d7..d25b9d7 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -10,6 +10,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.deleteSubscriber({ topicId: '', - subscriberId: '' + subscriberId: '', }); ``` diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 3ffa99f..78a0898 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const messaging = new sdk.Messaging(client); const result = await messaging.deleteTopic({ - topicId: '' + topicId: '', }); ``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index 62e7d61..feb7e02 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const messaging = new sdk.Messaging(client); const result = await messaging.delete({ - messageId: '' + messageId: '', }); ``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 894a74a..30c5ee1 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const messaging = new sdk.Messaging(client); const result = await messaging.getMessage({ - messageId: '' + messageId: '', }); ``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index c7e91ff..e7f43b8 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const messaging = new sdk.Messaging(client); const result = await messaging.getProvider({ - providerId: '' + providerId: '', }); ``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index 8a91534..7fbb75d 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -10,6 +10,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.getSubscriber({ topicId: '', - subscriberId: '' + subscriberId: '', }); ``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index f352c9d..72c855f 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const messaging = new sdk.Messaging(client); const result = await messaging.getTopic({ - topicId: '' + topicId: '', }); ``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 053adc9..39ad98f 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -11,6 +11,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listMessages({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 603ff0b..968921d 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -11,6 +11,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listProviders({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index bba6aae..241c749 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -12,6 +12,6 @@ const result = await messaging.listSubscribers({ topicId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index dc05396..d318da8 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -11,6 +11,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listTargets({ messageId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 62fecb6..eaef351 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -11,6 +11,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.listTopics({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 6cd012d..800e885 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -16,6 +16,6 @@ const result = await messaging.updateAPNSProvider({ authKeyId: '', // optional teamId: '', // optional bundleId: '', // optional - sandbox: false // optional + sandbox: false, // optional }); ``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index f4e2786..aaf9d75 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -20,6 +20,6 @@ const result = await messaging.updateEmail({ cc: [], // optional bcc: [], // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - attachments: [] // optional + attachments: [], // optional }); ``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 4d76843..8612b2a 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -12,6 +12,6 @@ const result = await messaging.updateFCMProvider({ providerId: '', name: '', // optional enabled: false, // optional - serviceAccountJSON: {} // optional + serviceAccountJSON: {}, // optional }); ``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index 5725f1e..fddbf5d 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -12,12 +12,12 @@ const result = await messaging.updateMailgunProvider({ providerId: '', name: '', // optional apiKey: '', // optional - domain: '', // optional + domain: 'example.com', // optional isEuRegion: false, // optional enabled: false, // optional fromName: '', // optional fromEmail: 'email@example.com', // optional replyToName: '', // optional - replyToEmail: '' // optional + replyToEmail: '', // optional }); ``` diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md index d66ba73..debc079 100644 --- a/docs/examples/messaging/update-msg-91-provider.md +++ b/docs/examples/messaging/update-msg-91-provider.md @@ -14,6 +14,6 @@ const result = await messaging.updateMsg91Provider({ enabled: false, // optional templateId: '', // optional senderId: '', // optional - authKey: '' // optional + authKey: '', // optional }); ``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index f0e5e32..cf8f6f1 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -22,11 +22,11 @@ const result = await messaging.updatePush({ sound: '', // optional color: '', // optional tag: '', // optional - badge: null, // optional + badge: 1, // optional draft: false, // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional critical: false, // optional - priority: sdk.MessagePriority.Normal // optional + priority: sdk.MessagePriority.Normal, // optional }); ``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md index 563c907..e3c7fc2 100644 --- a/docs/examples/messaging/update-resend-provider.md +++ b/docs/examples/messaging/update-resend-provider.md @@ -16,6 +16,6 @@ const result = await messaging.updateResendProvider({ fromName: '', // optional fromEmail: 'email@example.com', // optional replyToName: '', // optional - replyToEmail: '' // optional + replyToEmail: '', // optional }); ``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index ece8ae7..8e5b59b 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -16,6 +16,6 @@ const result = await messaging.updateSendgridProvider({ fromName: '', // optional fromEmail: 'email@example.com', // optional replyToName: '', // optional - replyToEmail: '' // optional + replyToEmail: '', // optional }); ``` diff --git a/docs/examples/messaging/update-ses-provider.md b/docs/examples/messaging/update-ses-provider.md index 2858646..d3e943a 100644 --- a/docs/examples/messaging/update-ses-provider.md +++ b/docs/examples/messaging/update-ses-provider.md @@ -18,6 +18,6 @@ const result = await messaging.updateSesProvider({ fromName: '', // optional fromEmail: 'email@example.com', // optional replyToName: '', // optional - replyToEmail: '' // optional + replyToEmail: '', // optional }); ``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 074cab2..940474a 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -15,6 +15,6 @@ const result = await messaging.updateSMS({ targets: [], // optional content: '', // optional draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 1b0ec72..94e862b 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -22,6 +22,6 @@ const result = await messaging.updateSMTPProvider({ fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index b8b7ea0..5d9442f 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -14,6 +14,6 @@ const result = await messaging.updateTelesignProvider({ enabled: false, // optional customerId: '', // optional apiKey: '', // optional - from: '' // optional + from: '', // optional }); ``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index bf35cef..ef15093 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -14,6 +14,6 @@ const result = await messaging.updateTextmagicProvider({ enabled: false, // optional username: '', // optional apiKey: '', // optional - from: '' // optional + from: '', // optional }); ``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 8ec3073..2397220 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -11,6 +11,6 @@ const messaging = new sdk.Messaging(client); const result = await messaging.updateTopic({ topicId: '', name: '', // optional - subscribe: ["any"] // optional + subscribe: ['any'], // optional }); ``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index da83c43..eb02ecc 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -14,6 +14,6 @@ const result = await messaging.updateTwilioProvider({ enabled: false, // optional accountSid: '', // optional authToken: '', // optional - from: '' // optional + from: '', // optional }); ``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index caefea0..203e435 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -14,6 +14,6 @@ const result = await messaging.updateVonageProvider({ enabled: false, // optional apiKey: '', // optional apiSecret: '', // optional - from: '' // optional + from: '', // optional }); ``` diff --git a/docs/examples/mongo/create-backup-policy.md b/docs/examples/mongo/create-backup-policy.md new file mode 100644 index 0000000..3496600 --- /dev/null +++ b/docs/examples/mongo/create-backup-policy.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.createBackupPolicy({ + databaseId: '', + policyId: '', + name: '', + schedule: '', + retention: 1, + type: 'full', // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/mongo/create-backup.md b/docs/examples/mongo/create-backup.md new file mode 100644 index 0000000..532eac7 --- /dev/null +++ b/docs/examples/mongo/create-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.createBackup({ + databaseId: '', + type: 'full', // optional +}); +``` diff --git a/docs/examples/mongo/create-branch.md b/docs/examples/mongo/create-branch.md new file mode 100644 index 0000000..78aa375 --- /dev/null +++ b/docs/examples/mongo/create-branch.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.createBranch({ + databaseId: '', + branchId: '', // optional + ttl: 300, // optional +}); +``` diff --git a/docs/examples/mongo/create-failover.md b/docs/examples/mongo/create-failover.md new file mode 100644 index 0000000..598b48d --- /dev/null +++ b/docs/examples/mongo/create-failover.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.createFailover({ + databaseId: '', + targetReplicaId: '', // optional +}); +``` diff --git a/docs/examples/mongo/create-migration.md b/docs/examples/mongo/create-migration.md new file mode 100644 index 0000000..dfa2b2b --- /dev/null +++ b/docs/examples/mongo/create-migration.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.createMigration({ + databaseId: '', + targetType: 'shared', + specification: '', // optional +}); +``` diff --git a/docs/examples/mongo/create-restoration.md b/docs/examples/mongo/create-restoration.md new file mode 100644 index 0000000..7a6f1a3 --- /dev/null +++ b/docs/examples/mongo/create-restoration.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.createRestoration({ + databaseId: '', + type: 'backup', // optional + backupId: '', // optional + targetDatabaseId: '', // optional + targetTime: '2020-10-15T06:38:00.000+00:00', // optional +}); +``` diff --git a/docs/examples/mongo/create-upgrade.md b/docs/examples/mongo/create-upgrade.md new file mode 100644 index 0000000..6764df2 --- /dev/null +++ b/docs/examples/mongo/create-upgrade.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.createUpgrade({ + databaseId: '', + targetVersion: '', +}); +``` diff --git a/docs/examples/mongo/create.md b/docs/examples/mongo/create.md new file mode 100644 index 0000000..cb6d8f7 --- /dev/null +++ b/docs/examples/mongo/create.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.create({ + databaseId: '', + name: '', + version: '17', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional +}); +``` diff --git a/docs/examples/mongo/delete-backup-policy.md b/docs/examples/mongo/delete-backup-policy.md new file mode 100644 index 0000000..959a03c --- /dev/null +++ b/docs/examples/mongo/delete-backup-policy.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.deleteBackupPolicy({ + databaseId: '', + policyId: '', +}); +``` diff --git a/docs/examples/mongo/delete-backup.md b/docs/examples/mongo/delete-backup.md new file mode 100644 index 0000000..386d220 --- /dev/null +++ b/docs/examples/mongo/delete-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.deleteBackup({ + databaseId: '', + backupId: '', +}); +``` diff --git a/docs/examples/mongo/delete-branch.md b/docs/examples/mongo/delete-branch.md new file mode 100644 index 0000000..2bb3b26 --- /dev/null +++ b/docs/examples/mongo/delete-branch.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.deleteBranch({ + databaseId: '', + branchId: '', +}); +``` diff --git a/docs/examples/mongo/delete.md b/docs/examples/mongo/delete.md new file mode 100644 index 0000000..8da6050 --- /dev/null +++ b/docs/examples/mongo/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.delete({ + databaseId: '', +}); +``` diff --git a/docs/examples/mongo/get-backup-policy.md b/docs/examples/mongo/get-backup-policy.md new file mode 100644 index 0000000..fe057b5 --- /dev/null +++ b/docs/examples/mongo/get-backup-policy.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.getBackupPolicy({ + databaseId: '', + policyId: '', +}); +``` diff --git a/docs/examples/mongo/get-backup.md b/docs/examples/mongo/get-backup.md new file mode 100644 index 0000000..a80c629 --- /dev/null +++ b/docs/examples/mongo/get-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.getBackup({ + databaseId: '', + backupId: '', +}); +``` diff --git a/docs/examples/mongo/get-pitr.md b/docs/examples/mongo/get-pitr.md new file mode 100644 index 0000000..fb1fe5d --- /dev/null +++ b/docs/examples/mongo/get-pitr.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.getPitr({ + databaseId: '', +}); +``` diff --git a/docs/examples/mongo/get-replicas.md b/docs/examples/mongo/get-replicas.md new file mode 100644 index 0000000..33402e1 --- /dev/null +++ b/docs/examples/mongo/get-replicas.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.getReplicas({ + databaseId: '', +}); +``` diff --git a/docs/examples/mongo/get-restoration.md b/docs/examples/mongo/get-restoration.md new file mode 100644 index 0000000..0ab1d0c --- /dev/null +++ b/docs/examples/mongo/get-restoration.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.getRestoration({ + databaseId: '', + restorationId: '', +}); +``` diff --git a/docs/examples/mongo/get-status.md b/docs/examples/mongo/get-status.md new file mode 100644 index 0000000..2e15d82 --- /dev/null +++ b/docs/examples/mongo/get-status.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.getStatus({ + databaseId: '', +}); +``` diff --git a/docs/examples/mongo/get.md b/docs/examples/mongo/get.md new file mode 100644 index 0000000..7caf634 --- /dev/null +++ b/docs/examples/mongo/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.get({ + databaseId: '', +}); +``` diff --git a/docs/examples/mongo/list-backup-policies.md b/docs/examples/mongo/list-backup-policies.md new file mode 100644 index 0000000..d40381e --- /dev/null +++ b/docs/examples/mongo/list-backup-policies.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.listBackupPolicies({ + databaseId: '', + queries: [], // optional +}); +``` diff --git a/docs/examples/mongo/list-backups.md b/docs/examples/mongo/list-backups.md new file mode 100644 index 0000000..2041759 --- /dev/null +++ b/docs/examples/mongo/list-backups.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.listBackups({ + databaseId: '', + queries: [], // optional +}); +``` diff --git a/docs/examples/mongo/list-branches.md b/docs/examples/mongo/list-branches.md new file mode 100644 index 0000000..663723b --- /dev/null +++ b/docs/examples/mongo/list-branches.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.listBranches({ + databaseId: '', +}); +``` diff --git a/docs/examples/mongo/list-operations.md b/docs/examples/mongo/list-operations.md new file mode 100644 index 0000000..aac0189 --- /dev/null +++ b/docs/examples/mongo/list-operations.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.listOperations({ + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/mongo/list-restorations.md b/docs/examples/mongo/list-restorations.md new file mode 100644 index 0000000..1efd146 --- /dev/null +++ b/docs/examples/mongo/list-restorations.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.listRestorations({ + databaseId: '', + status: 'pending', // optional + type: 'backup', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/mongo/list-specifications.md b/docs/examples/mongo/list-specifications.md new file mode 100644 index 0000000..f8b3110 --- /dev/null +++ b/docs/examples/mongo/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.listSpecifications(); +``` diff --git a/docs/examples/mongo/list.md b/docs/examples/mongo/list.md new file mode 100644 index 0000000..ee7406b --- /dev/null +++ b/docs/examples/mongo/list.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.list({ + queries: [], // optional +}); +``` diff --git a/docs/examples/mongo/update-backup-policy.md b/docs/examples/mongo/update-backup-policy.md new file mode 100644 index 0000000..9d22b78 --- /dev/null +++ b/docs/examples/mongo/update-backup-policy.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.updateBackupPolicy({ + databaseId: '', + policyId: '', + name: '', // optional + schedule: '', // optional + retention: 1, // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/mongo/update-backup-storage.md b/docs/examples/mongo/update-backup-storage.md new file mode 100644 index 0000000..8632ab6 --- /dev/null +++ b/docs/examples/mongo/update-backup-storage.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.updateBackupStorage({ + databaseId: '', + provider: 's3', + bucket: '', + accessKey: '', + secretKey: '', + region: '', // optional + prefix: '', // optional + endpoint: '', // optional +}); +``` diff --git a/docs/examples/mongo/update-credentials.md b/docs/examples/mongo/update-credentials.md new file mode 100644 index 0000000..43cd025 --- /dev/null +++ b/docs/examples/mongo/update-credentials.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.updateCredentials({ + databaseId: '', +}); +``` diff --git a/docs/examples/mongo/update-maintenance.md b/docs/examples/mongo/update-maintenance.md new file mode 100644 index 0000000..e28f6fd --- /dev/null +++ b/docs/examples/mongo/update-maintenance.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.updateMaintenance({ + databaseId: '', + day: 'sun', + hourUtc: 0, +}); +``` diff --git a/docs/examples/mongo/update.md b/docs/examples/mongo/update.md new file mode 100644 index 0000000..046588e --- /dev/null +++ b/docs/examples/mongo/update.md @@ -0,0 +1,34 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mongo = new sdk.Mongo(client); + +const result = await mongo.update({ + databaseId: '', + name: '', // optional + status: 'ready', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + metricsTraceSampleRate: null, // optional + metricsSlowQueryLogThresholdMs: 0, // optional + sqlApiEnabled: false, // optional + sqlApiAllowedStatements: [], // optional + sqlApiMaxRows: 1, // optional + sqlApiMaxBytes: 1024, // optional + sqlApiTimeoutSeconds: 1, // optional +}); +``` diff --git a/docs/examples/mysql/create-backup-policy.md b/docs/examples/mysql/create-backup-policy.md new file mode 100644 index 0000000..bbaf973 --- /dev/null +++ b/docs/examples/mysql/create-backup-policy.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createBackupPolicy({ + databaseId: '', + policyId: '', + name: '', + schedule: '', + retention: 1, + type: 'full', // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/mysql/create-backup.md b/docs/examples/mysql/create-backup.md new file mode 100644 index 0000000..5515c81 --- /dev/null +++ b/docs/examples/mysql/create-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createBackup({ + databaseId: '', + type: 'full', // optional +}); +``` diff --git a/docs/examples/mysql/create-branch.md b/docs/examples/mysql/create-branch.md new file mode 100644 index 0000000..6c5f671 --- /dev/null +++ b/docs/examples/mysql/create-branch.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createBranch({ + databaseId: '', + branchId: '', // optional + ttl: 300, // optional +}); +``` diff --git a/docs/examples/mysql/create-execution.md b/docs/examples/mysql/create-execution.md new file mode 100644 index 0000000..2554bbe --- /dev/null +++ b/docs/examples/mysql/create-execution.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createExecution({ + databaseId: '', + sql: '', + bindings: {}, // optional + timeoutSeconds: 1, // optional +}); +``` diff --git a/docs/examples/mysql/create-failover.md b/docs/examples/mysql/create-failover.md new file mode 100644 index 0000000..0fcf5b9 --- /dev/null +++ b/docs/examples/mysql/create-failover.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createFailover({ + databaseId: '', + targetReplicaId: '', // optional +}); +``` diff --git a/docs/examples/mysql/create-migration.md b/docs/examples/mysql/create-migration.md new file mode 100644 index 0000000..1c09f56 --- /dev/null +++ b/docs/examples/mysql/create-migration.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createMigration({ + databaseId: '', + targetType: 'shared', + specification: '', // optional +}); +``` diff --git a/docs/examples/mysql/create-restoration.md b/docs/examples/mysql/create-restoration.md new file mode 100644 index 0000000..6e95f01 --- /dev/null +++ b/docs/examples/mysql/create-restoration.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createRestoration({ + databaseId: '', + type: 'backup', // optional + backupId: '', // optional + targetDatabaseId: '', // optional + targetTime: '2020-10-15T06:38:00.000+00:00', // optional +}); +``` diff --git a/docs/examples/mysql/create-upgrade.md b/docs/examples/mysql/create-upgrade.md new file mode 100644 index 0000000..36aeac5 --- /dev/null +++ b/docs/examples/mysql/create-upgrade.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.createUpgrade({ + databaseId: '', + targetVersion: '', +}); +``` diff --git a/docs/examples/mysql/create.md b/docs/examples/mysql/create.md new file mode 100644 index 0000000..81573b4 --- /dev/null +++ b/docs/examples/mysql/create.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.create({ + databaseId: '', + name: '', + version: '17', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional +}); +``` diff --git a/docs/examples/mysql/delete-backup-policy.md b/docs/examples/mysql/delete-backup-policy.md new file mode 100644 index 0000000..94b672a --- /dev/null +++ b/docs/examples/mysql/delete-backup-policy.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.deleteBackupPolicy({ + databaseId: '', + policyId: '', +}); +``` diff --git a/docs/examples/mysql/delete-backup.md b/docs/examples/mysql/delete-backup.md new file mode 100644 index 0000000..1a41669 --- /dev/null +++ b/docs/examples/mysql/delete-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.deleteBackup({ + databaseId: '', + backupId: '', +}); +``` diff --git a/docs/examples/mysql/delete-branch.md b/docs/examples/mysql/delete-branch.md new file mode 100644 index 0000000..426cbcc --- /dev/null +++ b/docs/examples/mysql/delete-branch.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.deleteBranch({ + databaseId: '', + branchId: '', +}); +``` diff --git a/docs/examples/mysql/delete.md b/docs/examples/mysql/delete.md new file mode 100644 index 0000000..3cd55c3 --- /dev/null +++ b/docs/examples/mysql/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.delete({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/get-backup-policy.md b/docs/examples/mysql/get-backup-policy.md new file mode 100644 index 0000000..e6f98bc --- /dev/null +++ b/docs/examples/mysql/get-backup-policy.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.getBackupPolicy({ + databaseId: '', + policyId: '', +}); +``` diff --git a/docs/examples/mysql/get-backup.md b/docs/examples/mysql/get-backup.md new file mode 100644 index 0000000..2c97a9d --- /dev/null +++ b/docs/examples/mysql/get-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.getBackup({ + databaseId: '', + backupId: '', +}); +``` diff --git a/docs/examples/mysql/get-pitr.md b/docs/examples/mysql/get-pitr.md new file mode 100644 index 0000000..69e114c --- /dev/null +++ b/docs/examples/mysql/get-pitr.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.getPitr({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/get-pooler.md b/docs/examples/mysql/get-pooler.md new file mode 100644 index 0000000..8817ead --- /dev/null +++ b/docs/examples/mysql/get-pooler.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.getPooler({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/get-replicas.md b/docs/examples/mysql/get-replicas.md new file mode 100644 index 0000000..a5f669d --- /dev/null +++ b/docs/examples/mysql/get-replicas.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.getReplicas({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/get-restoration.md b/docs/examples/mysql/get-restoration.md new file mode 100644 index 0000000..9a8285b --- /dev/null +++ b/docs/examples/mysql/get-restoration.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.getRestoration({ + databaseId: '', + restorationId: '', +}); +``` diff --git a/docs/examples/mysql/get-status.md b/docs/examples/mysql/get-status.md new file mode 100644 index 0000000..eb783a4 --- /dev/null +++ b/docs/examples/mysql/get-status.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.getStatus({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/get.md b/docs/examples/mysql/get.md new file mode 100644 index 0000000..0608db7 --- /dev/null +++ b/docs/examples/mysql/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.get({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/list-backup-policies.md b/docs/examples/mysql/list-backup-policies.md new file mode 100644 index 0000000..4b3127a --- /dev/null +++ b/docs/examples/mysql/list-backup-policies.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.listBackupPolicies({ + databaseId: '', + queries: [], // optional +}); +``` diff --git a/docs/examples/mysql/list-backups.md b/docs/examples/mysql/list-backups.md new file mode 100644 index 0000000..c88356e --- /dev/null +++ b/docs/examples/mysql/list-backups.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.listBackups({ + databaseId: '', + queries: [], // optional +}); +``` diff --git a/docs/examples/mysql/list-branches.md b/docs/examples/mysql/list-branches.md new file mode 100644 index 0000000..7c3f80d --- /dev/null +++ b/docs/examples/mysql/list-branches.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.listBranches({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/list-operations.md b/docs/examples/mysql/list-operations.md new file mode 100644 index 0000000..9e322f1 --- /dev/null +++ b/docs/examples/mysql/list-operations.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.listOperations({ + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/mysql/list-restorations.md b/docs/examples/mysql/list-restorations.md new file mode 100644 index 0000000..179e85a --- /dev/null +++ b/docs/examples/mysql/list-restorations.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.listRestorations({ + databaseId: '', + status: 'pending', // optional + type: 'backup', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/mysql/list-specifications.md b/docs/examples/mysql/list-specifications.md new file mode 100644 index 0000000..2fe8853 --- /dev/null +++ b/docs/examples/mysql/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.listSpecifications(); +``` diff --git a/docs/examples/mysql/list.md b/docs/examples/mysql/list.md new file mode 100644 index 0000000..11907b7 --- /dev/null +++ b/docs/examples/mysql/list.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.list({ + queries: [], // optional +}); +``` diff --git a/docs/examples/mysql/update-backup-policy.md b/docs/examples/mysql/update-backup-policy.md new file mode 100644 index 0000000..a693487 --- /dev/null +++ b/docs/examples/mysql/update-backup-policy.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.updateBackupPolicy({ + databaseId: '', + policyId: '', + name: '', // optional + schedule: '', // optional + retention: 1, // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/mysql/update-backup-storage.md b/docs/examples/mysql/update-backup-storage.md new file mode 100644 index 0000000..96e57e4 --- /dev/null +++ b/docs/examples/mysql/update-backup-storage.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.updateBackupStorage({ + databaseId: '', + provider: 's3', + bucket: '', + accessKey: '', + secretKey: '', + region: '', // optional + prefix: '', // optional + endpoint: '', // optional +}); +``` diff --git a/docs/examples/mysql/update-credentials.md b/docs/examples/mysql/update-credentials.md new file mode 100644 index 0000000..00747ff --- /dev/null +++ b/docs/examples/mysql/update-credentials.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.updateCredentials({ + databaseId: '', +}); +``` diff --git a/docs/examples/mysql/update-maintenance.md b/docs/examples/mysql/update-maintenance.md new file mode 100644 index 0000000..c47156e --- /dev/null +++ b/docs/examples/mysql/update-maintenance.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.updateMaintenance({ + databaseId: '', + day: 'sun', + hourUtc: 0, +}); +``` diff --git a/docs/examples/mysql/update-pooler.md b/docs/examples/mysql/update-pooler.md new file mode 100644 index 0000000..19af6f4 --- /dev/null +++ b/docs/examples/mysql/update-pooler.md @@ -0,0 +1,22 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.updatePooler({ + databaseId: '', + mode: 'transaction', // optional + maxConnections: 10, // optional + defaultPoolSize: 1, // optional + readWriteSplitting: false, // optional + poolerCpuRequest: '', // optional + poolerCpuLimit: '', // optional + poolerMemoryRequest: '', // optional + poolerMemoryLimit: '', // optional +}); +``` diff --git a/docs/examples/mysql/update.md b/docs/examples/mysql/update.md new file mode 100644 index 0000000..2e16df5 --- /dev/null +++ b/docs/examples/mysql/update.md @@ -0,0 +1,34 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const mysql = new sdk.Mysql(client); + +const result = await mysql.update({ + databaseId: '', + name: '', // optional + status: 'ready', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + metricsTraceSampleRate: null, // optional + metricsSlowQueryLogThresholdMs: 0, // optional + sqlApiEnabled: false, // optional + sqlApiAllowedStatements: [], // optional + sqlApiMaxRows: 1, // optional + sqlApiMaxBytes: 1024, // optional + sqlApiTimeoutSeconds: 1, // optional +}); +``` diff --git a/docs/examples/oauth2/approve.md b/docs/examples/oauth2/approve.md index 64f473b..06ee2a8 100644 --- a/docs/examples/oauth2/approve.md +++ b/docs/examples/oauth2/approve.md @@ -11,6 +11,6 @@ const oauth2 = new sdk.Oauth2(client); const result = await oauth2.approve({ grantId: '', authorizationDetails: '', // optional - scope: '' // optional + scope: '', // optional }); ``` diff --git a/docs/examples/oauth2/authorize-post.md b/docs/examples/oauth2/authorize-post.md index 9d9317e..ca9cc0a 100644 --- a/docs/examples/oauth2/authorize-post.md +++ b/docs/examples/oauth2/authorize-post.md @@ -22,6 +22,6 @@ const result = await oauth2.authorizePost({ authorizationDetails: '', // optional resource: '', // optional audience: '', // optional - requestUri: '' // optional + requestUri: '', // optional }); ``` diff --git a/docs/examples/oauth2/authorize.md b/docs/examples/oauth2/authorize.md index 10b6f61..38047d7 100644 --- a/docs/examples/oauth2/authorize.md +++ b/docs/examples/oauth2/authorize.md @@ -22,6 +22,6 @@ const result = await oauth2.authorize({ authorizationDetails: '', // optional resource: '', // optional audience: '', // optional - requestUri: '' // optional + requestUri: '', // optional }); ``` diff --git a/docs/examples/oauth2/create-device-authorization.md b/docs/examples/oauth2/create-device-authorization.md index 19710c7..d9e2d61 100644 --- a/docs/examples/oauth2/create-device-authorization.md +++ b/docs/examples/oauth2/create-device-authorization.md @@ -13,6 +13,6 @@ const result = await oauth2.createDeviceAuthorization({ scope: '', // optional authorizationDetails: '', // optional resource: '', // optional - audience: '' // optional + audience: '', // optional }); ``` diff --git a/docs/examples/oauth2/create-grant.md b/docs/examples/oauth2/create-grant.md index 0f644ee..198af62 100644 --- a/docs/examples/oauth2/create-grant.md +++ b/docs/examples/oauth2/create-grant.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const oauth2 = new sdk.Oauth2(client); const result = await oauth2.createGrant({ - userCode: '' + userCode: '', }); ``` diff --git a/docs/examples/oauth2/create-par.md b/docs/examples/oauth2/create-par.md index 70623e9..f9febba 100644 --- a/docs/examples/oauth2/create-par.md +++ b/docs/examples/oauth2/create-par.md @@ -21,6 +21,6 @@ const result = await oauth2.createPAR({ maxAge: 0, // optional authorizationDetails: '', // optional resource: '', // optional - audience: '' // optional + audience: '', // optional }); ``` diff --git a/docs/examples/oauth2/create-token.md b/docs/examples/oauth2/create-token.md index e27883d..a45fa1b 100644 --- a/docs/examples/oauth2/create-token.md +++ b/docs/examples/oauth2/create-token.md @@ -18,6 +18,6 @@ const result = await oauth2.createToken({ codeVerifier: '', // optional redirectUri: 'https://example.com', // optional resource: '', // optional - audience: '' // optional + audience: '', // optional }); ``` diff --git a/docs/examples/oauth2/get-grant.md b/docs/examples/oauth2/get-grant.md index b619812..dcd21ce 100644 --- a/docs/examples/oauth2/get-grant.md +++ b/docs/examples/oauth2/get-grant.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const oauth2 = new sdk.Oauth2(client); const result = await oauth2.getGrant({ - grantId: '' + grantId: '', }); ``` diff --git a/docs/examples/oauth2/list-organizations.md b/docs/examples/oauth2/list-organizations.md index b9503c2..ddf5793 100644 --- a/docs/examples/oauth2/list-organizations.md +++ b/docs/examples/oauth2/list-organizations.md @@ -11,6 +11,6 @@ const oauth2 = new sdk.Oauth2(client); const result = await oauth2.listOrganizations({ limit: 1, // optional offset: 0, // optional - search: '' // optional + search: '', // optional }); ``` diff --git a/docs/examples/oauth2/list-projects.md b/docs/examples/oauth2/list-projects.md index 95e89e9..2a5acae 100644 --- a/docs/examples/oauth2/list-projects.md +++ b/docs/examples/oauth2/list-projects.md @@ -11,6 +11,6 @@ const oauth2 = new sdk.Oauth2(client); const result = await oauth2.listProjects({ limit: 1, // optional offset: 0, // optional - search: '' // optional + search: '', // optional }); ``` diff --git a/docs/examples/oauth2/reject.md b/docs/examples/oauth2/reject.md index 5e5a8ff..a577dab 100644 --- a/docs/examples/oauth2/reject.md +++ b/docs/examples/oauth2/reject.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const oauth2 = new sdk.Oauth2(client); const result = await oauth2.reject({ - grantId: '' + grantId: '', }); ``` diff --git a/docs/examples/oauth2/revoke.md b/docs/examples/oauth2/revoke.md index e853410..287d65f 100644 --- a/docs/examples/oauth2/revoke.md +++ b/docs/examples/oauth2/revoke.md @@ -12,6 +12,6 @@ const result = await oauth2.revoke({ token: '', tokenTypeHint: 'access_token', // optional clientId: '', // optional - clientSecret: '' // optional + clientSecret: '', // optional }); ``` diff --git a/docs/examples/organization/create-installation.md b/docs/examples/organization/create-installation.md index 56558fd..b9e6c27 100644 --- a/docs/examples/organization/create-installation.md +++ b/docs/examples/organization/create-installation.md @@ -10,6 +10,6 @@ const organization = new sdk.Organization(client); const result = await organization.createInstallation({ appId: '', - authorizationDetails: '' // optional + authorizationDetails: '', // optional }); ``` diff --git a/docs/examples/organization/create-key.md b/docs/examples/organization/create-key.md index b4e06ac..c4183dc 100644 --- a/docs/examples/organization/create-key.md +++ b/docs/examples/organization/create-key.md @@ -12,6 +12,6 @@ const result = await organization.createKey({ keyId: '', name: '', scopes: [sdk.OrganizationKeyScopes.ProjectsRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional + expire: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/organization/create-membership.md b/docs/examples/organization/create-membership.md index 02450ab..dbc5be9 100644 --- a/docs/examples/organization/create-membership.md +++ b/docs/examples/organization/create-membership.md @@ -14,6 +14,6 @@ const result = await organization.createMembership({ userId: '', // optional phone: '+12065550100', // optional url: 'https://example.com', // optional - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/organization/create-project.md b/docs/examples/organization/create-project.md index 0c4547c..686773c 100644 --- a/docs/examples/organization/create-project.md +++ b/docs/examples/organization/create-project.md @@ -9,8 +9,8 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.createProject({ - projectId: '', + projectId: '', name: '', - region: sdk.Region.Fra // optional + region: sdk.Region.Fra, // optional }); ``` diff --git a/docs/examples/organization/delete-installation.md b/docs/examples/organization/delete-installation.md index afc3be5..c48c79c 100644 --- a/docs/examples/organization/delete-installation.md +++ b/docs/examples/organization/delete-installation.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.deleteInstallation({ - installationId: '' + installationId: '', }); ``` diff --git a/docs/examples/organization/delete-key.md b/docs/examples/organization/delete-key.md index c3bce99..5cdd4e0 100644 --- a/docs/examples/organization/delete-key.md +++ b/docs/examples/organization/delete-key.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.deleteKey({ - keyId: '' + keyId: '', }); ``` diff --git a/docs/examples/organization/delete-membership.md b/docs/examples/organization/delete-membership.md index 174ffc3..3a5c919 100644 --- a/docs/examples/organization/delete-membership.md +++ b/docs/examples/organization/delete-membership.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.deleteMembership({ - membershipId: '' + membershipId: '', }); ``` diff --git a/docs/examples/organization/delete-project.md b/docs/examples/organization/delete-project.md index 01b3b84..fcc24c8 100644 --- a/docs/examples/organization/delete-project.md +++ b/docs/examples/organization/delete-project.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.deleteProject({ - projectId: '' + projectId: '', }); ``` diff --git a/docs/examples/organization/get-installation.md b/docs/examples/organization/get-installation.md index e5ed10e..d48c35c 100644 --- a/docs/examples/organization/get-installation.md +++ b/docs/examples/organization/get-installation.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.getInstallation({ - installationId: '' + installationId: '', }); ``` diff --git a/docs/examples/organization/get-key.md b/docs/examples/organization/get-key.md index 13317b6..84551ae 100644 --- a/docs/examples/organization/get-key.md +++ b/docs/examples/organization/get-key.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.getKey({ - keyId: '' + keyId: '', }); ``` diff --git a/docs/examples/organization/get-membership.md b/docs/examples/organization/get-membership.md index 42f6070..e7f3171 100644 --- a/docs/examples/organization/get-membership.md +++ b/docs/examples/organization/get-membership.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.getMembership({ - membershipId: '' + membershipId: '', }); ``` diff --git a/docs/examples/organization/get-project.md b/docs/examples/organization/get-project.md index 85576d6..a441096 100644 --- a/docs/examples/organization/get-project.md +++ b/docs/examples/organization/get-project.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.getProject({ - projectId: '' + projectId: '', }); ``` diff --git a/docs/examples/organization/list-installations.md b/docs/examples/organization/list-installations.md index 91f6b66..2488802 100644 --- a/docs/examples/organization/list-installations.md +++ b/docs/examples/organization/list-installations.md @@ -10,6 +10,6 @@ const organization = new sdk.Organization(client); const result = await organization.listInstallations({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/organization/list-keys.md b/docs/examples/organization/list-keys.md index 61348e5..d676570 100644 --- a/docs/examples/organization/list-keys.md +++ b/docs/examples/organization/list-keys.md @@ -10,6 +10,6 @@ const organization = new sdk.Organization(client); const result = await organization.listKeys({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/organization/list-memberships.md b/docs/examples/organization/list-memberships.md index 594cfd1..1286158 100644 --- a/docs/examples/organization/list-memberships.md +++ b/docs/examples/organization/list-memberships.md @@ -11,6 +11,6 @@ const organization = new sdk.Organization(client); const result = await organization.listMemberships({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/organization/list-projects.md b/docs/examples/organization/list-projects.md index fa7f9c0..e883082 100644 --- a/docs/examples/organization/list-projects.md +++ b/docs/examples/organization/list-projects.md @@ -11,6 +11,6 @@ const organization = new sdk.Organization(client); const result = await organization.listProjects({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/organization/update-installation.md b/docs/examples/organization/update-installation.md index 59ccac7..24ba74d 100644 --- a/docs/examples/organization/update-installation.md +++ b/docs/examples/organization/update-installation.md @@ -10,6 +10,6 @@ const organization = new sdk.Organization(client); const result = await organization.updateInstallation({ installationId: '', - authorizationDetails: '' // optional + authorizationDetails: '', // optional }); ``` diff --git a/docs/examples/organization/update-key.md b/docs/examples/organization/update-key.md index ade0116..cca30fd 100644 --- a/docs/examples/organization/update-key.md +++ b/docs/examples/organization/update-key.md @@ -12,6 +12,6 @@ const result = await organization.updateKey({ keyId: '', name: '', scopes: [sdk.OrganizationKeyScopes.ProjectsRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional + expire: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/organization/update-membership.md b/docs/examples/organization/update-membership.md index 17d7e17..1898509 100644 --- a/docs/examples/organization/update-membership.md +++ b/docs/examples/organization/update-membership.md @@ -10,6 +10,6 @@ const organization = new sdk.Organization(client); const result = await organization.updateMembership({ membershipId: '', - roles: [] + roles: [], }); ``` diff --git a/docs/examples/organization/update-project.md b/docs/examples/organization/update-project.md index f457ec2..5daee82 100644 --- a/docs/examples/organization/update-project.md +++ b/docs/examples/organization/update-project.md @@ -10,6 +10,6 @@ const organization = new sdk.Organization(client); const result = await organization.updateProject({ projectId: '', - name: '' + name: '', }); ``` diff --git a/docs/examples/organization/update.md b/docs/examples/organization/update.md index 21485ef..c06253b 100644 --- a/docs/examples/organization/update.md +++ b/docs/examples/organization/update.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const organization = new sdk.Organization(client); const result = await organization.update({ - name: '' + name: '', }); ``` diff --git a/docs/examples/postgresql/create-backup-policy.md b/docs/examples/postgresql/create-backup-policy.md new file mode 100644 index 0000000..be7e3a2 --- /dev/null +++ b/docs/examples/postgresql/create-backup-policy.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createBackupPolicy({ + databaseId: '', + policyId: '', + name: '', + schedule: '', + retention: 1, + type: 'full', // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/postgresql/create-backup.md b/docs/examples/postgresql/create-backup.md new file mode 100644 index 0000000..7711581 --- /dev/null +++ b/docs/examples/postgresql/create-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createBackup({ + databaseId: '', + type: 'full', // optional +}); +``` diff --git a/docs/examples/postgresql/create-branch.md b/docs/examples/postgresql/create-branch.md new file mode 100644 index 0000000..e0bcb7b --- /dev/null +++ b/docs/examples/postgresql/create-branch.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createBranch({ + databaseId: '', + branchId: '', // optional + ttl: 300, // optional +}); +``` diff --git a/docs/examples/postgresql/create-execution.md b/docs/examples/postgresql/create-execution.md new file mode 100644 index 0000000..28d8a93 --- /dev/null +++ b/docs/examples/postgresql/create-execution.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createExecution({ + databaseId: '', + sql: '', + bindings: {}, // optional + timeoutSeconds: 1, // optional +}); +``` diff --git a/docs/examples/postgresql/create-extension.md b/docs/examples/postgresql/create-extension.md new file mode 100644 index 0000000..106c827 --- /dev/null +++ b/docs/examples/postgresql/create-extension.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createExtension({ + databaseId: '', + name: '', +}); +``` diff --git a/docs/examples/postgresql/create-failover.md b/docs/examples/postgresql/create-failover.md new file mode 100644 index 0000000..8dccf71 --- /dev/null +++ b/docs/examples/postgresql/create-failover.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createFailover({ + databaseId: '', + targetReplicaId: '', // optional +}); +``` diff --git a/docs/examples/postgresql/create-migration.md b/docs/examples/postgresql/create-migration.md new file mode 100644 index 0000000..6f9629d --- /dev/null +++ b/docs/examples/postgresql/create-migration.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createMigration({ + databaseId: '', + targetType: 'shared', + specification: '', // optional +}); +``` diff --git a/docs/examples/postgresql/create-restoration.md b/docs/examples/postgresql/create-restoration.md new file mode 100644 index 0000000..5cc8ea0 --- /dev/null +++ b/docs/examples/postgresql/create-restoration.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createRestoration({ + databaseId: '', + type: 'backup', // optional + backupId: '', // optional + targetDatabaseId: '', // optional + targetTime: '2020-10-15T06:38:00.000+00:00', // optional +}); +``` diff --git a/docs/examples/postgresql/create-upgrade.md b/docs/examples/postgresql/create-upgrade.md new file mode 100644 index 0000000..018f1e7 --- /dev/null +++ b/docs/examples/postgresql/create-upgrade.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.createUpgrade({ + databaseId: '', + targetVersion: '', +}); +``` diff --git a/docs/examples/postgresql/create.md b/docs/examples/postgresql/create.md new file mode 100644 index 0000000..90f66cb --- /dev/null +++ b/docs/examples/postgresql/create.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.create({ + databaseId: '', + name: '', + version: '17', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional +}); +``` diff --git a/docs/examples/postgresql/delete-backup-policy.md b/docs/examples/postgresql/delete-backup-policy.md new file mode 100644 index 0000000..0b19db3 --- /dev/null +++ b/docs/examples/postgresql/delete-backup-policy.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.deleteBackupPolicy({ + databaseId: '', + policyId: '', +}); +``` diff --git a/docs/examples/postgresql/delete-backup.md b/docs/examples/postgresql/delete-backup.md new file mode 100644 index 0000000..2574a4b --- /dev/null +++ b/docs/examples/postgresql/delete-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.deleteBackup({ + databaseId: '', + backupId: '', +}); +``` diff --git a/docs/examples/postgresql/delete-branch.md b/docs/examples/postgresql/delete-branch.md new file mode 100644 index 0000000..dc4778b --- /dev/null +++ b/docs/examples/postgresql/delete-branch.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.deleteBranch({ + databaseId: '', + branchId: '', +}); +``` diff --git a/docs/examples/postgresql/delete-extension.md b/docs/examples/postgresql/delete-extension.md new file mode 100644 index 0000000..470cd12 --- /dev/null +++ b/docs/examples/postgresql/delete-extension.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.deleteExtension({ + databaseId: '', + extensionName: '', +}); +``` diff --git a/docs/examples/postgresql/delete.md b/docs/examples/postgresql/delete.md new file mode 100644 index 0000000..c367702 --- /dev/null +++ b/docs/examples/postgresql/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.delete({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/get-backup-policy.md b/docs/examples/postgresql/get-backup-policy.md new file mode 100644 index 0000000..cf54b34 --- /dev/null +++ b/docs/examples/postgresql/get-backup-policy.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.getBackupPolicy({ + databaseId: '', + policyId: '', +}); +``` diff --git a/docs/examples/postgresql/get-backup.md b/docs/examples/postgresql/get-backup.md new file mode 100644 index 0000000..419acb9 --- /dev/null +++ b/docs/examples/postgresql/get-backup.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.getBackup({ + databaseId: '', + backupId: '', +}); +``` diff --git a/docs/examples/postgresql/get-pitr.md b/docs/examples/postgresql/get-pitr.md new file mode 100644 index 0000000..1032b3c --- /dev/null +++ b/docs/examples/postgresql/get-pitr.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.getPitr({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/get-pooler.md b/docs/examples/postgresql/get-pooler.md new file mode 100644 index 0000000..a06ae6d --- /dev/null +++ b/docs/examples/postgresql/get-pooler.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.getPooler({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/get-replicas.md b/docs/examples/postgresql/get-replicas.md new file mode 100644 index 0000000..b0c52c0 --- /dev/null +++ b/docs/examples/postgresql/get-replicas.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.getReplicas({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/get-restoration.md b/docs/examples/postgresql/get-restoration.md new file mode 100644 index 0000000..593f710 --- /dev/null +++ b/docs/examples/postgresql/get-restoration.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.getRestoration({ + databaseId: '', + restorationId: '', +}); +``` diff --git a/docs/examples/postgresql/get-status.md b/docs/examples/postgresql/get-status.md new file mode 100644 index 0000000..0f6d7e9 --- /dev/null +++ b/docs/examples/postgresql/get-status.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.getStatus({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/get.md b/docs/examples/postgresql/get.md new file mode 100644 index 0000000..dc2d021 --- /dev/null +++ b/docs/examples/postgresql/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.get({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/list-backup-policies.md b/docs/examples/postgresql/list-backup-policies.md new file mode 100644 index 0000000..281577f --- /dev/null +++ b/docs/examples/postgresql/list-backup-policies.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.listBackupPolicies({ + databaseId: '', + queries: [], // optional +}); +``` diff --git a/docs/examples/postgresql/list-backups.md b/docs/examples/postgresql/list-backups.md new file mode 100644 index 0000000..183fd59 --- /dev/null +++ b/docs/examples/postgresql/list-backups.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.listBackups({ + databaseId: '', + queries: [], // optional +}); +``` diff --git a/docs/examples/postgresql/list-branches.md b/docs/examples/postgresql/list-branches.md new file mode 100644 index 0000000..bda35d2 --- /dev/null +++ b/docs/examples/postgresql/list-branches.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.listBranches({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/list-extensions.md b/docs/examples/postgresql/list-extensions.md new file mode 100644 index 0000000..9e36319 --- /dev/null +++ b/docs/examples/postgresql/list-extensions.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.listExtensions({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/list-operations.md b/docs/examples/postgresql/list-operations.md new file mode 100644 index 0000000..3c11834 --- /dev/null +++ b/docs/examples/postgresql/list-operations.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.listOperations({ + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/postgresql/list-restorations.md b/docs/examples/postgresql/list-restorations.md new file mode 100644 index 0000000..9ee58d2 --- /dev/null +++ b/docs/examples/postgresql/list-restorations.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.listRestorations({ + databaseId: '', + status: 'pending', // optional + type: 'backup', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/postgresql/list-specifications.md b/docs/examples/postgresql/list-specifications.md new file mode 100644 index 0000000..14b5b5d --- /dev/null +++ b/docs/examples/postgresql/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.listSpecifications(); +``` diff --git a/docs/examples/postgresql/list.md b/docs/examples/postgresql/list.md new file mode 100644 index 0000000..4a6597b --- /dev/null +++ b/docs/examples/postgresql/list.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.list({ + queries: [], // optional +}); +``` diff --git a/docs/examples/postgresql/update-backup-policy.md b/docs/examples/postgresql/update-backup-policy.md new file mode 100644 index 0000000..9914a6e --- /dev/null +++ b/docs/examples/postgresql/update-backup-policy.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.updateBackupPolicy({ + databaseId: '', + policyId: '', + name: '', // optional + schedule: '', // optional + retention: 1, // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/postgresql/update-backup-storage.md b/docs/examples/postgresql/update-backup-storage.md new file mode 100644 index 0000000..83ae700 --- /dev/null +++ b/docs/examples/postgresql/update-backup-storage.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.updateBackupStorage({ + databaseId: '', + provider: 's3', + bucket: '', + accessKey: '', + secretKey: '', + region: '', // optional + prefix: '', // optional + endpoint: '', // optional +}); +``` diff --git a/docs/examples/postgresql/update-credentials.md b/docs/examples/postgresql/update-credentials.md new file mode 100644 index 0000000..26898b6 --- /dev/null +++ b/docs/examples/postgresql/update-credentials.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.updateCredentials({ + databaseId: '', +}); +``` diff --git a/docs/examples/postgresql/update-maintenance.md b/docs/examples/postgresql/update-maintenance.md new file mode 100644 index 0000000..da5a12b --- /dev/null +++ b/docs/examples/postgresql/update-maintenance.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.updateMaintenance({ + databaseId: '', + day: 'sun', + hourUtc: 0, +}); +``` diff --git a/docs/examples/postgresql/update-pooler.md b/docs/examples/postgresql/update-pooler.md new file mode 100644 index 0000000..e09e1d8 --- /dev/null +++ b/docs/examples/postgresql/update-pooler.md @@ -0,0 +1,22 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.updatePooler({ + databaseId: '', + mode: 'transaction', // optional + maxConnections: 10, // optional + defaultPoolSize: 1, // optional + readWriteSplitting: false, // optional + poolerCpuRequest: '', // optional + poolerCpuLimit: '', // optional + poolerMemoryRequest: '', // optional + poolerMemoryLimit: '', // optional +}); +``` diff --git a/docs/examples/postgresql/update.md b/docs/examples/postgresql/update.md new file mode 100644 index 0000000..87de3f9 --- /dev/null +++ b/docs/examples/postgresql/update.md @@ -0,0 +1,34 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const postgresql = new sdk.Postgresql(client); + +const result = await postgresql.update({ + databaseId: '', + name: '', // optional + status: 'ready', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + metricsTraceSampleRate: null, // optional + metricsSlowQueryLogThresholdMs: 0, // optional + sqlApiEnabled: false, // optional + sqlApiAllowedStatements: [], // optional + sqlApiMaxRows: 1, // optional + sqlApiMaxBytes: 1024, // optional + sqlApiTimeoutSeconds: 1, // optional +}); +``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md index 4c1cfc2..866d674 100644 --- a/docs/examples/presences/delete.md +++ b/docs/examples/presences/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const presences = new sdk.Presences(client); const result = await presences.delete({ - presenceId: '' + presenceId: '', }); ``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md index 1e8a332..76aee59 100644 --- a/docs/examples/presences/get.md +++ b/docs/examples/presences/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const presences = new sdk.Presences(client); const result = await presences.get({ - presenceId: '' + presenceId: '', }); ``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md index fbb18d4..cd6e51d 100644 --- a/docs/examples/presences/list.md +++ b/docs/examples/presences/list.md @@ -11,6 +11,6 @@ const presences = new sdk.Presences(client); const result = await presences.list({ queries: [], // optional total: false, // optional - ttl: 0 // optional + ttl: 0, // optional }); ``` diff --git a/docs/examples/presences/update.md b/docs/examples/presences/update.md index 0056a50..e456487 100644 --- a/docs/examples/presences/update.md +++ b/docs/examples/presences/update.md @@ -15,6 +15,6 @@ const result = await presences.update({ expiresAt: '2020-10-15T06:38:00.000+00:00', // optional metadata: {}, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional - purge: false // optional + purge: false, // optional }); ``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md index 63b9267..646cab8 100644 --- a/docs/examples/presences/upsert.md +++ b/docs/examples/presences/upsert.md @@ -14,6 +14,6 @@ const result = await presences.upsert({ status: '', permissions: [sdk.Permission.read(sdk.Role.any())], // optional expiresAt: '2020-10-15T06:38:00.000+00:00', // optional - metadata: {} // optional + metadata: {}, // optional }); ``` diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md index 09a9f33..083eee1 100644 --- a/docs/examples/project/create-android-platform.md +++ b/docs/examples/project/create-android-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.createAndroidPlatform({ platformId: '', name: '', - applicationId: '' + applicationId: '', }); ``` diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md index 6ffe87b..544e306 100644 --- a/docs/examples/project/create-apple-platform.md +++ b/docs/examples/project/create-apple-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.createApplePlatform({ platformId: '', name: '', - bundleIdentifier: '' + bundleIdentifier: '', }); ``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index e368a60..352c631 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.createEphemeralKey({ scopes: [sdk.ProjectKeyScopes.ProjectRead], - duration: 600 + duration: 600, }); ``` diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md index aa51173..7555da3 100644 --- a/docs/examples/project/create-linux-platform.md +++ b/docs/examples/project/create-linux-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.createLinuxPlatform({ platformId: '', name: '', - packageName: '' + packageName: '', }); ``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md index 6bb2962..74fc639 100644 --- a/docs/examples/project/create-mock-phone.md +++ b/docs/examples/project/create-mock-phone.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.createMockPhone({ number: '+12065550100', - otp: '' + otp: '', }); ``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md index 708daf8..0246650 100644 --- a/docs/examples/project/create-smtp-test.md +++ b/docs/examples/project/create-smtp-test.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.createSMTPTest({ - emails: [] + emails: [], }); ``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md index 6333b93..3f06a9e 100644 --- a/docs/examples/project/create-variable.md +++ b/docs/examples/project/create-variable.md @@ -12,6 +12,6 @@ const result = await project.createVariable({ variableId: '', key: '', value: '', - secret: false // optional + secret: false, // optional }); ``` diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md index 84e36ce..50ae6db 100644 --- a/docs/examples/project/create-web-platform.md +++ b/docs/examples/project/create-web-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.createWebPlatform({ platformId: '', name: '', - hostname: 'app.example.com' + hostname: 'app.example.com', }); ``` diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md index 369f034..4bc666e 100644 --- a/docs/examples/project/create-windows-platform.md +++ b/docs/examples/project/create-windows-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.createWindowsPlatform({ platformId: '', name: '', - packageIdentifierName: '' + packageIdentifierName: '', }); ``` diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md index bbe19c2..1001322 100644 --- a/docs/examples/project/delete-key.md +++ b/docs/examples/project/delete-key.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.deleteKey({ - keyId: '' + keyId: '', }); ``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md index 94d341a..7270f73 100644 --- a/docs/examples/project/delete-mock-phone.md +++ b/docs/examples/project/delete-mock-phone.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.deleteMockPhone({ - number: '+12065550100' + number: '+12065550100', }); ``` diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md index cb73480..f1cd0a9 100644 --- a/docs/examples/project/delete-platform.md +++ b/docs/examples/project/delete-platform.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.deletePlatform({ - platformId: '' + platformId: '', }); ``` diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md index c930811..9db9b3a 100644 --- a/docs/examples/project/delete-variable.md +++ b/docs/examples/project/delete-variable.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.deleteVariable({ - variableId: '' + variableId: '', }); ``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md index d4683e5..5645f40 100644 --- a/docs/examples/project/get-email-template.md +++ b/docs/examples/project/get-email-template.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.getEmailTemplate({ templateId: sdk.ProjectEmailTemplateId.Verification, - locale: sdk.ProjectEmailTemplateLocale.Af // optional + locale: sdk.ProjectEmailTemplateLocale.Af, // optional }); ``` diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md index 81b7e2f..ef42cd1 100644 --- a/docs/examples/project/get-key.md +++ b/docs/examples/project/get-key.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getKey({ - keyId: '' + keyId: '', }); ``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md index 73082c4..d17069d 100644 --- a/docs/examples/project/get-mock-phone.md +++ b/docs/examples/project/get-mock-phone.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getMockPhone({ - number: '+12065550100' + number: '+12065550100', }); ``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index 7c1d85c..94012a5 100644 --- a/docs/examples/project/get-o-auth-2-provider.md +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getOAuth2Provider({ - providerId: sdk.ProjectOAuthProviderId.Amazon + providerId: sdk.ProjectOAuthProviderId.Amazon, }); ``` diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md index 4f450e4..bfebc6b 100644 --- a/docs/examples/project/get-platform.md +++ b/docs/examples/project/get-platform.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getPlatform({ - platformId: '' + platformId: '', }); ``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index e55cb85..03e4327 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getPolicy({ - policyId: sdk.ProjectPolicyId.PasswordDictionary + policyId: sdk.ProjectPolicyId.PasswordDictionary, }); ``` diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md index 5232de8..951e5d4 100644 --- a/docs/examples/project/get-variable.md +++ b/docs/examples/project/get-variable.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.getVariable({ - variableId: '' + variableId: '', }); ``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md index 34bc777..54c3cea 100644 --- a/docs/examples/project/list-email-templates.md +++ b/docs/examples/project/list-email-templates.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.listEmailTemplates({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md index e926682..e0890bd 100644 --- a/docs/examples/project/list-keys.md +++ b/docs/examples/project/list-keys.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.listKeys({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md index 0816b18..024b551 100644 --- a/docs/examples/project/list-mock-phones.md +++ b/docs/examples/project/list-mock-phones.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.listMockPhones({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md index 244767d..50adaa0 100644 --- a/docs/examples/project/list-o-auth-2-providers.md +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.listOAuth2Providers({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md index c180b9d..fc26d4e 100644 --- a/docs/examples/project/list-platforms.md +++ b/docs/examples/project/list-platforms.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.listPlatforms({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md index f7b6260..971552b 100644 --- a/docs/examples/project/list-policies.md +++ b/docs/examples/project/list-policies.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.listPolicies({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md index 3ffd1b9..6f50525 100644 --- a/docs/examples/project/list-variables.md +++ b/docs/examples/project/list-variables.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.listVariables({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md index 8164b0d..ad0d3d2 100644 --- a/docs/examples/project/update-android-platform.md +++ b/docs/examples/project/update-android-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateAndroidPlatform({ platformId: '', name: '', - applicationId: '' + applicationId: '', }); ``` diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md index 93abb67..7170be8 100644 --- a/docs/examples/project/update-apple-platform.md +++ b/docs/examples/project/update-apple-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateApplePlatform({ platformId: '', name: '', - bundleIdentifier: '' + bundleIdentifier: '', }); ``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md index 8e2e4bb..1994e2c 100644 --- a/docs/examples/project/update-auth-method.md +++ b/docs/examples/project/update-auth-method.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.updateAuthMethod({ methodId: sdk.ProjectAuthMethodId.EmailPassword, - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-deny-aliased-email-policy.md b/docs/examples/project/update-deny-aliased-email-policy.md index 92b7e64..61b96ce 100644 --- a/docs/examples/project/update-deny-aliased-email-policy.md +++ b/docs/examples/project/update-deny-aliased-email-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateDenyAliasedEmailPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-deny-corporate-email-policy.md b/docs/examples/project/update-deny-corporate-email-policy.md index 8335b8e..c1b8c9f 100644 --- a/docs/examples/project/update-deny-corporate-email-policy.md +++ b/docs/examples/project/update-deny-corporate-email-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateDenyCorporateEmailPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md index e2b2531..b707e5a 100644 --- a/docs/examples/project/update-deny-disposable-email-policy.md +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateDenyDisposableEmailPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md index 85799e8..07b5e68 100644 --- a/docs/examples/project/update-deny-free-email-policy.md +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateDenyFreeEmailPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md index ddf6ca6..ae14504 100644 --- a/docs/examples/project/update-email-template.md +++ b/docs/examples/project/update-email-template.md @@ -16,6 +16,6 @@ const result = await project.updateEmailTemplate({ senderName: '', // optional senderEmail: 'email@example.com', // optional replyToEmail: 'email@example.com', // optional - replyToName: '' // optional + replyToName: '', // optional }); ``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 39be329..0505a54 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -12,6 +12,6 @@ const result = await project.updateKey({ keyId: '', name: '', scopes: [sdk.ProjectKeyScopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional + expire: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md index f924ec0..1d58ef1 100644 --- a/docs/examples/project/update-labels.md +++ b/docs/examples/project/update-labels.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateLabels({ - labels: [] + labels: [], }); ``` diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md index cb483d6..b145952 100644 --- a/docs/examples/project/update-linux-platform.md +++ b/docs/examples/project/update-linux-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateLinuxPlatform({ platformId: '', name: '', - packageName: '' + packageName: '', }); ``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md index 6fda090..9f23b9a 100644 --- a/docs/examples/project/update-membership-privacy-policy.md +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -14,6 +14,6 @@ const result = await project.updateMembershipPrivacyPolicy({ userPhone: false, // optional userName: false, // optional userMFA: false, // optional - userAccessedAt: false // optional + userAccessedAt: false, // optional }); ``` diff --git a/docs/examples/project/update-mfa-factors-policy.md b/docs/examples/project/update-mfa-factors-policy.md index 5fea996..1d9be8f 100644 --- a/docs/examples/project/update-mfa-factors-policy.md +++ b/docs/examples/project/update-mfa-factors-policy.md @@ -12,6 +12,6 @@ const result = await project.updateMFAFactorsPolicy({ totp: false, // optional email: false, // optional phone: false, // optional - custom: false // optional + custom: false, // optional }); ``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md index a0c70ab..1beb268 100644 --- a/docs/examples/project/update-mock-phone.md +++ b/docs/examples/project/update-mock-phone.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.updateMockPhone({ number: '+12065550100', - otp: '' + otp: '', }); ``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md index 12a535f..a6ddbdb 100644 --- a/docs/examples/project/update-o-auth-2-amazon.md +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Amazon({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md index ae985a4..7c6f559 100644 --- a/docs/examples/project/update-o-auth-2-apple.md +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -13,6 +13,6 @@ const result = await project.updateOAuth2Apple({ keyId: '', // optional teamId: '', // optional p8File: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-appwrite.md b/docs/examples/project/update-o-auth-2-appwrite.md index 6a7df87..b48ccbb 100644 --- a/docs/examples/project/update-o-auth-2-appwrite.md +++ b/docs/examples/project/update-o-auth-2-appwrite.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Appwrite({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md index 37bf4a5..d23fb2c 100644 --- a/docs/examples/project/update-o-auth-2-auth-0.md +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -12,6 +12,6 @@ const result = await project.updateOAuth2Auth0({ clientId: '', // optional clientSecret: '', // optional endpoint: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md index e500466..ab18b29 100644 --- a/docs/examples/project/update-o-auth-2-authentik.md +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -12,6 +12,6 @@ const result = await project.updateOAuth2Authentik({ clientId: '', // optional clientSecret: '', // optional endpoint: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md index 0b8aabc..e3be008 100644 --- a/docs/examples/project/update-o-auth-2-autodesk.md +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Autodesk({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md index d3b5dc7..d521d53 100644 --- a/docs/examples/project/update-o-auth-2-bitbucket.md +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Bitbucket({ key: '', // optional secret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md index feecad2..2c14717 100644 --- a/docs/examples/project/update-o-auth-2-bitly.md +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Bitly({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md index c972463..87a23c1 100644 --- a/docs/examples/project/update-o-auth-2-box.md +++ b/docs/examples/project/update-o-auth-2-box.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Box({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md index 8d17633..16942aa 100644 --- a/docs/examples/project/update-o-auth-2-dailymotion.md +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Dailymotion({ apiKey: '', // optional apiSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md index 5469509..151b93c 100644 --- a/docs/examples/project/update-o-auth-2-discord.md +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Discord({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md index c71bebf..296d1e9 100644 --- a/docs/examples/project/update-o-auth-2-disqus.md +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Disqus({ publicKey: '', // optional secretKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md index 9f2654d..913b3cf 100644 --- a/docs/examples/project/update-o-auth-2-dropbox.md +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Dropbox({ appKey: '', // optional appSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md index 684c424..a000289 100644 --- a/docs/examples/project/update-o-auth-2-etsy.md +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Etsy({ keyString: '', // optional sharedSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md index 7fca48a..ed0b531 100644 --- a/docs/examples/project/update-o-auth-2-facebook.md +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Facebook({ appId: '', // optional appSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md index 3b80573..a81d5b1 100644 --- a/docs/examples/project/update-o-auth-2-figma.md +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Figma({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md index 654991c..fc33b5f 100644 --- a/docs/examples/project/update-o-auth-2-fusion-auth.md +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -12,6 +12,6 @@ const result = await project.updateOAuth2FusionAuth({ clientId: '', // optional clientSecret: '', // optional endpoint: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md index cc2be08..0a7a757 100644 --- a/docs/examples/project/update-o-auth-2-git-hub.md +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2GitHub({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md index 40e1943..273c1bc 100644 --- a/docs/examples/project/update-o-auth-2-gitlab.md +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -12,6 +12,6 @@ const result = await project.updateOAuth2Gitlab({ applicationId: '', // optional secret: '', // optional endpoint: 'https://example.com', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md index 726d605..17696bf 100644 --- a/docs/examples/project/update-o-auth-2-google.md +++ b/docs/examples/project/update-o-auth-2-google.md @@ -12,6 +12,6 @@ const result = await project.updateOAuth2Google({ clientId: '', // optional clientSecret: '', // optional prompt: [sdk.ProjectOAuth2GooglePrompt.None], // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-hugging-face.md b/docs/examples/project/update-o-auth-2-hugging-face.md new file mode 100644 index 0000000..ca0acbe --- /dev/null +++ b/docs/examples/project/update-o-auth-2-hugging-face.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2HuggingFace({ + clientId: '', // optional + clientSecret: '', // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md index bce76ee..542675b 100644 --- a/docs/examples/project/update-o-auth-2-keycloak.md +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -13,6 +13,6 @@ const result = await project.updateOAuth2Keycloak({ clientSecret: '', // optional endpoint: '', // optional realmName: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md index 1d58105..88bebd7 100644 --- a/docs/examples/project/update-o-auth-2-kick.md +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Kick({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md index 02c68d9..4e08e84 100644 --- a/docs/examples/project/update-o-auth-2-linkedin.md +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Linkedin({ clientId: '', // optional primaryClientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md index cc5a8c2..29e1869 100644 --- a/docs/examples/project/update-o-auth-2-microsoft.md +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -12,6 +12,6 @@ const result = await project.updateOAuth2Microsoft({ applicationId: '', // optional applicationSecret: '', // optional tenant: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md index c329779..84ccf7b 100644 --- a/docs/examples/project/update-o-auth-2-notion.md +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Notion({ oauthClientId: '', // optional oauthClientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md index 271afcf..6f345b2 100644 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -17,6 +17,6 @@ const result = await project.updateOAuth2Oidc({ userInfoURL: 'https://example.com', // optional prompt: [sdk.ProjectOAuth2OidcPrompt.None], // optional maxAge: 0, // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md index a85c980..519f026 100644 --- a/docs/examples/project/update-o-auth-2-okta.md +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -11,8 +11,8 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Okta({ clientId: '', // optional clientSecret: '', // optional - domain: '', // optional + domain: 'example.com', // optional authorizationServerId: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md index e6b8de7..0abb7d7 100644 --- a/docs/examples/project/update-o-auth-2-paypal-sandbox.md +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2PaypalSandbox({ clientId: '', // optional secretKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md index 8f7162c..1b989c8 100644 --- a/docs/examples/project/update-o-auth-2-paypal.md +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Paypal({ clientId: '', // optional secretKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md index 3d6c2c4..2da4164 100644 --- a/docs/examples/project/update-o-auth-2-podio.md +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Podio({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md index a193763..642249f 100644 --- a/docs/examples/project/update-o-auth-2-salesforce.md +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Salesforce({ customerKey: '', // optional customerSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index 2ea2f48..4dc9305 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -24,6 +24,6 @@ const result = await project.updateOAuth2Server({ userCodeFormat: 'numeric', // optional deviceCodeDuration: 60, // optional defaultScopes: [], // optional - installationScopes: [] // optional + installationScopes: [], // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md index 6dab909..dd9b696 100644 --- a/docs/examples/project/update-o-auth-2-slack.md +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Slack({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md index 72ffa64..9144b69 100644 --- a/docs/examples/project/update-o-auth-2-spotify.md +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Spotify({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md index 1df015f..4621803 100644 --- a/docs/examples/project/update-o-auth-2-stripe.md +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Stripe({ clientId: '', // optional apiSecretKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md index df090e9..1be4443 100644 --- a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2TradeshiftSandbox({ oauth2ClientId: '', // optional oauth2ClientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md index afddd8c..0fe5c0f 100644 --- a/docs/examples/project/update-o-auth-2-tradeshift.md +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Tradeshift({ oauth2ClientId: '', // optional oauth2ClientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md index ad096ea..0cc817c 100644 --- a/docs/examples/project/update-o-auth-2-twitch.md +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Twitch({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md index 597ccd5..262989f 100644 --- a/docs/examples/project/update-o-auth-2-word-press.md +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2WordPress({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md index 79b3b02..28534ef 100644 --- a/docs/examples/project/update-o-auth-2-yahoo.md +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Yahoo({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md index 2f79c44..2618e17 100644 --- a/docs/examples/project/update-o-auth-2-yandex.md +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Yandex({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md index 031a281..8b623cd 100644 --- a/docs/examples/project/update-o-auth-2-zoho.md +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Zoho({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md index 985400b..76d4326 100644 --- a/docs/examples/project/update-o-auth-2-zoom.md +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Zoom({ clientId: '', // optional clientSecret: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md index 183e225..4e37f13 100644 --- a/docs/examples/project/update-o-auth-2x.md +++ b/docs/examples/project/update-o-auth-2x.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2X({ customerKey: '', // optional secretKey: '', // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md index 8b8bdd0..859aa6e 100644 --- a/docs/examples/project/update-password-dictionary-policy.md +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updatePasswordDictionaryPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md index b8ab9d0..e7c0185 100644 --- a/docs/examples/project/update-password-history-policy.md +++ b/docs/examples/project/update-password-history-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updatePasswordHistoryPolicy({ - total: 1 + total: 1, }); ``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md index df490a4..b0669c5 100644 --- a/docs/examples/project/update-password-personal-data-policy.md +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updatePasswordPersonalDataPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-password-strength-policy.md b/docs/examples/project/update-password-strength-policy.md index 3d2648d..9fc9359 100644 --- a/docs/examples/project/update-password-strength-policy.md +++ b/docs/examples/project/update-password-strength-policy.md @@ -13,6 +13,6 @@ const result = await project.updatePasswordStrengthPolicy({ uppercase: false, // optional lowercase: false, // optional number: false, // optional - symbols: false // optional + symbols: false, // optional }); ``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md index 373e917..89d117e 100644 --- a/docs/examples/project/update-protocol.md +++ b/docs/examples/project/update-protocol.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.updateProtocol({ protocolId: sdk.ProjectProtocolId.Rest, - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md index ded8eb7..2140085 100644 --- a/docs/examples/project/update-service.md +++ b/docs/examples/project/update-service.md @@ -10,6 +10,6 @@ const project = new sdk.Project(client); const result = await project.updateService({ serviceId: sdk.ProjectServiceId.Account, - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md index 5454608..5a71343 100644 --- a/docs/examples/project/update-session-alert-policy.md +++ b/docs/examples/project/update-session-alert-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateSessionAlertPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md index 35ae13d..12544ef 100644 --- a/docs/examples/project/update-session-duration-policy.md +++ b/docs/examples/project/update-session-duration-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateSessionDurationPolicy({ - duration: 60 + duration: 60, }); ``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md index a5840bc..c4234ff 100644 --- a/docs/examples/project/update-session-invalidation-policy.md +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateSessionInvalidationPolicy({ - enabled: false + enabled: false, }); ``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md index 514d77a..0c4c8a3 100644 --- a/docs/examples/project/update-session-limit-policy.md +++ b/docs/examples/project/update-session-limit-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateSessionLimitPolicy({ - total: 1 + total: 1, }); ``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index d7ace09..869ab60 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -9,8 +9,8 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateSMTP({ - host: '', // optional - port: null, // optional + host: 'example.com', // optional + port: 587, // optional username: '', // optional password: 'password', // optional senderEmail: 'email@example.com', // optional @@ -18,6 +18,6 @@ const result = await project.updateSMTP({ replyToEmail: 'email@example.com', // optional replyToName: '', // optional secure: sdk.ProjectSMTPSecure.Tls, // optional - enabled: false // optional + enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md index a631e0f..44451f8 100644 --- a/docs/examples/project/update-user-limit-policy.md +++ b/docs/examples/project/update-user-limit-policy.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateUserLimitPolicy({ - total: 0 + total: 0, }); ``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md index 58e738e..b53da55 100644 --- a/docs/examples/project/update-variable.md +++ b/docs/examples/project/update-variable.md @@ -12,6 +12,6 @@ const result = await project.updateVariable({ variableId: '', key: '', // optional value: '', // optional - secret: false // optional + secret: false, // optional }); ``` diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md index 9c4f9bd..8dcdca7 100644 --- a/docs/examples/project/update-web-platform.md +++ b/docs/examples/project/update-web-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateWebPlatform({ platformId: '', name: '', - hostname: 'app.example.com' + hostname: 'app.example.com', }); ``` diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md index 3fd19d7..0fc1f53 100644 --- a/docs/examples/project/update-windows-platform.md +++ b/docs/examples/project/update-windows-platform.md @@ -11,6 +11,6 @@ const project = new sdk.Project(client); const result = await project.updateWindowsPlatform({ platformId: '', name: '', - packageIdentifierName: '' + packageIdentifierName: '', }); ``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md index 25fcf69..2d615fe 100644 --- a/docs/examples/proxy/create-api-rule.md +++ b/docs/examples/proxy/create-api-rule.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.createAPIRule({ - domain: '' + domain: 'example.com', }); ``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md index cf225f6..67203df 100644 --- a/docs/examples/proxy/create-function-rule.md +++ b/docs/examples/proxy/create-function-rule.md @@ -9,8 +9,8 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.createFunctionRule({ - domain: '', + domain: 'example.com', functionId: '', - branch: '' // optional + branch: '', // optional }); ``` diff --git a/docs/examples/proxy/create-invalidation.md b/docs/examples/proxy/create-invalidation.md index 8239fc4..a2e4607 100644 --- a/docs/examples/proxy/create-invalidation.md +++ b/docs/examples/proxy/create-invalidation.md @@ -9,8 +9,8 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.createInvalidation({ - domain: '', + domain: 'example.com', type: sdk.InvalidationType.Tag, - reference: '' // optional + reference: '', // optional }); ``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md index bb028c1..28370b5 100644 --- a/docs/examples/proxy/create-redirect-rule.md +++ b/docs/examples/proxy/create-redirect-rule.md @@ -9,10 +9,10 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.createRedirectRule({ - domain: '', + domain: 'example.com', url: 'https://example.com', statusCode: sdk.StatusCode.MovedPermanently, resourceId: '', - resourceType: sdk.ProxyResourceType.Site + resourceType: sdk.ProxyResourceType.Site, }); ``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md index bafbee3..74b033f 100644 --- a/docs/examples/proxy/create-site-rule.md +++ b/docs/examples/proxy/create-site-rule.md @@ -9,8 +9,8 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.createSiteRule({ - domain: '', + domain: 'example.com', siteId: '', - branch: '' // optional + branch: '', // optional }); ``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md index 2d07a11..b4c2c90 100644 --- a/docs/examples/proxy/delete-rule.md +++ b/docs/examples/proxy/delete-rule.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.deleteRule({ - ruleId: '' + ruleId: '', }); ``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md index e89612d..26d0542 100644 --- a/docs/examples/proxy/get-rule.md +++ b/docs/examples/proxy/get-rule.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.getRule({ - ruleId: '' + ruleId: '', }); ``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md index b161a08..50e4ade 100644 --- a/docs/examples/proxy/list-rules.md +++ b/docs/examples/proxy/list-rules.md @@ -10,6 +10,6 @@ const proxy = new sdk.Proxy(client); const result = await proxy.listRules({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md index 9e050fc..62bc0da 100644 --- a/docs/examples/proxy/update-rule-status.md +++ b/docs/examples/proxy/update-rule-status.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const proxy = new sdk.Proxy(client); const result = await proxy.updateRuleStatus({ - ruleId: '' + ruleId: '', }); ``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index 2603dda..a07dede 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -15,6 +15,6 @@ const result = await sites.createDeployment({ installCommand: '', // optional buildCommand: '', // optional outputDirectory: '', // optional - activate: false // optional + activate: false, // optional }); ``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md index e14d858..84e5786 100644 --- a/docs/examples/sites/create-duplicate-deployment.md +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.createDuplicateDeployment({ siteId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md index b08d94a..f78ae97 100644 --- a/docs/examples/sites/create-template-deployment.md +++ b/docs/examples/sites/create-template-deployment.md @@ -15,6 +15,6 @@ const result = await sites.createTemplateDeployment({ rootDirectory: '', type: sdk.TemplateReferenceType.Branch, reference: '', - activate: false // optional + activate: false, // optional }); ``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index cad7be7..b6acc61 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -13,6 +13,6 @@ const result = await sites.createVariable({ variableId: '', key: '', value: '', - secret: false // optional + secret: false, // optional }); ``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md index 6d28546..5e0b68a 100644 --- a/docs/examples/sites/create-vcs-deployment.md +++ b/docs/examples/sites/create-vcs-deployment.md @@ -12,6 +12,6 @@ const result = await sites.createVcsDeployment({ siteId: '', type: sdk.VCSReferenceType.Branch, reference: '', - activate: false // optional + activate: false, // optional }); ``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index dc4e3ef..686e737 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -29,8 +29,9 @@ const result = await sites.create({ providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional + deploymentRetention: 0, // optional + scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional }); ``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md index 533f298..cf508cc 100644 --- a/docs/examples/sites/delete-deployment.md +++ b/docs/examples/sites/delete-deployment.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.deleteDeployment({ siteId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md index 38f7c3a..e198a5a 100644 --- a/docs/examples/sites/delete-log.md +++ b/docs/examples/sites/delete-log.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.deleteLog({ siteId: '', - logId: '' + logId: '', }); ``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md index 11ebaca..b47b7ac 100644 --- a/docs/examples/sites/delete-variable.md +++ b/docs/examples/sites/delete-variable.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.deleteVariable({ siteId: '', - variableId: '' + variableId: '', }); ``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md index 03bd1a5..45fdb0d 100644 --- a/docs/examples/sites/delete.md +++ b/docs/examples/sites/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const sites = new sdk.Sites(client); const result = await sites.delete({ - siteId: '' + siteId: '', }); ``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index 1d62d28..0cd6d78 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -12,6 +12,6 @@ const result = await sites.getDeploymentDownload({ siteId: '', deploymentId: '', type: sdk.DeploymentDownloadType.Source, // optional - token: '' // optional + token: '', // optional }); ``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md index 1f1430c..b12fa8d 100644 --- a/docs/examples/sites/get-deployment.md +++ b/docs/examples/sites/get-deployment.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.getDeployment({ siteId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md index f8190b4..7423312 100644 --- a/docs/examples/sites/get-log.md +++ b/docs/examples/sites/get-log.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.getLog({ siteId: '', - logId: '' + logId: '', }); ``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md index cafb71b..1403fae 100644 --- a/docs/examples/sites/get-variable.md +++ b/docs/examples/sites/get-variable.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.getVariable({ siteId: '', - variableId: '' + variableId: '', }); ``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md index 0b21b2b..e5a6ef6 100644 --- a/docs/examples/sites/get.md +++ b/docs/examples/sites/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const sites = new sdk.Sites(client); const result = await sites.get({ - siteId: '' + siteId: '', }); ``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index 1b544a0..dec9ad4 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -12,6 +12,6 @@ const result = await sites.listDeployments({ siteId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index 62b1694..967b3fe 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -11,6 +11,6 @@ const sites = new sdk.Sites(client); const result = await sites.listLogs({ siteId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 208c827..85a1a84 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const sites = new sdk.Sites(client); const result = await sites.listSpecifications({ - type: 'runtimes' // optional + type: 'runtimes', // optional }); ``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 26ae321..4133996 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -11,6 +11,6 @@ const sites = new sdk.Sites(client); const result = await sites.listVariables({ siteId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index 518aa70..4b00cd0 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -11,6 +11,6 @@ const sites = new sdk.Sites(client); const result = await sites.list({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md index 73a7475..6a46801 100644 --- a/docs/examples/sites/update-deployment-status.md +++ b/docs/examples/sites/update-deployment-status.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.updateDeploymentStatus({ siteId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md index 1221d37..5b23fbe 100644 --- a/docs/examples/sites/update-site-deployment.md +++ b/docs/examples/sites/update-site-deployment.md @@ -10,6 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.updateSiteDeployment({ siteId: '', - deploymentId: '' + deploymentId: '', }); ``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 2853a18..d489347 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -13,6 +13,6 @@ const result = await sites.updateVariable({ variableId: '', key: '', // optional value: '', // optional - secret: false // optional + secret: false, // optional }); ``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 30928f1..932cf00 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -29,8 +29,9 @@ const result = await sites.update({ providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional + deploymentRetention: 0, // optional + scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional }); ``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 47dc8b3..fe16a23 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -19,6 +19,6 @@ const result = await storage.createBucket({ compression: sdk.Compression.None, // optional encryption: false, // optional antivirus: false, // optional - transformations: false // optional + transformations: false, // optional }); ``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 6a09ee7..d69727e 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -14,6 +14,6 @@ const result = await storage.createFile({ fileId: '', file: InputFile.fromPath('/path/to/file', 'filename'), permissions: [sdk.Permission.read(sdk.Role.any())], // optional - folder: '' // optional + folder: 'photos/2026', // optional }); ``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index bf6fa1b..50fb319 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const storage = new sdk.Storage(client); const result = await storage.deleteBucket({ - bucketId: '' + bucketId: '', }); ``` diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index d49838e..da27653 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -10,6 +10,6 @@ const storage = new sdk.Storage(client); const result = await storage.deleteFile({ bucketId: '', - fileId: '' + fileId: '', }); ``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 380db53..6608f90 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const storage = new sdk.Storage(client); const result = await storage.getBucket({ - bucketId: '' + bucketId: '', }); ``` diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index c0a10d9..6282691 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -11,6 +11,6 @@ const storage = new sdk.Storage(client); const result = await storage.getFileDownload({ bucketId: '', fileId: '', - token: '' // optional + token: '', // optional }); ``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 984333d..5e13a0b 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -16,12 +16,12 @@ const result = await storage.getFilePreview({ gravity: sdk.ImageGravity.Center, // optional quality: -1, // optional borderWidth: 0, // optional - borderColor: '', // optional + borderColor: 'FFFFFF', // optional borderRadius: 0, // optional opacity: 0, // optional rotation: -360, // optional - background: '', // optional + background: 'FFFFFF', // optional output: sdk.ImageFormat.Jpg, // optional - token: '' // optional + token: '', // optional }); ``` diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index a20c4ac..ad9a9d1 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -11,6 +11,6 @@ const storage = new sdk.Storage(client); const result = await storage.getFileView({ bucketId: '', fileId: '', - token: '' // optional + token: '', // optional }); ``` diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index d8bdf4d..f1aca86 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -10,6 +10,6 @@ const storage = new sdk.Storage(client); const result = await storage.getFile({ bucketId: '', - fileId: '' + fileId: '', }); ``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index c17389e..109ff90 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -11,6 +11,6 @@ const storage = new sdk.Storage(client); const result = await storage.listBuckets({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index f51fad9..476da76 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -12,6 +12,6 @@ const result = await storage.listFiles({ bucketId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index c17c969..baddf9c 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -19,6 +19,6 @@ const result = await storage.updateBucket({ compression: sdk.Compression.None, // optional encryption: false, // optional antivirus: false, // optional - transformations: false // optional + transformations: false, // optional }); ``` diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 8d2294f..e178b08 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -12,6 +12,6 @@ const result = await storage.updateFile({ bucketId: '', fileId: '', name: '', // optional - permissions: [sdk.Permission.read(sdk.Role.any())] // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional }); ``` diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md index 21ca0bf..914c27a 100644 --- a/docs/examples/tablesdb/create-big-int-column.md +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createBigIntColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional + min: 0, // optional + max: 1000000, // optional + xdefault: 0, // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index b9df8ba..c8c8955 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createBooleanColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: false, // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 602c2a1..7c0d259 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createDatetimeColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: '2020-10-15T06:38:00.000+00:00', // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index bdd5934..9577598 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createEmailColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: 'email@example.com', // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index 4016ce7..d3b878a 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createEnumColumn({ databaseId: '', tableId: '', - key: '', - elements: [], + key: '', + elements: ['active', 'inactive'], required: false, - xdefault: '', // optional - array: false // optional + xdefault: 'active', // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-failover.md b/docs/examples/tablesdb/create-failover.md index 0ad6437..b95a519 100644 --- a/docs/examples/tablesdb/create-failover.md +++ b/docs/examples/tablesdb/create-failover.md @@ -10,6 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createFailover({ databaseId: '', - targetReplicaId: '' // optional + targetReplicaId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index b533f38..5a284be 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createFloatColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional + min: 0, // optional + max: 100, // optional + xdefault: 10.5, // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 6a7523b..2bd4818 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createIndex({ databaseId: '', tableId: '', - key: '', + key: '', type: sdk.TablesDBIndexType.Key, columns: [], orders: [sdk.OrderBy.Asc], // optional - lengths: [] // optional + lengths: [], // optional }); ``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index 6e99e93..a7d37f7 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createIntegerColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional + min: 0, // optional + max: 100, // optional + xdefault: 10, // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 7d176b6..b6be4f1 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createIpColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', // optional - array: false // optional + xdefault: '192.0.2.0', // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index f99194c..f23523e 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -11,8 +11,12 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createLineColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional + xdefault: [ + [1, 2], + [3, 4], + [5, 6], + ], // optional }); ``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 89d37c4..04dde8e 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createLongtextColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index daa5958..5c9ec6d 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createMediumtextColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-migration.md b/docs/examples/tablesdb/create-migration.md index 8338b36..5b67e91 100644 --- a/docs/examples/tablesdb/create-migration.md +++ b/docs/examples/tablesdb/create-migration.md @@ -11,6 +11,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createMigration({ databaseId: '', specification: 's-1vcpu-1gb', - autoCutover: false // optional + autoCutover: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index d1823aa..80ae635 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -11,15 +11,15 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createOperations({ transactionId: '', operations: [ - { - "action": "create", - "databaseId": "", - "tableId": "", - "rowId": "", - "data": { - "name": "Walter O'Brien" - } - } - ] // optional + { + action: 'create', + databaseId: '', + tableId: '', + rowId: '', + data: { + name: "Walter O'Brien", + }, + }, + ], // optional }); ``` diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index a68d1e4..9783951 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -11,8 +11,8 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createPointColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: [1, 2] // optional + xdefault: [1, 2], // optional }); ``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index 0f4631b..71f1406 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -11,8 +11,15 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createPolygonColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional + xdefault: [ + [ + [1, 2], + [3, 4], + [5, 6], + [1, 2], + ], + ], // optional }); ``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 6f2c0fa..0f40996 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -14,8 +14,8 @@ const result = await tablesDB.createRelationshipColumn({ relatedTableId: '', type: sdk.RelationshipType.OneToOne, twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: sdk.RelationMutate.Cascade // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: sdk.RelationMutate.Cascade, // optional }); ``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 485afcd..c1181b1 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -13,13 +13,13 @@ const result = await tablesDB.createRow({ tableId: '', rowId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 30, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, }, permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index 0536421..af17e87 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -12,6 +12,6 @@ const result = await tablesDB.createRows({ databaseId: '', tableId: '', rows: [], - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 255701c..217c050 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createStringColumn({ databaseId: '', tableId: '', - key: '', + key: '', size: 1, required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index b429f79..cd898df 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -16,6 +16,6 @@ const result = await tablesDB.createTable({ rowSecurity: false, // optional enabled: false, // optional columns: [], // optional - indexes: [] // optional + indexes: [], // optional }); ``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index e7b9a47..4ac2fe7 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createTextColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md index c737347..467ae16 100644 --- a/docs/examples/tablesdb/create-transaction.md +++ b/docs/examples/tablesdb/create-transaction.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createTransaction({ - ttl: 60 // optional + ttl: 60, // optional }); ``` diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index 01e27e7..ba037a6 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createUrlColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: 'https://example.com', // optional - array: false // optional + array: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index 9cfc6fa..3c3ae8a 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createVarcharColumn({ databaseId: '', tableId: '', - key: '', + key: '', size: 1, required: false, - xdefault: '', // optional + xdefault: 'Hello World', // optional array: false, // optional - encrypt: false // optional + encrypt: false, // optional }); ``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index cd18253..c7b4759 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -14,6 +14,6 @@ const result = await tablesDB.create({ enabled: false, // optional specification: 'serverless', // optional replicas: 0, // optional - syncMode: 'async' // optional + syncMode: 'async', // optional }); ``` diff --git a/docs/examples/tablesdb/cutover-migration.md b/docs/examples/tablesdb/cutover-migration.md index 1cf0216..08403b9 100644 --- a/docs/examples/tablesdb/cutover-migration.md +++ b/docs/examples/tablesdb/cutover-migration.md @@ -10,6 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.cutoverMigration({ databaseId: '', - migrationId: '' + migrationId: '', }); ``` diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index 2fafbbb..86e3bec 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -12,9 +12,9 @@ const result = await tablesDB.decrementRowColumn({ databaseId: '', tableId: '', rowId: '', - column: '', - value: null, // optional - min: null, // optional - transactionId: '' // optional + column: '', + value: 1, // optional + min: 0, // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index 51fd96e..abe3d76 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -11,6 +11,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.deleteColumn({ databaseId: '', tableId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index 4c7ad1e..88252dd 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -11,6 +11,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.deleteIndex({ databaseId: '', tableId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/tablesdb/delete-migration.md b/docs/examples/tablesdb/delete-migration.md index 7a85305..9895352 100644 --- a/docs/examples/tablesdb/delete-migration.md +++ b/docs/examples/tablesdb/delete-migration.md @@ -10,6 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.deleteMigration({ databaseId: '', - migrationId: '' + migrationId: '', }); ``` diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index 20d4e95..7bf02f6 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -12,6 +12,6 @@ const result = await tablesDB.deleteRow({ databaseId: '', tableId: '', rowId: '', - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index 3dd8f1e..ccc9715 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -12,6 +12,6 @@ const result = await tablesDB.deleteRows({ databaseId: '', tableId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md index f3071a4..519c162 100644 --- a/docs/examples/tablesdb/delete-table.md +++ b/docs/examples/tablesdb/delete-table.md @@ -10,6 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.deleteTable({ databaseId: '', - tableId: '' + tableId: '', }); ``` diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md index 3daa0bd..2b91f54 100644 --- a/docs/examples/tablesdb/delete-transaction.md +++ b/docs/examples/tablesdb/delete-transaction.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.deleteTransaction({ - transactionId: '' + transactionId: '', }); ``` diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md index 018b3a9..f31f624 100644 --- a/docs/examples/tablesdb/delete.md +++ b/docs/examples/tablesdb/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.delete({ - databaseId: '' + databaseId: '', }); ``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 8daf93d..36159ef 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -11,6 +11,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getColumn({ databaseId: '', tableId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 164f833..8a47a39 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -11,6 +11,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getIndex({ databaseId: '', tableId: '', - key: '' + key: '', }); ``` diff --git a/docs/examples/tablesdb/get-migration.md b/docs/examples/tablesdb/get-migration.md index 8900aa6..6d55824 100644 --- a/docs/examples/tablesdb/get-migration.md +++ b/docs/examples/tablesdb/get-migration.md @@ -10,6 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getMigration({ databaseId: '', - migrationId: '' + migrationId: '', }); ``` diff --git a/docs/examples/tablesdb/get-replicas.md b/docs/examples/tablesdb/get-replicas.md index ab40296..4d10f1d 100644 --- a/docs/examples/tablesdb/get-replicas.md +++ b/docs/examples/tablesdb/get-replicas.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getReplicas({ - databaseId: '' + databaseId: '', }); ``` diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 6cbf26f..5847c69 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -13,6 +13,6 @@ const result = await tablesDB.getRow({ tableId: '', rowId: '', queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/get-status.md b/docs/examples/tablesdb/get-status.md index 3b85821..3dfa7de 100644 --- a/docs/examples/tablesdb/get-status.md +++ b/docs/examples/tablesdb/get-status.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getStatus({ - databaseId: '' + databaseId: '', }); ``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md index e825435..74c7938 100644 --- a/docs/examples/tablesdb/get-table.md +++ b/docs/examples/tablesdb/get-table.md @@ -10,6 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getTable({ databaseId: '', - tableId: '' + tableId: '', }); ``` diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md index c39cfe1..e14fe04 100644 --- a/docs/examples/tablesdb/get-transaction.md +++ b/docs/examples/tablesdb/get-transaction.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.getTransaction({ - transactionId: '' + transactionId: '', }); ``` diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md index 38d5ce7..18187de 100644 --- a/docs/examples/tablesdb/get.md +++ b/docs/examples/tablesdb/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.get({ - databaseId: '' + databaseId: '', }); ``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 1388043..626b84f 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -12,9 +12,9 @@ const result = await tablesDB.incrementRowColumn({ databaseId: '', tableId: '', rowId: '', - column: '', - value: null, // optional - max: null, // optional - transactionId: '' // optional + column: '', + value: 1, // optional + max: 100, // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index 59b2bfb..f14d02b 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -12,6 +12,6 @@ const result = await tablesDB.listColumns({ databaseId: '', tableId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index 7ff6df5..4d5f71b 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -12,6 +12,6 @@ const result = await tablesDB.listIndexes({ databaseId: '', tableId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/tablesdb/list-migrations.md b/docs/examples/tablesdb/list-migrations.md index c3275a5..c8df807 100644 --- a/docs/examples/tablesdb/list-migrations.md +++ b/docs/examples/tablesdb/list-migrations.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.listMigrations({ - databaseId: '' + databaseId: '', }); ``` diff --git a/docs/examples/tablesdb/list-operations.md b/docs/examples/tablesdb/list-operations.md index 62fcb0c..b296278 100644 --- a/docs/examples/tablesdb/list-operations.md +++ b/docs/examples/tablesdb/list-operations.md @@ -10,8 +10,8 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.listOperations({ databaseId: '', - status: 'running', // optional + status: 'queued', // optional limit: 1, // optional - offset: 0 // optional + offset: 0, // optional }); ``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 2777730..4a8c1b5 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -14,6 +14,6 @@ const result = await tablesDB.listRows({ queries: [], // optional transactionId: '', // optional total: false, // optional - ttl: 0 // optional + ttl: 0, // optional }); ``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index 8277901..f59133f 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -12,6 +12,6 @@ const result = await tablesDB.listTables({ databaseId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index 892bd28..51a3fc4 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.listTransactions({ - queries: [] // optional + queries: [], // optional }); ``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 3514e2d..48e0e01 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -11,6 +11,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.list({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md index 4defcb4..51ba71a 100644 --- a/docs/examples/tablesdb/update-big-int-column.md +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateBigIntColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + xdefault: 0, + min: 0, // optional + max: 1000000, // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index 6ad6269..0f292d0 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateBooleanColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: false, - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index ff93b14..162f2f7 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateDatetimeColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index fc6c764..4c4f1e8 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateEmailColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: 'email@example.com', - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index b97a4c5..0b1bf8d 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateEnumColumn({ databaseId: '', tableId: '', - key: '', - elements: [], + key: '', + elements: ['active', 'inactive'], required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'active', + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index d332d81..ee1f80a 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateFloatColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + xdefault: 10.5, + min: 0, // optional + max: 100, // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 4a49705..16284f3 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -11,11 +11,11 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateIntegerColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + xdefault: 10, + min: 0, // optional + max: 100, // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index 00dfce1..99b0a3c 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateIpColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: '192.0.2.0', + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 0a6bd25..f1d3573 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -11,9 +11,13 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateLineColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional + xdefault: [ + [1, 2], + [3, 4], + [5, 6], + ], // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md index cdb2074..e103593 100644 --- a/docs/examples/tablesdb/update-longtext-column.md +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateLongtextColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'Hello World', + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md index 7c84b92..3292151 100644 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateMediumtextColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'Hello World', + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index c2e1050..d5ec472 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updatePointColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: [1, 2], // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 0a38cd0..41b65bf 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -11,9 +11,16 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updatePolygonColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional + xdefault: [ + [ + [1, 2], + [3, 4], + [5, 6], + [1, 2], + ], + ], // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index 86f935a..88b17f1 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -11,8 +11,8 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateRelationshipColumn({ databaseId: '', tableId: '', - key: '', + key: '', onDelete: sdk.RelationMutate.Cascade, // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index bac92af..c88e3ea 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -13,13 +13,13 @@ const result = await tablesDB.updateRow({ tableId: '', rowId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 33, + isAdmin: false, }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 09ab860..c8bb76a 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -12,13 +12,13 @@ const result = await tablesDB.updateRows({ databaseId: '', tableId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 33, + isAdmin: false, }, // optional queries: [], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index 757aa6c..368d97c 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateStringColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', + xdefault: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 6aa65c2..dd37e42 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -15,6 +15,6 @@ const result = await tablesDB.updateTable({ permissions: [sdk.Permission.read(sdk.Role.any())], // optional rowSecurity: false, // optional enabled: false, // optional - purge: false // optional + purge: false, // optional }); ``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md index 69970d6..4a132e6 100644 --- a/docs/examples/tablesdb/update-text-column.md +++ b/docs/examples/tablesdb/update-text-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateTextColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', - newKey: '' // optional + xdefault: 'Hello World', + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md index d060747..a955d48 100644 --- a/docs/examples/tablesdb/update-transaction.md +++ b/docs/examples/tablesdb/update-transaction.md @@ -11,6 +11,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateTransaction({ transactionId: '', commit: false, // optional - rollback: false // optional + rollback: false, // optional }); ``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index 08392f5..72f285c 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -11,9 +11,9 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateUrlColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, xdefault: 'https://example.com', - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md index 58f9422..e2e7714 100644 --- a/docs/examples/tablesdb/update-varchar-column.md +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -11,10 +11,10 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.updateVarcharColumn({ databaseId: '', tableId: '', - key: '', + key: '', required: false, - xdefault: '', + xdefault: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '', // optional }); ``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 8be0bfd..2eb0647 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -14,6 +14,6 @@ const result = await tablesDB.update({ enabled: false, // optional specification: 'serverless', // optional replicas: 0, // optional - syncMode: 'async' // optional + syncMode: 'async', // optional }); ``` diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index f544bc0..38257ec 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -13,13 +13,13 @@ const result = await tablesDB.upsertRow({ tableId: '', rowId: '', data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 33, + isAdmin: false, }, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index 7bbf2ed..fea4cbc 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -12,6 +12,6 @@ const result = await tablesDB.upsertRows({ databaseId: '', tableId: '', rows: [], - transactionId: '' // optional + transactionId: '', // optional }); ``` diff --git a/docs/examples/teams/create-installation.md b/docs/examples/teams/create-installation.md index e84f9d8..30015e7 100644 --- a/docs/examples/teams/create-installation.md +++ b/docs/examples/teams/create-installation.md @@ -11,6 +11,6 @@ const teams = new sdk.Teams(client); const result = await teams.createInstallation({ teamId: '', appId: '', - authorizationDetails: '' // optional + authorizationDetails: '', // optional }); ``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 910bb75..3aa45e3 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -15,6 +15,6 @@ const result = await teams.createMembership({ userId: '', // optional phone: '+12065550100', // optional url: 'https://example.com', // optional - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 8e5702b..a26fdd0 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -11,6 +11,6 @@ const teams = new sdk.Teams(client); const result = await teams.create({ teamId: '', name: '', - roles: [] // optional + roles: [], // optional }); ``` diff --git a/docs/examples/teams/delete-installation.md b/docs/examples/teams/delete-installation.md index d363129..dd235d0 100644 --- a/docs/examples/teams/delete-installation.md +++ b/docs/examples/teams/delete-installation.md @@ -10,6 +10,6 @@ const teams = new sdk.Teams(client); const result = await teams.deleteInstallation({ teamId: '', - installationId: '' + installationId: '', }); ``` diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 7dd1160..018a8da 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -10,6 +10,6 @@ const teams = new sdk.Teams(client); const result = await teams.deleteMembership({ teamId: '', - membershipId: '' + membershipId: '', }); ``` diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 8593956..eb1c1da 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const teams = new sdk.Teams(client); const result = await teams.delete({ - teamId: '' + teamId: '', }); ``` diff --git a/docs/examples/teams/get-installation.md b/docs/examples/teams/get-installation.md index 47c71f3..6945613 100644 --- a/docs/examples/teams/get-installation.md +++ b/docs/examples/teams/get-installation.md @@ -10,6 +10,6 @@ const teams = new sdk.Teams(client); const result = await teams.getInstallation({ teamId: '', - installationId: '' + installationId: '', }); ``` diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 4ecf078..d0e27b6 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -10,6 +10,6 @@ const teams = new sdk.Teams(client); const result = await teams.getMembership({ teamId: '', - membershipId: '' + membershipId: '', }); ``` diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 0238bdb..fc121f7 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const teams = new sdk.Teams(client); const result = await teams.getPrefs({ - teamId: '' + teamId: '', }); ``` diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index bd01c5c..bc61344 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const teams = new sdk.Teams(client); const result = await teams.get({ - teamId: '' + teamId: '', }); ``` diff --git a/docs/examples/teams/list-installations.md b/docs/examples/teams/list-installations.md index ecd4c42..07d25e9 100644 --- a/docs/examples/teams/list-installations.md +++ b/docs/examples/teams/list-installations.md @@ -11,6 +11,6 @@ const teams = new sdk.Teams(client); const result = await teams.listInstallations({ teamId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 1185380..8026950 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -12,6 +12,6 @@ const result = await teams.listMemberships({ teamId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index b4525fb..3484c29 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -11,6 +11,6 @@ const teams = new sdk.Teams(client); const result = await teams.list({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/teams/update-installation.md b/docs/examples/teams/update-installation.md index f62bdfc..b97c7c8 100644 --- a/docs/examples/teams/update-installation.md +++ b/docs/examples/teams/update-installation.md @@ -11,6 +11,6 @@ const teams = new sdk.Teams(client); const result = await teams.updateInstallation({ teamId: '', installationId: '', - authorizationDetails: '' // optional + authorizationDetails: '', // optional }); ``` diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 614737e..51d2222 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -12,6 +12,6 @@ const result = await teams.updateMembershipStatus({ teamId: '', membershipId: '', userId: '', - secret: '' + secret: '', }); ``` diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 95a5c37..7b6fe57 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -11,6 +11,6 @@ const teams = new sdk.Teams(client); const result = await teams.updateMembership({ teamId: '', membershipId: '', - roles: [] + roles: [], }); ``` diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 0c64d2b..e92a921 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -10,6 +10,6 @@ const teams = new sdk.Teams(client); const result = await teams.updateName({ teamId: '', - name: '' + name: '', }); ``` diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 180e322..3f3e90d 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -10,6 +10,6 @@ const teams = new sdk.Teams(client); const result = await teams.updatePrefs({ teamId: '', - prefs: {} + prefs: {}, }); ``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md index bfb5d8d..9161ed9 100644 --- a/docs/examples/tokens/create-file-token.md +++ b/docs/examples/tokens/create-file-token.md @@ -11,6 +11,6 @@ const tokens = new sdk.Tokens(client); const result = await tokens.createFileToken({ bucketId: '', fileId: '', - expire: '2020-10-15T06:38:00.000+00:00' // optional + expire: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md index f3b4089..01d424b 100644 --- a/docs/examples/tokens/delete.md +++ b/docs/examples/tokens/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tokens = new sdk.Tokens(client); const result = await tokens.delete({ - tokenId: '' + tokenId: '', }); ``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md index 383ea5f..bd06de1 100644 --- a/docs/examples/tokens/get.md +++ b/docs/examples/tokens/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const tokens = new sdk.Tokens(client); const result = await tokens.get({ - tokenId: '' + tokenId: '', }); ``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index 13e4848..cd8bd9e 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -12,6 +12,6 @@ const result = await tokens.list({ bucketId: '', fileId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md index 0ab3b16..3f3ddde 100644 --- a/docs/examples/tokens/update.md +++ b/docs/examples/tokens/update.md @@ -10,6 +10,6 @@ const tokens = new sdk.Tokens(client); const result = await tokens.update({ tokenId: '', - expire: '2020-10-15T06:38:00.000+00:00' // optional + expire: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md index 4f45f7f..7035e6d 100644 --- a/docs/examples/users/create-argon-2-user.md +++ b/docs/examples/users/create-argon-2-user.md @@ -12,6 +12,6 @@ const result = await users.createArgon2User({ userId: '', email: 'email@example.com', password: 'password', - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 5510041..bbe9a74 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -12,6 +12,6 @@ const result = await users.createBcryptUser({ userId: '', email: 'email@example.com', password: 'password', - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md index c2e6eaa..cd0c49f 100644 --- a/docs/examples/users/create-jwt.md +++ b/docs/examples/users/create-jwt.md @@ -10,7 +10,7 @@ const users = new sdk.Users(client); const result = await users.createJWT({ userId: '', - sessionId: '', // optional - duration: 0 // optional + sessionId: 'recent()', // optional + duration: 0, // optional }); ``` diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md index 004c3b7..578ba7b 100644 --- a/docs/examples/users/create-md-5-user.md +++ b/docs/examples/users/create-md-5-user.md @@ -12,6 +12,6 @@ const result = await users.createMD5User({ userId: '', email: 'email@example.com', password: 'password', - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index 2f71202..e16cd64 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.createMFARecoveryCodes({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md index 945f747..b55fa42 100644 --- a/docs/examples/users/create-ph-pass-user.md +++ b/docs/examples/users/create-ph-pass-user.md @@ -12,6 +12,6 @@ const result = await users.createPHPassUser({ userId: '', email: 'email@example.com', password: 'password', - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index fc8a5e0..f574a9e 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -15,6 +15,6 @@ const result = await users.createScryptModifiedUser({ passwordSalt: '', passwordSaltSeparator: '', passwordSignerKey: '', - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index e9a3535..e0d72dd 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -13,10 +13,10 @@ const result = await users.createScryptUser({ email: 'email@example.com', password: 'password', passwordSalt: '', - passwordCpu: null, - passwordMemory: null, - passwordParallel: null, - passwordLength: null, - name: '' // optional + passwordCpu: 8, + passwordMemory: 65536, + passwordParallel: 1, + passwordLength: 64, + name: '', // optional }); ``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index 04e3768..2a06e1f 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.createSession({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md index 47c0d74..97a0e4b 100644 --- a/docs/examples/users/create-sha-user.md +++ b/docs/examples/users/create-sha-user.md @@ -13,6 +13,6 @@ const result = await users.createSHAUser({ email: 'email@example.com', password: 'password', passwordVersion: sdk.PasswordHash.Sha1, // optional - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index bc19f2b..e8e1053 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -14,6 +14,6 @@ const result = await users.createTarget({ providerType: sdk.MessagingProviderType.Email, identifier: '', providerId: '', // optional - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index 5978df6..6bfe514 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -11,6 +11,6 @@ const users = new sdk.Users(client); const result = await users.createToken({ userId: '', length: 4, // optional - expire: 60 // optional + expire: 60, // optional }); ``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index c93772d..d552ca3 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -13,6 +13,6 @@ const result = await users.create({ email: 'email@example.com', // optional phone: '+12065550100', // optional password: 'password', // optional - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 1a730d8..2cd96a1 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.deleteIdentity({ - identityId: '' + identityId: '', }); ``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index a5d4e3d..5edacd7 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.deleteMFAAuthenticator({ userId: '', - type: sdk.AuthenticatorType.Totp + type: sdk.AuthenticatorType.Totp, }); ``` diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index d39eccd..dbc81ca 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.deleteSession({ userId: '', - sessionId: '' + sessionId: '', }); ``` diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 9331435..abde055 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.deleteSessions({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 3f57930..1136fad 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.deleteTarget({ userId: '', - targetId: '' + targetId: '', }); ``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 8714dc5..326ac2a 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.delete({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/get-mfa-challenge.md b/docs/examples/users/get-mfa-challenge.md index b20e2c2..a782f34 100644 --- a/docs/examples/users/get-mfa-challenge.md +++ b/docs/examples/users/get-mfa-challenge.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.getMFAChallenge({ userId: '', - challengeId: '' + challengeId: '', }); ``` diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index 3e37992..45bd7a9 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.getMFARecoveryCodes({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index d81539e..ce4fa9e 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.getPrefs({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 97ee964..33a8640 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.getTarget({ userId: '', - targetId: '' + targetId: '', }); ``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 3f86f8c..fa2bd0e 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.get({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index e25c26f..f2ecf28 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -11,6 +11,6 @@ const users = new sdk.Users(client); const result = await users.listIdentities({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 7cb97e2..9ed271f 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -11,6 +11,6 @@ const users = new sdk.Users(client); const result = await users.listLogs({ userId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 0a758c0..b8cdcda 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -12,6 +12,6 @@ const result = await users.listMemberships({ userId: '', queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 9272a20..9685721 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.listMFAFactors({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index d941dcf..fb163e2 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.listSessions({ userId: '', - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index aa7be74..9ec0bb0 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -11,6 +11,6 @@ const users = new sdk.Users(client); const result = await users.listTargets({ userId: '', queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 916dabc..04b3ead 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -11,6 +11,6 @@ const users = new sdk.Users(client); const result = await users.list({ queries: [], // optional search: '', // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 7a43202..2fcca5d 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateEmailVerification({ userId: '', - emailVerification: false + emailVerification: false, }); ``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 10cf002..f465f32 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateEmail({ userId: '', - email: 'email@example.com' + email: 'email@example.com', }); ``` diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md index a41d11d..7fe71a3 100644 --- a/docs/examples/users/update-impersonator.md +++ b/docs/examples/users/update-impersonator.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateImpersonator({ userId: '', - impersonator: false + impersonator: false, }); ``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 28f2893..e74ec10 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateLabels({ userId: '', - labels: [] + labels: [], }); ``` diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index 41fa921..5f5f3c4 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const users = new sdk.Users(client); const result = await users.updateMFARecoveryCodes({ - userId: '' + userId: '', }); ``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index c62e10f..e6dc0ec 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateMFA({ userId: '', - mfa: false + mfa: false, }); ``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 03369c9..16816e3 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateName({ userId: '', - name: '' + name: '', }); ``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 5cadfdb..fe8f33a 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updatePassword({ userId: '', - password: 'password' + password: 'password', }); ``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 4489902..b850d97 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updatePhoneVerification({ userId: '', - phoneVerification: false + phoneVerification: false, }); ``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index d45d5ed..e29f796 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updatePhone({ userId: '', - number: '+12065550100' + number: '+12065550100', }); ``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index 3bb011a..c041e37 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updatePrefs({ userId: '', - prefs: {} + prefs: {}, }); ``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index ec7d5bd..87c273c 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateStatus({ userId: '', - status: false + status: false, }); ``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index d1dcf74..f6ab162 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -13,6 +13,6 @@ const result = await users.updateTarget({ targetId: '', identifier: '', // optional providerId: '', // optional - name: '' // optional + name: '', // optional }); ``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md new file mode 100644 index 0000000..d7ccf53 --- /dev/null +++ b/docs/examples/vectorsdb/create-collection.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createCollection({ + databaseId: '', + collectionId: '', + name: '', + dimension: 1, + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md new file mode 100644 index 0000000..fc9114a --- /dev/null +++ b/docs/examples/vectorsdb/create-document.md @@ -0,0 +1,23 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createDocument({ + databaseId: '', + collectionId: '', + documentId: '', + data: { + embeddings: [0.12, -0.55, 0.88, 1.02], + metadata: { + key: 'value', + }, + }, + permissions: [sdk.Permission.read(sdk.Role.any())], // optional +}); +``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md new file mode 100644 index 0000000..906ec6a --- /dev/null +++ b/docs/examples/vectorsdb/create-documents.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createDocuments({ + databaseId: '', + collectionId: '', + documents: [], +}); +``` diff --git a/docs/examples/vectorsdb/create-failover.md b/docs/examples/vectorsdb/create-failover.md new file mode 100644 index 0000000..1fe5b24 --- /dev/null +++ b/docs/examples/vectorsdb/create-failover.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createFailover({ + databaseId: '', + targetReplicaId: '', // optional +}); +``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md new file mode 100644 index 0000000..4b09222 --- /dev/null +++ b/docs/examples/vectorsdb/create-index.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createIndex({ + databaseId: '', + collectionId: '', + key: '', + type: sdk.VectorsDBIndexType.HnswEuclidean, + attributes: [], + orders: [sdk.OrderBy.Asc], // optional + lengths: [], // optional +}); +``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md new file mode 100644 index 0000000..3804aee --- /dev/null +++ b/docs/examples/vectorsdb/create-operations.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createOperations({ + transactionId: '', + operations: [ + { + action: 'create', + databaseId: '', + collectionId: '', + documentId: '', + data: { + name: "Walter O'Brien", + }, + }, + ], // optional +}); +``` diff --git a/docs/examples/vectorsdb/create-query.md b/docs/examples/vectorsdb/create-query.md new file mode 100644 index 0000000..cf98dd2 --- /dev/null +++ b/docs/examples/vectorsdb/create-query.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createQuery({ + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0, // optional +}); +``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md new file mode 100644 index 0000000..1e4fd6d --- /dev/null +++ b/docs/examples/vectorsdb/create-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.createTransaction({ + ttl: 60, // optional +}); +``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md new file mode 100644 index 0000000..8fbd31d --- /dev/null +++ b/docs/examples/vectorsdb/create.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.create({ + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async', // optional +}); +``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md new file mode 100644 index 0000000..21aa353 --- /dev/null +++ b/docs/examples/vectorsdb/delete-collection.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.deleteCollection({ + databaseId: '', + collectionId: '', +}); +``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md new file mode 100644 index 0000000..c2f27c3 --- /dev/null +++ b/docs/examples/vectorsdb/delete-document.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.deleteDocument({ + databaseId: '', + collectionId: '', + documentId: '', + transactionId: '', // optional +}); +``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md new file mode 100644 index 0000000..a3905b3 --- /dev/null +++ b/docs/examples/vectorsdb/delete-documents.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.deleteDocuments({ + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md new file mode 100644 index 0000000..2362e3f --- /dev/null +++ b/docs/examples/vectorsdb/delete-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.deleteIndex({ + databaseId: '', + collectionId: '', + key: '', +}); +``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md new file mode 100644 index 0000000..4871cf8 --- /dev/null +++ b/docs/examples/vectorsdb/delete-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.deleteTransaction({ + transactionId: '', +}); +``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md new file mode 100644 index 0000000..486889a --- /dev/null +++ b/docs/examples/vectorsdb/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.delete({ + databaseId: '', +}); +``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md new file mode 100644 index 0000000..147cfa8 --- /dev/null +++ b/docs/examples/vectorsdb/get-collection.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.getCollection({ + databaseId: '', + collectionId: '', +}); +``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md new file mode 100644 index 0000000..a414c9c --- /dev/null +++ b/docs/examples/vectorsdb/get-document.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.getDocument({ + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md new file mode 100644 index 0000000..9b7abb0 --- /dev/null +++ b/docs/examples/vectorsdb/get-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.getIndex({ + databaseId: '', + collectionId: '', + key: '', +}); +``` diff --git a/docs/examples/vectorsdb/get-replicas.md b/docs/examples/vectorsdb/get-replicas.md new file mode 100644 index 0000000..7ce16fa --- /dev/null +++ b/docs/examples/vectorsdb/get-replicas.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.getReplicas({ + databaseId: '', +}); +``` diff --git a/docs/examples/vectorsdb/get-status.md b/docs/examples/vectorsdb/get-status.md new file mode 100644 index 0000000..cb2b35d --- /dev/null +++ b/docs/examples/vectorsdb/get-status.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.getStatus({ + databaseId: '', +}); +``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md new file mode 100644 index 0000000..68437bc --- /dev/null +++ b/docs/examples/vectorsdb/get-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.getTransaction({ + transactionId: '', +}); +``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md new file mode 100644 index 0000000..3ea49d6 --- /dev/null +++ b/docs/examples/vectorsdb/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.get({ + databaseId: '', +}); +``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md new file mode 100644 index 0000000..e3a509e --- /dev/null +++ b/docs/examples/vectorsdb/list-collections.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.listCollections({ + databaseId: '', + queries: [], // optional + search: '', // optional + total: false, // optional +}); +``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md new file mode 100644 index 0000000..c2b4b6e --- /dev/null +++ b/docs/examples/vectorsdb/list-documents.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.listDocuments({ + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0, // optional +}); +``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md new file mode 100644 index 0000000..b0c5b8e --- /dev/null +++ b/docs/examples/vectorsdb/list-indexes.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.listIndexes({ + databaseId: '', + collectionId: '', + queries: [], // optional + total: false, // optional +}); +``` diff --git a/docs/examples/vectorsdb/list-operations.md b/docs/examples/vectorsdb/list-operations.md new file mode 100644 index 0000000..a28e8f4 --- /dev/null +++ b/docs/examples/vectorsdb/list-operations.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.listOperations({ + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0, // optional +}); +``` diff --git a/docs/examples/vectorsdb/list-specifications.md b/docs/examples/vectorsdb/list-specifications.md new file mode 100644 index 0000000..1c281fa --- /dev/null +++ b/docs/examples/vectorsdb/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.listSpecifications(); +``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md new file mode 100644 index 0000000..3dfb273 --- /dev/null +++ b/docs/examples/vectorsdb/list-transactions.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.listTransactions({ + queries: [], // optional +}); +``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md new file mode 100644 index 0000000..55418e8 --- /dev/null +++ b/docs/examples/vectorsdb/list.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.list({ + queries: [], // optional + total: false, // optional +}); +``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md new file mode 100644 index 0000000..4f54654 --- /dev/null +++ b/docs/examples/vectorsdb/update-collection.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.updateCollection({ + databaseId: '', + collectionId: '', + name: '', + dimension: 1, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md new file mode 100644 index 0000000..2c9fe65 --- /dev/null +++ b/docs/examples/vectorsdb/update-document.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.updateDocument({ + databaseId: '', + collectionId: '', + documentId: '', + data: {}, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md new file mode 100644 index 0000000..7027824 --- /dev/null +++ b/docs/examples/vectorsdb/update-documents.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.updateDocuments({ + databaseId: '', + collectionId: '', + data: {}, // optional + queries: [], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md new file mode 100644 index 0000000..5543dfc --- /dev/null +++ b/docs/examples/vectorsdb/update-transaction.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.updateTransaction({ + transactionId: '', + commit: false, // optional + rollback: false, // optional +}); +``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md new file mode 100644 index 0000000..09108e7 --- /dev/null +++ b/docs/examples/vectorsdb/update.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.update({ + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async', // optional +}); +``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md new file mode 100644 index 0000000..26ec74e --- /dev/null +++ b/docs/examples/vectorsdb/upsert-document.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.upsertDocument({ + databaseId: '', + collectionId: '', + documentId: '', + data: {}, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '', // optional +}); +``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md new file mode 100644 index 0000000..38079b9 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-documents.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const vectorsDB = new sdk.VectorsDB(client); + +const result = await vectorsDB.upsertDocuments({ + databaseId: '', + collectionId: '', + documents: [], + transactionId: '', // optional +}); +``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index 75c778c..21ecacc 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -10,13 +10,13 @@ const webhooks = new sdk.Webhooks(client); const result = await webhooks.create({ webhookId: '', - url: '', + url: 'https://example.com/webhook', name: '', events: [], enabled: false, // optional tls: false, // optional authUsername: '', // optional authPassword: 'password', // optional - secret: '' // optional + secret: '', // optional }); ``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md index 51639e2..ecdfcd0 100644 --- a/docs/examples/webhooks/delete.md +++ b/docs/examples/webhooks/delete.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const webhooks = new sdk.Webhooks(client); const result = await webhooks.delete({ - webhookId: '' + webhookId: '', }); ``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md index 07d1ecd..02c4eac 100644 --- a/docs/examples/webhooks/get.md +++ b/docs/examples/webhooks/get.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const webhooks = new sdk.Webhooks(client); const result = await webhooks.get({ - webhookId: '' + webhookId: '', }); ``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md index f509df7..cab8f12 100644 --- a/docs/examples/webhooks/list.md +++ b/docs/examples/webhooks/list.md @@ -10,6 +10,6 @@ const webhooks = new sdk.Webhooks(client); const result = await webhooks.list({ queries: [], // optional - total: false // optional + total: false, // optional }); ``` diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md index 7c0e504..73a41aa 100644 --- a/docs/examples/webhooks/update-secret.md +++ b/docs/examples/webhooks/update-secret.md @@ -10,6 +10,6 @@ const webhooks = new sdk.Webhooks(client); const result = await webhooks.updateSecret({ webhookId: '', - secret: '' // optional + secret: '', // optional }); ``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index f83021c..25362bf 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -11,11 +11,11 @@ const webhooks = new sdk.Webhooks(client); const result = await webhooks.update({ webhookId: '', name: '', - url: '', + url: 'https://example.com/webhook', events: [], enabled: false, // optional tls: false, // optional authUsername: '', // optional - authPassword: 'password' // optional + authPassword: 'password', // optional }); ``` diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..714d238 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,43 @@ +import eslint from '@eslint/js'; +import globals from 'globals'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + tseslint.configs.recommended, + { + ignores: ['dist/', 'types/', 'docs/', 'rollup.config.mjs'], + }, + { + // The generated Jest suite is CommonJS and runs against the build + // output, so it needs Node globals and `require`. + files: ['test/**/*.js'], + languageOptions: { + globals: { ...globals.node, ...globals.jest }, + }, + rules: { + '@typescript-eslint/no-require-imports': 'off', + }, + }, + { + rules: { + // The SDK deliberately exposes loosely-typed surfaces (payloads, + // model generics defaulting to open records), so `any` is part of + // its public contract rather than an oversight. + '@typescript-eslint/no-explicit-any': 'off', + // Empty responses are typed `Promise<{}>` and the models are + // published under the `Models` namespace; both are part of the + // SDK's public API and cannot change without a breaking release. + '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + }, + ], + }, + }, +); diff --git a/package-lock.json b/package-lock.json index ddaddf7..80ee5a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,25 +1,30 @@ { "name": "node-appwrite", - "version": "28.0.0", + "version": "28.1.0-rc.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "28.0.0", + "version": "28.1.0-rc.1", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0", "undici": "^6.27.0" }, "devDependencies": { + "@eslint/js": "10.0.1", "@types/json-bigint": "1.0.4", "@types/node": "26.2.0", "esbuild-plugin-file-path-extensions": "^2.0.0", + "eslint": "10.9.0", + "globals": "16.5.0", "jest": "^30.4.2", + "prettier": "3.9.6", "tslib": "2.8.1", "tsup": "^8.5.1", - "typescript": "5.9.3" + "typescript": "5.9.3", + "typescript-eslint": "8.67.0" }, "overrides": { "esbuild": "^0.28.1", @@ -999,6 +1004,200 @@ "node": ">=18" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.2.tgz", + "integrity": "sha512-+CNAzxglkrpNf/kKywqQfk74QjtceuOE7Qm+AF8miRvPF/wmmK5+OJOgVh3AVTT3RP2mH3+FOaxlE5v72owk0A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -1034,6 +1233,62 @@ "node": ">=8" } }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@istanbuljs/schema": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz", @@ -1443,9 +1698,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1456,9 +1708,9 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.2.tgz", - "integrity": "sha512-JfB4kuJQjaoHuCTseIINHtHWeJnvgEcxjwA5t/Y00ZgaOO1Crz3fjT/p8kT28zA/Caz7oiUMn3d6H2yOVCVwuw==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.3.tgz", + "integrity": "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q==", "dev": true, "license": "MIT", "optional": true, @@ -1473,8 +1725,8 @@ "url": "https://github.com/sponsors/Brooooooklyn" }, "peerDependencies": { - "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", - "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "node_modules/@pkgjs/parseargs": { @@ -1502,9 +1754,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.4.tgz", - "integrity": "sha512-RrPokAb7dmbxFoeO3TloqHyOjgye8RkBhSqmp4aJMIex4c9r46ZstPnleDQOq1t46VOVjwIuwNogIqbodV1Vvg==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.5.tgz", + "integrity": "sha512-jfkGfTwhQpsiSckPF8r9bU3pn3vyd72NlWaO+TgEO6WPSDnUhXzrNYCHBMOYj0ACaUgjm6eERLF+XV9a6RstoA==", "cpu": [ "arm" ], @@ -1516,9 +1768,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.4.tgz", - "integrity": "sha512-JKuJc+pnpks2pjy7L/N3v/cAkZxYlnmuZoD840ldbMI5KDbC4iO9NKwPKYdjYFCMAIIlBzYSFHxIJVYzRo2/8A==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.5.tgz", + "integrity": "sha512-oGVqyQlxnrz9/ty89oHpU857VUHEl5/Xu4R2lS+aivCTrNnSsbiENzTnNaBsjxH0CNWGPhzHArOLFwo+oKXveA==", "cpu": [ "arm64" ], @@ -1530,9 +1782,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.4.tgz", - "integrity": "sha512-krw5uS2STmvJ02x0uTXHbqQNuz+9eZ1iw+qXk9dmW2gvV4jV7O2hEoOnuhFrpOPiel1mBFtqbxYZZtC46hXLOw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.5.tgz", + "integrity": "sha512-bW7B8xMEq8n99Q3ieEcPRGuphurdZAaFzQc9Efyyw3FL6DZO6pMy9xhdN+kBoD7Sy05xNXSr4OyPPnpkYriS/A==", "cpu": [ "arm64" ], @@ -1544,9 +1796,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.4.tgz", - "integrity": "sha512-wsTxtgApb4PrOsNJIm0FZ1h3WvCC+k9uxLJ4ad75hgoS4NiRes2SoJFlDAyMwiUY8IssDqGcHbXuN0sx1tfF1A==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.5.tgz", + "integrity": "sha512-YSwBS86QeHOGlrxJ1PSOIZSkzRL/JmKeunhc+lV6M1a6En8QuVCD/T/qIA0J4Gd2Y86RIOBYrLcOUtqGh9+/1w==", "cpu": [ "x64" ], @@ -1558,9 +1810,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.4.tgz", - "integrity": "sha512-GUOnQlyZe3yAXhWOtOMsn5Qkrv5E5mZXa0thbARWi5Ei2szlVXJFQhddZ4HbAzh8q92w5twp+CQvs/eFanz9YQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.5.tgz", + "integrity": "sha512-2fST8lILgl7cKbme/1KDdPCmbXbG+gqoV3bHp19L0ypX/3akYMBVdOunPleRCwonoLnXOZ/0F+Mt/v8POFmfcQ==", "cpu": [ "arm64" ], @@ -1572,9 +1824,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.4.tgz", - "integrity": "sha512-/Y7f3QuxjzPKsjA/rfEDa3+0vXqyjmJ50Ln8dPpCmWkKTrUoWHG1cWhTqaAMLob2m2nESWuC7yGrREz019Ztqg==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.5.tgz", + "integrity": "sha512-cpIxQCP9J+EVad0a6LO1kY3ZGODlk80VlI+2I96B8xMcdHZ4pLVhfQ49JFpYqjPF91FFkQWftf57YlDcTiw9yQ==", "cpu": [ "x64" ], @@ -1586,16 +1838,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.4.tgz", - "integrity": "sha512-81wiiX3v7aqy+T+bT61TJ78yJjRquqFFTTbAPt08imfQQzkPIW8t6aJbkTagtCCrXMNc9D66+geqlK7ydLPNqA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.5.tgz", + "integrity": "sha512-r9fGh3eFs3e/udWh5ZjXQtxiYK/xoFxQaYR/cELxac/Udkl5Th+IsFm0CX3Kl9hmUH/we7EoMpjJgeQNnE0+IA==", "cpu": [ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1603,16 +1852,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.4.tgz", - "integrity": "sha512-9kmDIvNZqdoHOBZgNtpTBeLWYO/LVipM3H/j62P8848/l/VPEQL6N3uxU9pvP1oZAsXyC2MEnFP3ovRjo7WYNQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.5.tgz", + "integrity": "sha512-xdvFdp7OM6KLJviJT2g/YuRSUjnZgGHk4RNgwIbN7X6cPugOucV60DdHXWzsBVCUdrGb6qSXnJQrrAKMmQuj3Q==", "cpu": [ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1620,16 +1866,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.4.tgz", - "integrity": "sha512-CcnXHWnXg69g+DX5VWL3FHts3qMRN2uVEHX+BZvGLdd07/gXkn3ePjYtO1LDJvxkGKVHMclKBRa1QUTH+6toYQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.5.tgz", + "integrity": "sha512-rRqILAndyzHzP7T9NFQrq+4HFWNhqkqkKur7eiBpfLmz01PO0JKx5Vchu3YllE4YXI/Ftgq/szrDWg5GJ0mI8g==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1637,16 +1880,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.4.tgz", - "integrity": "sha512-iFOibiHnTRuhrWLlRsOQFdZJJIa7S8OwkneJr4ocALP16u5yk6lWLINFwhHaEqBFMsKDUZofLkGos7+CPzGB3g==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.5.tgz", + "integrity": "sha512-Gf4X3qVMucayUvux6aXXPgXovocSFUC0rrffDuPI/S2nHhNMhjcZxsrAFYCOF350PRreW1XwzFj3CT/3bKsWCw==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1654,16 +1894,13 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.4.tgz", - "integrity": "sha512-XnWYMI7euHlb5a871xPja+Gm7DRCFU+FGRrtS2sMq9N8FvqtpagUy6gD4YOemC5MRk9xbh8+jYMEJbigFQwsgA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.5.tgz", + "integrity": "sha512-+s5qA0TNM0qm8PK/a5gt/1Hpx+NV08uSuCncvhziIlQzT6AEV2fnUQo7eBtFTFO0nA9scauvoR2HusfXmQnO4w==", "cpu": [ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1671,16 +1908,13 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.4.tgz", - "integrity": "sha512-qGDAlO0U8xedCcsdRm9oaoQY8DAx/QT7uIxJWhCdx0ceIWX783UC9QSYkdpzAe29wNiVfp24+bZdQmn49o45SQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.5.tgz", + "integrity": "sha512-ybb6QvWwWJCbBWqERpc8K3pYVGIrXlG8MEQ8IIuJY6Y9KdHQxoFoNyfkAOtKn1VHu3KuLidXvwrvGR1mEjeWCw==", "cpu": [ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1688,16 +1922,13 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.4.tgz", - "integrity": "sha512-ru4H6ezD7ysA5EiEK6qkkaEb4modH8CTej6kUy/gQi20u3kB3G7Zn8snXXkeJSCOFKG/rbPPtM/+9Wgas1961w==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.5.tgz", + "integrity": "sha512-nZb1DtnOyhCmYvsC8A2CwOkopVg+IS1+fPUa7rMOAXtNw5+lLCLLPqd6XAiNrGtoQKsbvIBOwsHnBH/3wnb4HQ==", "cpu": [ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1705,16 +1936,13 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.4.tgz", - "integrity": "sha512-2W4MO5WQVJnbJaZdvDb9rhBDuFU1nKIepPFpJUBsTh2k1YY2g+ODViaWuyOAjQ5cOP7NvrvLzt3wvHOoiAvc7w==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.5.tgz", + "integrity": "sha512-yMbj63Sp89ryrXLWyz+sy+fYD2HpOnMCLGbe4Oa1smclFSUukdtD/BgdiHaAetJNb74URD8U4hM+qG5KVzMEkg==", "cpu": [ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1722,16 +1950,13 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.4.tgz", - "integrity": "sha512-+fxjfuoAmVMCYV5QyjoIpu0cp5DOiOTeqYFk1AVaxGr+/ravWLX89XfQmptsoWcaVy/TGf2hexzbUOrCQIL1CQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.5.tgz", + "integrity": "sha512-mhoan3OJw2kYV/e1jtIdmvUZgyBFeA6zGWsOswmR0Tg19TQbowZuR+JMLID6spbbBN7Zee2ejrgmy3+FxGrIdA==", "cpu": [ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1739,16 +1964,13 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.4.tgz", - "integrity": "sha512-jTn8JfHGL4djjFxPuM06LmNUJDsst2jeVlsd9OmIH6zc5sC9K6rIuO4YajXatLUpBmBKl6b35ro1QZocLi+tcA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.5.tgz", + "integrity": "sha512-5ZTLmjWbb1VZdjuyhe83K/8QO0/h11midQCBP+X5OYn32ra7eOBoM0ZqtaY4nkgNsYgmdVhMYPoyVPTjUpHf3w==", "cpu": [ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1756,16 +1978,13 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.4.tgz", - "integrity": "sha512-oCJCJL4pXsoDcP2QZ+JVlPTIRc6266zsIaeJJsWImmF7HO0W8nb6HuSgZlMWxJwaPf8ehbSw8yo0EUw925hKsA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.5.tgz", + "integrity": "sha512-m53kG+br6PGxOTmgBEM2DHSDs9RVjsyEbUwjJPJGTFm1grWOG8EKJggDCTb60unD4Tjby8fi7/m9XfkEWasVWg==", "cpu": [ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1773,16 +1992,13 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.4.tgz", - "integrity": "sha512-W69hukhZ3KKNRCaMIEzKvcFye42hh0FE1+YoYaf5+Ikacuftoco6yO/xouz0hc5d5W/s3yBro5jRiuEE/Q5vUw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.5.tgz", + "integrity": "sha512-6RHPJR1g/uvdYU8uXBnfq3nlqyZCP82Fr6NHgfGoaIeSh0YEqnX/x6uA9MmJJbnSH7swqX4F+CkGdUF+6doiQA==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1790,16 +2006,13 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.4.tgz", - "integrity": "sha512-qiXbGG2jkjXhzXpsFZSR2Xpb8DN/UaxYsbb/STbuR/6fpaDgRmmaq1B/LmtF2wQFOFOSsK2jdE0RZ3a0zHn4QA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.5.tgz", + "integrity": "sha512-xs+OXQtEXgpXT0DmA5+U3qnRZHdCST/5HRQxS8wSPZTUZN/EMWeHuSIod32LQklTBZBV9DyfncKBQ8n5V3eFdw==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1807,9 +2020,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.4.tgz", - "integrity": "sha512-nWeM//hxv8mIo6jD7Hu4o48DVmV9pbV6gsKaWU+4NFyqHoPKwrkRiZGLKUhOBk8qNmDmpwFtPKg80Bo/Tn4xiQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.5.tgz", + "integrity": "sha512-e7hD+sl3s+mcLQDZ8pbudBVsdG6r5yN4w3LqG2TJ8sQHDpblWj5lrJs/3m01Cvlxbt4x13zu5thLjgypgtkYzw==", "cpu": [ "x64" ], @@ -1821,9 +2034,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.4.tgz", - "integrity": "sha512-s62SQ/vgsRSvMwDkOEfTqfgASF0f26ZNaQuTA6Aok5lrikf89yI2W0gFHvZb2Jpgc6N8JnOKZgCK2iciO3CsxQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.5.tgz", + "integrity": "sha512-GiyJaCf+WpMub/17aPcKk27QMl5W6f+KhdPTjlFOn5akH5Wa/DCM9Stdx5cDfmasyKB08MqpVQ1uJE2RkkpbXg==", "cpu": [ "arm64" ], @@ -1835,9 +2048,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.4.tgz", - "integrity": "sha512-J6wGf8TVGbXJq+HH+ttTvrcfNKPbuZecV6KT1B8I18BC5IURUh5kl4Yl5OEP5eFIUoI5BWxCsyYMhFsDx8kekw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.5.tgz", + "integrity": "sha512-+OQ8U2DdoEfXl8T4Fb18AjmEwbXMerKDKCL8yCPAYhKCEEKoul7rkbeGCBFCbAlaGaa7pmtRTpkAJM2LE/i5FA==", "cpu": [ "arm64" ], @@ -1849,9 +2062,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.4.tgz", - "integrity": "sha512-zmfrQd/0wu6oJs8Vq8KwY/YtsKSsLtKe/HwAP4Wqy8LhWjeT55fHRAkOhYQ12wI3ayS4Tt12d5CDRD7N96SAYQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.5.tgz", + "integrity": "sha512-KanvAZrPKbDBFwrgiU9yEVpQoox9QPV1WZOXX7HudJQY+eSlu82CtWxDU8WtuRRvtN5EGkLczkd6Y6DTcvm9wA==", "cpu": [ "ia32" ], @@ -1863,9 +2076,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.4.tgz", - "integrity": "sha512-qPzHqdj9rfUD+w79dtE07zi/kFwKyCJqplp5K5ygeLTp7jLpAoc16OAH39HSmRC9UpozaecsleI8uAdEj6v2yw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.5.tgz", + "integrity": "sha512-1aC3UEWTtRl3RK3VpDJ/Tqk1XI4SLTmXIthAq6wRWo8XiSXJNd+VprJM4/1P4+i6HIaFEFlVi9sTTziniD2tOQ==", "cpu": [ "x64" ], @@ -1877,9 +2090,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.4.tgz", - "integrity": "sha512-zD6NdeWEByGE9QF9vCrlJ5YQB4oq9q91kPZS37Jwj5hOkvR1lTBSpsKhKDw4IJtbQ35LsTS1HD9DZYGKIshU1Q==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.5.tgz", + "integrity": "sha512-/gDJaRs4gl0NPIwqCz+6PkpmhhjRAD2j6P4rSNHBzUkO3naEx2mIU0pRle1vUNRQ7mE/+8OOeXLTv/J56FKiQg==", "cpu": [ "x64" ], @@ -1973,6 +2186,13 @@ "@babel/types": "^7.28.2" } }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", @@ -2014,6 +2234,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "26.2.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-26.2.0.tgz", @@ -2048,6 +2275,249 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.67.0.tgz", + "integrity": "sha512-Un7Heoyj65NREbKAyIrFxeM143NZpExWmy1Nep4DLeQOeLlTeumPjoNKnBrU5D5moWXbPJgRa5Uwcdu0faVNGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.67.0", + "@typescript-eslint/type-utils": "8.67.0", + "@typescript-eslint/utils": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.67.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", + "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.67.0.tgz", + "integrity": "sha512-fUBfTuuEulWqX6V8+O3PtScV01tzYYRUDTAirHFKoRAt7nOzoGiPt0M/bB47wWNy0coOOcgEwAMUtBpykMxl6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.67.0", + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/typescript-estree": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.67.0.tgz", + "integrity": "sha512-cvE8c7ulYeXN9fYuszhCeCsbzyVEXuhrRCybnBre7TUmqb5nRmBfQAwCj0O3WJFDeyAZt4VYv51vMCC9LHSdYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.67.0", + "@typescript-eslint/types": "^8.67.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.67.0.tgz", + "integrity": "sha512-EgvsleTwS4E+WzzSvem8fAUubLwatMNF1B5hHSLQxcvs7q2dtRhGyujHwLJSYlG41niJ7GP24Aha2+0mb1b2kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.67.0.tgz", + "integrity": "sha512-vV+LUSv5njUWsknE71fqKTlXUva+R76SaeORd6Zojcunk/6DvKFXONU3BrAs2H49mbygUXt6gbYunzwqNwlhdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.67.0.tgz", + "integrity": "sha512-aVWDXbRmdXO9siTfX4ditQI1T9+zVcNazT48EJCD0v40/9RIFoUgZ05CmGEq9H2gixRpjUn/iplwvlcvutJW/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/typescript-estree": "8.67.0", + "@typescript-eslint/utils": "8.67.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.67.0.tgz", + "integrity": "sha512-sBtgslww8nsMYUjhdPBiSyUqSzT8uR6g93A2QXnQC8+cGdjz0CyaOdqHDRJb1AtORbZCNUJBBeFA/tNR2uQmww==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.67.0.tgz", + "integrity": "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.67.0", + "@typescript-eslint/tsconfig-utils": "8.67.0", + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/visitor-keys": "8.67.0", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.67.0.tgz", + "integrity": "sha512-U9D1FdwEWBwok3hxxSdhclMb0twvt9QnjIQ0VfQ1AiX2epnpSgv2ubVDsayOFyY8K6FX+AQ7E0FKWVG3iKsj1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.67.0", + "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/typescript-estree": "8.67.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.67.0.tgz", + "integrity": "sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.67.0", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@ungap/structured-clone": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.3.tgz", @@ -2161,9 +2631,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2178,9 +2645,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2195,9 +2659,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2212,9 +2673,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2229,9 +2687,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2246,9 +2701,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2263,9 +2715,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2280,9 +2729,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2297,9 +2743,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2314,9 +2757,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2411,6 +2851,33 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -2428,9 +2895,9 @@ } }, "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", "dev": true, "license": "MIT", "engines": { @@ -2607,9 +3074,9 @@ } }, "node_modules/baseline-browser-mapping": { - "version": "2.11.13", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.13.tgz", - "integrity": "sha512-k9HNuUVMlqVjQ9UHzfPjIqiDbWw7WqT1AoT7GL8VwvF3r0ZfArtgiSPAlmupyNquNgOJHTuH4CKYf8ttMTWBTQ==", + "version": "2.11.19", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.19.tgz", + "integrity": "sha512-Grytf1xOxOEMTGRwx6rLGKkTabd4vMg3VrKdj/7joCmV0qgh4QwMMO6xh34YEXQqirAuUdgQGa5orJQQ+69RBw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2739,9 +3206,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001809", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001809.tgz", - "integrity": "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ==", + "version": "1.0.30001810", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", + "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", "dev": true, "funding": [ { @@ -2819,9 +3286,9 @@ } }, "node_modules/cjs-module-lexer": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz", - "integrity": "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.1.tgz", + "integrity": "sha512-Ca8swihM+/4yKecYHY52kgJd300hi2lADU/a1RxNTRe+RJ9jvqQlESpbz9DnG9mowez8qwXHB8qYdIUw9e+F5Q==", "dev": true, "license": "MIT" }, @@ -3023,6 +3490,13 @@ } } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -3051,9 +3525,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.404", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.404.tgz", - "integrity": "sha512-3WJtd7/lVq2Jnuz6wed1l9+1ZD2u2Tet1/1NBc4Iedkmgbu+I7YuAqdAQ8T+VZtnwysMsAf3IqSq9D1gyZjA2g==", + "version": "1.5.413", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.413.tgz", + "integrity": "sha512-F1XPKvt7HVfly5WND90ec16nFsdr4g5x/cVUP3EqjeyXynupabGDqpMa84wwvuYGDnldXLBz6DLXyZXWO9TPvw==", "dev": true, "license": "ISC" }, @@ -3151,13 +3625,171 @@ } }, "node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.9.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.9.0.tgz", + "integrity": "sha512-5KeEOJZBfEVA47boFiBsf+6MmmJpffM7qEBg4pLla2e4nlKgdKlqCW0oSLOGsT8Wl5uCGJptLV1bkaiShj90Gw==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.2", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.5", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" } }, "node_modules/execa": { @@ -3219,6 +3851,13 @@ "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3226,6 +3865,13 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -3254,18 +3900,34 @@ } } }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "license": "MIT", "dependencies": { - "locate-path": "^5.0.0", + "locate-path": "^6.0.0", "path-exists": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/fix-dts-default-cjs-exports": { @@ -3280,6 +3942,27 @@ "rollup": "^4.34.8" } }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -3384,6 +4067,48 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -3418,6 +4143,16 @@ "node": ">=10.17.0" } }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -3474,6 +4209,16 @@ "dev": true, "license": "MIT" }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -3494,6 +4239,19 @@ "node": ">=6" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -4269,6 +5027,13 @@ "bignumber.js": "^9.0.0" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -4276,6 +5041,20 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -4289,6 +5068,16 @@ "node": ">=6" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -4299,6 +5088,20 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lilconfig": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", @@ -4330,16 +5133,19 @@ } }, "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "license": "MIT", "dependencies": { - "p-locate": "^4.1.0" + "p-locate": "^5.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/lru-cache": { @@ -4419,16 +5225,16 @@ } }, "node_modules/minimatch": { - "version": "9.0.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", - "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.2" + "brace-expansion": "^5.0.8" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -4575,6 +5381,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -4592,29 +5416,16 @@ } }, "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-locate/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "license": "MIT", "dependencies": { - "p-try": "^2.0.0" + "p-limit": "^3.0.2" }, "engines": { - "node": ">=6" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4725,9 +5536,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { @@ -4760,6 +5571,62 @@ "node": ">=8" } }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/pkg-types": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", @@ -4815,6 +5682,32 @@ } } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.9.6", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.6.tgz", + "integrity": "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "30.4.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.4.1.tgz", @@ -4844,6 +5737,16 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/pure-rand": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz", @@ -4925,9 +5828,9 @@ } }, "node_modules/rollup": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.4.tgz", - "integrity": "sha512-RXOqwaPsBGjMNMa4sQjDjHieHEZDFoj/Rdr46l2MU5DfEs16wHJPC2RPTPHWhNl+M3aI472LLqFkFKut4SblOg==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.5.tgz", + "integrity": "sha512-/tqMfgP7GPA3PHhCmuiS4vIjrSVhHLgY++i+dhbG462euyAj7FpM4D9uq1X3BgjlqRdpcOrYhcQtfiQLNc8tqw==", "dev": true, "license": "MIT", "dependencies": { @@ -4942,31 +5845,31 @@ }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", - "@rollup/rollup-android-arm-eabi": "4.62.4", - "@rollup/rollup-android-arm64": "4.62.4", - "@rollup/rollup-darwin-arm64": "4.62.4", - "@rollup/rollup-darwin-x64": "4.62.4", - "@rollup/rollup-freebsd-arm64": "4.62.4", - "@rollup/rollup-freebsd-x64": "4.62.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.62.4", - "@rollup/rollup-linux-arm-musleabihf": "4.62.4", - "@rollup/rollup-linux-arm64-gnu": "4.62.4", - "@rollup/rollup-linux-arm64-musl": "4.62.4", - "@rollup/rollup-linux-loong64-gnu": "4.62.4", - "@rollup/rollup-linux-loong64-musl": "4.62.4", - "@rollup/rollup-linux-ppc64-gnu": "4.62.4", - "@rollup/rollup-linux-ppc64-musl": "4.62.4", - "@rollup/rollup-linux-riscv64-gnu": "4.62.4", - "@rollup/rollup-linux-riscv64-musl": "4.62.4", - "@rollup/rollup-linux-s390x-gnu": "4.62.4", - "@rollup/rollup-linux-x64-gnu": "4.62.4", - "@rollup/rollup-linux-x64-musl": "4.62.4", - "@rollup/rollup-openbsd-x64": "4.62.4", - "@rollup/rollup-openharmony-arm64": "4.62.4", - "@rollup/rollup-win32-arm64-msvc": "4.62.4", - "@rollup/rollup-win32-ia32-msvc": "4.62.4", - "@rollup/rollup-win32-x64-gnu": "4.62.4", - "@rollup/rollup-win32-x64-msvc": "4.62.4", + "@rollup/rollup-android-arm-eabi": "4.62.5", + "@rollup/rollup-android-arm64": "4.62.5", + "@rollup/rollup-darwin-arm64": "4.62.5", + "@rollup/rollup-darwin-x64": "4.62.5", + "@rollup/rollup-freebsd-arm64": "4.62.5", + "@rollup/rollup-freebsd-x64": "4.62.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.5", + "@rollup/rollup-linux-arm-musleabihf": "4.62.5", + "@rollup/rollup-linux-arm64-gnu": "4.62.5", + "@rollup/rollup-linux-arm64-musl": "4.62.5", + "@rollup/rollup-linux-loong64-gnu": "4.62.5", + "@rollup/rollup-linux-loong64-musl": "4.62.5", + "@rollup/rollup-linux-ppc64-gnu": "4.62.5", + "@rollup/rollup-linux-ppc64-musl": "4.62.5", + "@rollup/rollup-linux-riscv64-gnu": "4.62.5", + "@rollup/rollup-linux-riscv64-musl": "4.62.5", + "@rollup/rollup-linux-s390x-gnu": "4.62.5", + "@rollup/rollup-linux-x64-gnu": "4.62.5", + "@rollup/rollup-linux-x64-musl": "4.62.5", + "@rollup/rollup-openbsd-x64": "4.62.5", + "@rollup/rollup-openharmony-arm64": "4.62.5", + "@rollup/rollup-win32-arm64-msvc": "4.62.5", + "@rollup/rollup-win32-ia32-msvc": "4.62.5", + "@rollup/rollup-win32-x64-gnu": "4.62.5", + "@rollup/rollup-win32-x64-msvc": "4.62.5", "fsevents": "~2.3.2" } }, @@ -5060,6 +5963,16 @@ "node": ">=10" } }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -5400,6 +6313,19 @@ "tree-kill": "cli.js" } }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", @@ -5477,6 +6403,19 @@ "node": ">= 12" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -5514,6 +6453,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.67.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.67.0.tgz", + "integrity": "sha512-S2udFs8tCKEKffuJ4TB1idGUZiXdCPGi3IPBGWXarbLQ5UPXORV8QEVzJ4gCRduURMb5EkpNCdjbk0eDIuI8Yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.67.0", + "@typescript-eslint/parser": "8.67.0", + "@typescript-eslint/typescript-estree": "8.67.0", + "@typescript-eslint/utils": "8.67.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, "node_modules/ufo": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", @@ -5606,6 +6569,16 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -5647,6 +6620,16 @@ "node": ">= 8" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", diff --git a/package.json b/package.json index 7187f8b..fb24dcb 100644 --- a/package.json +++ b/package.json @@ -1,62 +1,72 @@ { - "name": "node-appwrite", - "homepage": "https://appwrite.io/support", - "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "28.0.0", - "license": "BSD-3-Clause", - "main": "dist/index.js", - "type": "commonjs", - "scripts": { - "build": "tsup", - "test": "jest" - }, - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - } + "name": "node-appwrite", + "homepage": "https://appwrite.io/support", + "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", + "version": "28.1.0-rc.1", + "license": "BSD-3-Clause", + "main": "dist/index.js", + "type": "commonjs", + "scripts": { + "build": "tsup", + "test": "jest", + "format": "prettier --write .", + "format:check": "prettier --check .", + "lint": "eslint .", + "lint:fix": "eslint --fix .", + "analyse": "tsc --noEmit" }, - "./file": { - "import": { - "types": "./dist/inputFile.d.mts", - "default": "./dist/inputFile.mjs" - }, - "require": { - "types": "./dist/inputFile.d.ts", - "default": "./dist/inputFile.js" - } + "exports": { + ".": { + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "./file": { + "import": { + "types": "./dist/inputFile.d.mts", + "default": "./dist/inputFile.mjs" + }, + "require": { + "types": "./dist/inputFile.d.ts", + "default": "./dist/inputFile.js" + } + } + }, + "files": [ + "dist" + ], + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-node" + }, + "devDependencies": { + "@eslint/js": "10.0.1", + "eslint": "10.9.0", + "globals": "16.5.0", + "@types/json-bigint": "1.0.4", + "@types/node": "26.2.0", + "tsup": "^8.5.1", + "esbuild-plugin-file-path-extensions": "^2.0.0", + "tslib": "2.8.1", + "typescript": "5.9.3", + "typescript-eslint": "8.67.0", + "jest": "^30.4.2", + "prettier": "3.9.6" + }, + "dependencies": { + "json-bigint": "1.0.0", + "undici": "^6.27.0" + }, + "overrides": { + "esbuild": "^0.28.1", + "js-yaml": "^4.2.0", + "brace-expansion": "5.0.9" } - }, - "files": [ - "dist" - ], - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/appwrite/sdk-for-node" - }, - "devDependencies": { - "@types/json-bigint": "1.0.4", - "@types/node": "26.2.0", - "tsup": "^8.5.1", - "esbuild-plugin-file-path-extensions": "^2.0.0", - "tslib": "2.8.1", - "typescript": "5.9.3", - "jest": "^30.4.2" - }, - "dependencies": { - "json-bigint": "1.0.0", - "undici": "^6.27.0" - }, - "overrides": { - "esbuild": "^0.28.1", - "js-yaml": "^4.2.0", - "brace-expansion": "5.0.9" - } } diff --git a/src/client.ts b/src/client.ts index 3575fc6..db7ce13 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,12 +11,14 @@ const MAX_INT64 = BigInt('9223372036854775807'); const MIN_INT64 = BigInt('-9223372036854775808'); function isBigNumber(value: any): boolean { - return value !== null - && typeof value === 'object' - && value._isBigNumber === true - && typeof value.isInteger === 'function' - && typeof value.toFixed === 'function' - && typeof value.toNumber === 'function'; + return ( + value !== null && + typeof value === 'object' && + value._isBigNumber === true && + typeof value.isInteger === 'function' && + typeof value.toFixed === 'function' && + typeof value.toNumber === 'function' + ); } function reviver(_key: string, value: any): any { @@ -39,12 +41,12 @@ function reviver(_key: string, value: any): any { const JSONbig = { parse: (text: string) => JSONbigParser.parse(text, reviver), - stringify: JSONbigSerializer.stringify + stringify: JSONbigSerializer.stringify, }; type Payload = { [key: string]: any; -} +}; type UploadProgress = { $id: string; @@ -52,17 +54,22 @@ type UploadProgress = { sizeUploaded: number; chunksTotal: number; chunksUploaded: number; -} +}; type Headers = { [key: string]: string; -} +}; class AppwriteException extends Error { code: number; response: string; type: string; - constructor(message: string, code: number = 0, type: string = '', response: string = '') { + constructor( + message: string, + code: number = 0, + type: string = '', + response: string = '', + ) { super(message); this.name = 'AppwriteException'; this.message = message; @@ -73,14 +80,15 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/28.0.0'; + let ua = 'AppwriteNodeJSSDK/28.1.0-rc.1'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; if (typeof process !== 'undefined') { - if (typeof process.platform === 'string') platform.push(process.platform); + if (typeof process.platform === 'string') + platform.push(process.platform); if (typeof process.arch === 'string') platform.push(process.arch); - } + } if (platform.length > 0) { ua += ` (${platform.join('; ')})`; } @@ -88,17 +96,21 @@ function getUserAgent() { // `navigator.userAgent` is available in Node.js 21 and later. // It's also part of the WinterCG spec, so many edge runtimes provide it. // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent - // @ts-ignore - if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') { - // @ts-ignore + if ( + typeof navigator !== 'undefined' && + typeof navigator.userAgent === 'string' + ) { ua += ` ${navigator.userAgent}`; - // @ts-ignore + // @ts-expect-error EdgeRuntime is injected by edge runtimes only. } else if (typeof globalThis.EdgeRuntime === 'string') { ua += ` EdgeRuntime`; - // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`. - } else if (typeof process !== 'undefined' && typeof process.version === 'string') { + // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`. + } else if ( + typeof process !== 'undefined' && + typeof process.version === 'string' + ) { ua += ` Node.js/${process.version}`; } @@ -130,8 +142,8 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '28.0.0', - 'user-agent' : getUserAgent(), + 'x-sdk-version': '28.1.0-rc.1', + 'user-agent': getUserAgent(), 'X-Appwrite-Response-Format': '1.9.6', }; @@ -149,7 +161,10 @@ class Client { throw new AppwriteException('Endpoint must be a valid string'); } - if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) { + if ( + !endpoint.startsWith('http://') && + !endpoint.startsWith('https://') + ) { throw new AppwriteException('Invalid endpoint URL: ' + endpoint); } @@ -165,7 +180,7 @@ class Client { * @returns {this} */ setSelfSigned(selfSigned: boolean): this { - // @ts-ignore + // @ts-expect-error EdgeRuntime is injected by edge runtimes only. if (typeof globalThis.EdgeRuntime !== 'undefined') { console.warn('setSelfSigned is not supported in edge runtimes.'); } @@ -386,12 +401,17 @@ class Client { return this; } - prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } { + prepareRequest( + method: string, + url: URL, + headers: Headers = {}, + params: Payload = {}, + ): { uri: string; options: RequestInit } { method = method.toUpperCase(); headers = Object.assign({}, this.headers, headers); - let options: RequestInit = { + const options: RequestInit = { method, headers, }; @@ -417,7 +437,7 @@ class Client { options.body = JSONbig.stringify(params); break; - case 'multipart/form-data': + case 'multipart/form-data': { const formData = new FormData(); for (const [key, value] of Object.entries(params)) { @@ -435,16 +455,25 @@ class Client { options.body = formData; delete headers['content-type']; break; + } } } return { uri: url.toString(), options }; } - async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) { - const [fileParam, file] = Object.entries(originalPayload).find( - ([_, value]) => value instanceof File || value instanceof InputFile - ) ?? []; + async chunkedUpload( + method: string, + url: URL, + headers: Headers = {}, + originalPayload: Payload = {}, + onProgress: (progress: UploadProgress) => void, + ) { + const [fileParam, file] = + Object.entries(originalPayload).find( + ([_, value]) => + value instanceof File || value instanceof InputFile, + ) ?? []; if (!file || !fileParam) { throw new Error('File not found in payload'); @@ -463,12 +492,20 @@ class Client { // Upload first chunk alone to get the upload ID const firstChunkEnd = Math.min(Client.CHUNK_SIZE, size); - const firstChunkHeaders = { ...headers, 'content-range': `bytes 0-${firstChunkEnd - 1}/${size}` }; + const firstChunkHeaders = { + ...headers, + 'content-range': `bytes 0-${firstChunkEnd - 1}/${size}`, + }; const firstChunk = await file.slice(0, firstChunkEnd); const firstPayload = { ...originalPayload }; firstPayload[fileParam] = new File([firstChunk], file.filename); - let response = await this.call(method, url, firstChunkHeaders, firstPayload); + const response = await this.call( + method, + url, + firstChunkHeaders, + firstPayload, + ); const uploadId = response?.$id; if (onProgress && typeof onProgress === 'function') { @@ -477,7 +514,7 @@ class Client { progress: Math.round((firstChunkEnd / size) * 100), sizeUploaded: firstChunkEnd, chunksTotal: totalChunks, - chunksUploaded: 1 + chunksUploaded: 1, }); } @@ -504,29 +541,39 @@ class Client { const isUploadComplete = (chunkResponse: any) => { const chunksUploaded = chunkResponse?.chunksUploaded; const chunksTotal = chunkResponse?.chunksTotal ?? totalChunks; - return typeof chunksUploaded === 'number' && typeof chunksTotal === 'number' && chunksUploaded >= chunksTotal; + return ( + typeof chunksUploaded === 'number' && + typeof chunksTotal === 'number' && + chunksUploaded >= chunksTotal + ); }; - const uploadChunk = async (chunk: typeof chunks[0]) => { + const uploadChunk = async (chunk: (typeof chunks)[0]) => { const chunkHeaders = { ...headers }; if (uploadId) { chunkHeaders['x-appwrite-id'] = uploadId; } - chunkHeaders['content-range'] = `bytes ${chunk.start}-${chunk.end - 1}/${size}`; - + chunkHeaders['content-range'] = + `bytes ${chunk.start}-${chunk.end - 1}/${size}`; + const chunkBlob = await file.slice(chunk.start, chunk.end); const chunkPayload = { ...originalPayload }; chunkPayload[fileParam] = new File([chunkBlob], file.filename); - const chunkResponse = await this.call(method, url, chunkHeaders, chunkPayload); + const chunkResponse = await this.call( + method, + url, + chunkHeaders, + chunkPayload, + ); if (failed) { return chunkResponse; } - + completedCount++; - uploadedBytes += (chunk.end - chunk.start); - + uploadedBytes += chunk.end - chunk.start; + lastResponse = chunkResponse; if (isUploadComplete(chunkResponse)) { finalResponse = chunkResponse; @@ -538,7 +585,7 @@ class Client { progress: Math.round((uploadedBytes / size) * 100), sizeUploaded: uploadedBytes, chunksTotal: totalChunks, - chunksUploaded: completedCount + chunksUploaded: completedCount, }); } @@ -562,7 +609,7 @@ class Client { throw error; } } - })() + })(), ); } @@ -579,12 +626,20 @@ class Client { // Upload first chunk alone to get the upload ID const firstChunkEnd = Math.min(Client.CHUNK_SIZE, file.size); - const firstChunkHeaders = { ...headers, 'content-range': `bytes 0-${firstChunkEnd - 1}/${file.size}` }; + const firstChunkHeaders = { + ...headers, + 'content-range': `bytes 0-${firstChunkEnd - 1}/${file.size}`, + }; const firstChunk = file.slice(0, firstChunkEnd); const firstPayload = { ...originalPayload }; firstPayload[fileParam] = new File([firstChunk], file.name); - let response = await this.call(method, url, firstChunkHeaders, firstPayload); + const response = await this.call( + method, + url, + firstChunkHeaders, + firstPayload, + ); const uploadId = response?.$id; if (onProgress && typeof onProgress === 'function') { @@ -593,7 +648,7 @@ class Client { progress: Math.round((firstChunkEnd / file.size) * 100), sizeUploaded: firstChunkEnd, chunksTotal: totalChunks, - chunksUploaded: 1 + chunksUploaded: 1, }); } @@ -620,29 +675,39 @@ class Client { const isUploadComplete = (chunkResponse: any) => { const chunksUploaded = chunkResponse?.chunksUploaded; const chunksTotal = chunkResponse?.chunksTotal ?? totalChunks; - return typeof chunksUploaded === 'number' && typeof chunksTotal === 'number' && chunksUploaded >= chunksTotal; + return ( + typeof chunksUploaded === 'number' && + typeof chunksTotal === 'number' && + chunksUploaded >= chunksTotal + ); }; - const uploadChunk = async (chunk: typeof chunks[0]) => { + const uploadChunk = async (chunk: (typeof chunks)[0]) => { const chunkHeaders = { ...headers }; if (uploadId) { chunkHeaders['x-appwrite-id'] = uploadId; } - chunkHeaders['content-range'] = `bytes ${chunk.start}-${chunk.end - 1}/${file.size}`; - + chunkHeaders['content-range'] = + `bytes ${chunk.start}-${chunk.end - 1}/${file.size}`; + const chunkBlob = file.slice(chunk.start, chunk.end); const chunkPayload = { ...originalPayload }; chunkPayload[fileParam] = new File([chunkBlob], file.name); - const chunkResponse = await this.call(method, url, chunkHeaders, chunkPayload); + const chunkResponse = await this.call( + method, + url, + chunkHeaders, + chunkPayload, + ); if (failed) { return chunkResponse; } - + completedCount++; - uploadedBytes += (chunk.end - chunk.start); - + uploadedBytes += chunk.end - chunk.start; + lastResponse = chunkResponse; if (isUploadComplete(chunkResponse)) { finalResponse = chunkResponse; @@ -654,7 +719,7 @@ class Client { progress: Math.round((uploadedBytes / file.size) * 100), sizeUploaded: uploadedBytes, chunksTotal: totalChunks, - chunksUploaded: completedCount + chunksUploaded: completedCount, }); } @@ -678,7 +743,7 @@ class Client { throw error; } } - })() + })(), ); } @@ -690,16 +755,26 @@ class Client { async ping(): Promise { return this.call('GET', new URL(this.config.endpoint + '/ping'), { 'X-Appwrite-Project': this.config.project, - 'accept': 'application/json', + accept: 'application/json', }); } - async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise { - const { uri, options } = this.prepareRequest(method, url, headers, params); - + async redirect( + method: string, + url: URL, + headers: Headers = {}, + params: Payload = {}, + ): Promise { + const { uri, options } = this.prepareRequest( + method, + url, + headers, + params, + ); + const response = await fetch(uri, { ...options, - redirect: 'manual' + redirect: 'manual', }); if (response.status !== 301 && response.status !== 302) { @@ -709,8 +784,19 @@ class Client { return response.headers.get('location') || ''; } - async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise { - const { uri, options } = this.prepareRequest(method, url, headers, params); + async call( + method: string, + url: URL, + headers: Headers = {}, + params: Payload = {}, + responseType = 'json', + ): Promise { + const { uri, options } = this.prepareRequest( + method, + url, + headers, + params, + ); let data: any = null; @@ -718,27 +804,43 @@ class Client { const warnings = response.headers.get('x-appwrite-warning'); if (warnings) { - warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning)); + warnings + .split(';') + .forEach((warning: string) => + console.warn('Warning: ' + warning), + ); } - if (response.headers.get('content-type')?.includes('application/json')) { + if ( + response.headers.get('content-type')?.includes('application/json') + ) { data = JSONbig.parse(await response.text()); } else if (responseType === 'arrayBuffer') { data = await response.arrayBuffer(); } else { data = { - message: await response.text() + message: await response.text(), }; } if (400 <= response.status) { - let responseText = ''; - if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') { + let responseText: string; + if ( + response.headers + .get('content-type') + ?.includes('application/json') || + responseType === 'arrayBuffer' + ) { responseText = JSONbig.stringify(data); } else { responseText = data?.message; } - throw new AppwriteException(data?.message, response.status, data?.type, responseText); + throw new AppwriteException( + data?.message, + response.status, + data?.type, + responseText, + ); } if (data && typeof data === 'object') { @@ -757,7 +859,7 @@ class Client { let output: Payload = {}; for (const [key, value] of Object.entries(data)) { - let finalKey = prefix ? prefix + '[' + key +']' : key; + const finalKey = prefix ? prefix + '[' + key + ']' : key; if (Array.isArray(value)) { output = { ...output, ...Client.flatten(value, finalKey) }; } else { diff --git a/src/enums/adapter.ts b/src/enums/adapter.ts index a3b1ae0..ff6b3f4 100644 --- a/src/enums/adapter.ts +++ b/src/enums/adapter.ts @@ -1,4 +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 index ade1d36..43f788f 100644 --- a/src/enums/attribute-status.ts +++ b/src/enums/attribute-status.ts @@ -4,4 +4,4 @@ export enum AttributeStatus { Deleting = 'deleting', Stuck = 'stuck', Failed = 'failed', -} \ No newline at end of file +} diff --git a/src/enums/authentication-factor.ts b/src/enums/authentication-factor.ts index e3260d7..d16c3fe 100644 --- a/src/enums/authentication-factor.ts +++ b/src/enums/authentication-factor.ts @@ -4,4 +4,4 @@ export enum AuthenticationFactor { Totp = 'totp', Recoverycode = 'recoverycode', Custom = 'custom', -} \ No newline at end of file +} diff --git a/src/enums/authenticator-type.ts b/src/enums/authenticator-type.ts index 34db0cc..0c91827 100644 --- a/src/enums/authenticator-type.ts +++ b/src/enums/authenticator-type.ts @@ -1,3 +1,3 @@ export enum AuthenticatorType { Totp = 'totp', -} \ No newline at end of file +} diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts index adef40d..c95b851 100644 --- a/src/enums/backup-services.ts +++ b/src/enums/backup-services.ts @@ -6,4 +6,4 @@ export enum BackupServices { DedicatedDatabases = 'dedicatedDatabases', Functions = 'functions', Storage = 'storage', -} \ No newline at end of file +} diff --git a/src/enums/billing-plan-group.ts b/src/enums/billing-plan-group.ts index 8aa025b..e8cd15d 100644 --- a/src/enums/billing-plan-group.ts +++ b/src/enums/billing-plan-group.ts @@ -2,4 +2,4 @@ export enum BillingPlanGroup { Starter = 'starter', Pro = 'pro', Scale = 'scale', -} \ No newline at end of file +} diff --git a/src/enums/browser-permission.ts b/src/enums/browser-permission.ts index 6e2c4cd..a670a6e 100644 --- a/src/enums/browser-permission.ts +++ b/src/enums/browser-permission.ts @@ -19,4 +19,4 @@ export enum BrowserPermission { Screenwakelock = 'screen-wake-lock', Webshare = 'web-share', Xrspatialtracking = 'xr-spatial-tracking', -} \ No newline at end of file +} diff --git a/src/enums/browser-theme.ts b/src/enums/browser-theme.ts index 9f8c382..acb8d57 100644 --- a/src/enums/browser-theme.ts +++ b/src/enums/browser-theme.ts @@ -1,4 +1,4 @@ export enum BrowserTheme { Light = 'light', Dark = 'dark', -} \ No newline at end of file +} diff --git a/src/enums/browser.ts b/src/enums/browser.ts index cec52fb..7876216 100644 --- a/src/enums/browser.ts +++ b/src/enums/browser.ts @@ -13,4 +13,4 @@ export enum Browser { OperaMini = 'om', Opera = 'op', OperaNext = 'on', -} \ No newline at end of file +} diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index 50f152a..cad34c1 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -77,6 +77,7 @@ export enum BuildRuntime { Bun11 = 'bun-1.1', Bun12 = 'bun-1.2', Bun13 = 'bun-1.3', + Bun14 = 'bun-1.4', Go123 = 'go-1.23', Go124 = 'go-1.24', Go125 = 'go-1.25', @@ -91,4 +92,4 @@ export enum BuildRuntime { Flutter338 = 'flutter-3.38', Flutter341 = 'flutter-3.41', Flutter344 = 'flutter-3.44', -} \ No newline at end of file +} diff --git a/src/enums/column-status.ts b/src/enums/column-status.ts index f53e8a6..934872e 100644 --- a/src/enums/column-status.ts +++ b/src/enums/column-status.ts @@ -4,4 +4,4 @@ export enum ColumnStatus { Deleting = 'deleting', Stuck = 'stuck', Failed = 'failed', -} \ No newline at end of file +} diff --git a/src/enums/compression.ts b/src/enums/compression.ts index 1bec0e7..79d297c 100644 --- a/src/enums/compression.ts +++ b/src/enums/compression.ts @@ -2,4 +2,4 @@ export enum Compression { None = 'none', Gzip = 'gzip', Zstd = 'zstd', -} \ No newline at end of file +} diff --git a/src/enums/credit-card.ts b/src/enums/credit-card.ts index e6ce242..946e493 100644 --- a/src/enums/credit-card.ts +++ b/src/enums/credit-card.ts @@ -16,4 +16,4 @@ export enum CreditCard { MIR = 'mir', Maestro = 'maestro', Rupay = 'rupay', -} \ No newline at end of file +} diff --git a/src/enums/database-status.ts b/src/enums/database-status.ts index 8a01e3b..54e1ada 100644 --- a/src/enums/database-status.ts +++ b/src/enums/database-status.ts @@ -13,4 +13,4 @@ export enum DatabaseStatus { Pausing = 'pausing', Resuming = 'resuming', Failingover = 'failing-over', -} \ No newline at end of file +} diff --git a/src/enums/database-type.ts b/src/enums/database-type.ts index b39f921..725f364 100644 --- a/src/enums/database-type.ts +++ b/src/enums/database-type.ts @@ -6,4 +6,4 @@ export enum DatabaseType { Mysql = 'mysql', Postgresql = 'postgresql', Mongodb = 'mongodb', -} \ No newline at end of file +} diff --git a/src/enums/databases-index-type.ts b/src/enums/databases-index-type.ts index 85ccf86..e849833 100644 --- a/src/enums/databases-index-type.ts +++ b/src/enums/databases-index-type.ts @@ -3,4 +3,4 @@ export enum DatabasesIndexType { 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 index 538709b..80cdec2 100644 --- a/src/enums/deployment-download-type.ts +++ b/src/enums/deployment-download-type.ts @@ -1,4 +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 index 7e8f4a1..f89b390 100644 --- a/src/enums/deployment-status.ts +++ b/src/enums/deployment-status.ts @@ -5,4 +5,4 @@ export enum DeploymentStatus { Ready = 'ready', Canceled = 'canceled', Failed = 'failed', -} \ No newline at end of file +} diff --git a/src/enums/documents-db-index-type.ts b/src/enums/documents-db-index-type.ts new file mode 100644 index 0000000..6c04a5f --- /dev/null +++ b/src/enums/documents-db-index-type.ts @@ -0,0 +1,5 @@ +export enum DocumentsDBIndexType { + Key = 'key', + Fulltext = 'fulltext', + Unique = 'unique', +} diff --git a/src/enums/embedding-model.ts b/src/enums/embedding-model.ts index d06bb77..29bf262 100644 --- a/src/enums/embedding-model.ts +++ b/src/enums/embedding-model.ts @@ -1,6 +1,4 @@ export enum EmbeddingModel { Nomicembedtext = 'nomic-embed-text', - Embeddinggemma = 'embedding-gemma', Allminilm = 'all-minilm', - Bgesmall = 'bge-small', -} \ No newline at end of file +} diff --git a/src/enums/execution-method.ts b/src/enums/execution-method.ts index 39d4c1e..a01b6b1 100644 --- a/src/enums/execution-method.ts +++ b/src/enums/execution-method.ts @@ -6,4 +6,4 @@ export enum ExecutionMethod { DELETE = 'DELETE', OPTIONS = 'OPTIONS', HEAD = 'HEAD', -} \ No newline at end of file +} diff --git a/src/enums/execution-resource-type.ts b/src/enums/execution-resource-type.ts new file mode 100644 index 0000000..f2773e8 --- /dev/null +++ b/src/enums/execution-resource-type.ts @@ -0,0 +1,4 @@ +export enum ExecutionResourceType { + Functions = 'functions', + Sites = 'sites', +} diff --git a/src/enums/execution-status.ts b/src/enums/execution-status.ts index 992d987..81bd395 100644 --- a/src/enums/execution-status.ts +++ b/src/enums/execution-status.ts @@ -4,4 +4,4 @@ export enum ExecutionStatus { Completed = 'completed', Failed = 'failed', Scheduled = 'scheduled', -} \ No newline at end of file +} diff --git a/src/enums/execution-trigger.ts b/src/enums/execution-trigger.ts index 1829d51..84fa8f6 100644 --- a/src/enums/execution-trigger.ts +++ b/src/enums/execution-trigger.ts @@ -2,4 +2,4 @@ export enum ExecutionTrigger { Http = 'http', Schedule = 'schedule', Event = 'event', -} \ No newline at end of file +} diff --git a/src/enums/flag.ts b/src/enums/flag.ts index 7e1d878..ab49b64 100644 --- a/src/enums/flag.ts +++ b/src/enums/flag.ts @@ -194,4 +194,4 @@ export enum Flag { SouthAfrica = 'za', Zambia = 'zm', Zimbabwe = 'zw', -} \ No newline at end of file +} diff --git a/src/enums/framework.ts b/src/enums/framework.ts index 7093da3..6173a0e 100644 --- a/src/enums/framework.ts +++ b/src/enums/framework.ts @@ -14,4 +14,4 @@ export enum Framework { Reactnative = 'react-native', Vite = 'vite', Other = 'other', -} \ No newline at end of file +} diff --git a/src/enums/image-format.ts b/src/enums/image-format.ts index 758fad7..4c210ff 100644 --- a/src/enums/image-format.ts +++ b/src/enums/image-format.ts @@ -6,4 +6,4 @@ export enum ImageFormat { Heic = 'heic', Avif = 'avif', Gif = 'gif', -} \ No newline at end of file +} diff --git a/src/enums/image-gravity.ts b/src/enums/image-gravity.ts index 815095d..a115f3a 100644 --- a/src/enums/image-gravity.ts +++ b/src/enums/image-gravity.ts @@ -8,4 +8,4 @@ export enum ImageGravity { Bottomleft = 'bottom-left', Bottom = 'bottom', Bottomright = 'bottom-right', -} \ No newline at end of file +} diff --git a/src/enums/index-status.ts b/src/enums/index-status.ts index 6ce90ac..241a017 100644 --- a/src/enums/index-status.ts +++ b/src/enums/index-status.ts @@ -4,4 +4,4 @@ export enum IndexStatus { Deleting = 'deleting', Stuck = 'stuck', Failed = 'failed', -} \ No newline at end of file +} diff --git a/src/enums/invalidation-type.ts b/src/enums/invalidation-type.ts index 828f540..e2b0443 100644 --- a/src/enums/invalidation-type.ts +++ b/src/enums/invalidation-type.ts @@ -2,4 +2,4 @@ export enum InvalidationType { Tag = 'tag', Path = 'path', All = 'all', -} \ No newline at end of file +} diff --git a/src/enums/message-priority.ts b/src/enums/message-priority.ts index f3113a8..c4f491e 100644 --- a/src/enums/message-priority.ts +++ b/src/enums/message-priority.ts @@ -1,4 +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 index 08bd483..05be0e8 100644 --- a/src/enums/message-status.ts +++ b/src/enums/message-status.ts @@ -4,4 +4,4 @@ export enum MessageStatus { 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 index 18c9929..f10f630 100644 --- a/src/enums/messaging-provider-type.ts +++ b/src/enums/messaging-provider-type.ts @@ -2,4 +2,4 @@ export enum MessagingProviderType { Email = 'email', Sms = 'sms', Push = 'push', -} \ 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 index f8e98e1..23c5e9f 100644 --- a/src/enums/o-auth-2-google-prompt.ts +++ b/src/enums/o-auth-2-google-prompt.ts @@ -2,4 +2,4 @@ export enum OAuth2GooglePrompt { None = 'none', Consent = 'consent', SelectAccount = 'select_account', -} \ No newline at end of file +} diff --git a/src/enums/o-auth-2-oidc-prompt.ts b/src/enums/o-auth-2-oidc-prompt.ts index daa1ef0..1836202 100644 --- a/src/enums/o-auth-2-oidc-prompt.ts +++ b/src/enums/o-auth-2-oidc-prompt.ts @@ -3,4 +3,4 @@ export enum OAuth2OidcPrompt { Login = 'login', 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 e7136d6..6f0a461 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -19,6 +19,7 @@ export enum OAuthProvider { Github = 'github', Gitlab = 'gitlab', Google = 'google', + Huggingface = 'huggingface', Keycloak = 'keycloak', Kick = 'kick', Linkedin = 'linkedin', @@ -43,4 +44,4 @@ export enum OAuthProvider { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', -} \ No newline at end of file +} diff --git a/src/enums/order-by.ts b/src/enums/order-by.ts index 62dffb9..f954f10 100644 --- a/src/enums/order-by.ts +++ b/src/enums/order-by.ts @@ -1,4 +1,4 @@ export enum OrderBy { Asc = 'asc', Desc = 'desc', -} \ No newline at end of file +} diff --git a/src/enums/organization-key-scopes.ts b/src/enums/organization-key-scopes.ts index eb18181..2e878b4 100644 --- a/src/enums/organization-key-scopes.ts +++ b/src/enums/organization-key-scopes.ts @@ -15,4 +15,4 @@ export enum OrganizationKeyScopes { DomainsWrite = 'domains.write', KeysRead = 'keys.read', KeysWrite = 'keys.write', -} \ No newline at end of file +} diff --git a/src/enums/password-hash.ts b/src/enums/password-hash.ts index 76834af..d615ce6 100644 --- a/src/enums/password-hash.ts +++ b/src/enums/password-hash.ts @@ -10,4 +10,4 @@ export enum PasswordHash { 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 index bde1d30..5585e88 100644 --- a/src/enums/platform-type.ts +++ b/src/enums/platform-type.ts @@ -4,4 +4,4 @@ export enum PlatformType { Android = 'android', Linux = 'linux', Web = 'web', -} \ No newline at end of file +} diff --git a/src/enums/project-auth-method-id.ts b/src/enums/project-auth-method-id.ts index a05c217..367ed14 100644 --- a/src/enums/project-auth-method-id.ts +++ b/src/enums/project-auth-method-id.ts @@ -6,4 +6,4 @@ export enum ProjectAuthMethodId { Invites = 'invites', Jwt = 'jwt', Phone = 'phone', -} \ No newline at end of file +} diff --git a/src/enums/project-email-template-id.ts b/src/enums/project-email-template-id.ts index b5aba1a..c8ecbec 100644 --- a/src/enums/project-email-template-id.ts +++ b/src/enums/project-email-template-id.ts @@ -6,4 +6,4 @@ export enum ProjectEmailTemplateId { MfaChallenge = 'mfaChallenge', SessionAlert = 'sessionAlert', OtpSession = 'otpSession', -} \ No newline at end of file +} diff --git a/src/enums/project-email-template-locale.ts b/src/enums/project-email-template-locale.ts index b5bb7cf..c9e85ac 100644 --- a/src/enums/project-email-template-locale.ts +++ b/src/enums/project-email-template-locale.ts @@ -130,4 +130,4 @@ export enum ProjectEmailTemplateLocale { Zhsg = 'zh-sg', Zhtw = 'zh-tw', Zu = 'zu', -} \ No newline at end of file +} diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts index d4b5c7c..e960600 100644 --- a/src/enums/project-key-scopes.ts +++ b/src/enums/project-key-scopes.ts @@ -1,6 +1,7 @@ export enum ProjectKeyScopes { ProjectRead = 'project.read', ProjectWrite = 'project.write', + UsageRead = 'usage.read', KeysRead = 'keys.read', KeysWrite = 'keys.write', PlatformsRead = 'platforms.read', @@ -40,6 +41,18 @@ export enum ProjectKeyScopes { AttributesWrite = 'attributes.write', DocumentsRead = 'documents.read', DocumentsWrite = 'documents.write', + DocumentsdbRead = 'documentsdb.read', + DocumentsdbWrite = 'documentsdb.write', + DocumentsdbCollectionsRead = 'documentsdb.collections.read', + DocumentsdbCollectionsWrite = 'documentsdb.collections.write', + DocumentsdbDocumentsRead = 'documentsdb.documents.read', + DocumentsdbDocumentsWrite = 'documentsdb.documents.write', + VectorsdbRead = 'vectorsdb.read', + VectorsdbWrite = 'vectorsdb.write', + VectorsdbCollectionsRead = 'vectorsdb.collections.read', + VectorsdbCollectionsWrite = 'vectorsdb.collections.write', + VectorsdbDocumentsRead = 'vectorsdb.documents.read', + VectorsdbDocumentsWrite = 'vectorsdb.documents.write', BucketsRead = 'buckets.read', BucketsWrite = 'buckets.write', FilesRead = 'files.read', @@ -92,7 +105,6 @@ export enum ProjectKeyScopes { ArchivesWrite = 'archives.write', RestorationsRead = 'restorations.read', RestorationsWrite = 'restorations.write', - DedicatedDatabasesExecute = 'dedicatedDatabases.execute', DomainsRead = 'domains.read', DomainsWrite = 'domains.write', WafRulesRead = 'wafRules.read', @@ -104,5 +116,4 @@ export enum ProjectKeyScopes { Oauth2Read = 'oauth2.read', Oauth2Write = 'oauth2.write', Oauth2Introspect = 'oauth2.introspect', - UsageRead = 'usage.read', -} \ No newline at end of file +} diff --git a/src/enums/project-o-auth-2-google-prompt.ts b/src/enums/project-o-auth-2-google-prompt.ts index 75db98e..43b77ed 100644 --- a/src/enums/project-o-auth-2-google-prompt.ts +++ b/src/enums/project-o-auth-2-google-prompt.ts @@ -2,4 +2,4 @@ export enum ProjectOAuth2GooglePrompt { None = 'none', Consent = 'consent', SelectAccount = 'select_account', -} \ No newline at end of file +} diff --git a/src/enums/project-o-auth-2-oidc-prompt.ts b/src/enums/project-o-auth-2-oidc-prompt.ts index 6d346b1..1234422 100644 --- a/src/enums/project-o-auth-2-oidc-prompt.ts +++ b/src/enums/project-o-auth-2-oidc-prompt.ts @@ -3,4 +3,4 @@ export enum ProjectOAuth2OidcPrompt { Login = 'login', Consent = 'consent', SelectAccount = 'select_account', -} \ No newline at end of file +} diff --git a/src/enums/project-o-auth-provider-id.ts b/src/enums/project-o-auth-provider-id.ts index 125ee88..401f3d1 100644 --- a/src/enums/project-o-auth-provider-id.ts +++ b/src/enums/project-o-auth-provider-id.ts @@ -19,6 +19,7 @@ export enum ProjectOAuthProviderId { Github = 'github', Gitlab = 'gitlab', Google = 'google', + Huggingface = 'huggingface', Keycloak = 'keycloak', Kick = 'kick', Linkedin = 'linkedin', @@ -43,4 +44,4 @@ export enum ProjectOAuthProviderId { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', -} \ No newline at end of file +} diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts index 4e287f4..c05f7f6 100644 --- a/src/enums/project-policy-id.ts +++ b/src/enums/project-policy-id.ts @@ -14,4 +14,4 @@ export enum ProjectPolicyId { Denydisposableemail = 'deny-disposable-email', Denyfreeemail = 'deny-free-email', Denycorporateemail = 'deny-corporate-email', -} \ No newline at end of file +} diff --git a/src/enums/project-protocol-id.ts b/src/enums/project-protocol-id.ts index 10a89c2..81546e6 100644 --- a/src/enums/project-protocol-id.ts +++ b/src/enums/project-protocol-id.ts @@ -2,4 +2,4 @@ export enum ProjectProtocolId { Rest = 'rest', Graphql = 'graphql', Websocket = 'websocket', -} \ No newline at end of file +} diff --git a/src/enums/project-service-id.ts b/src/enums/project-service-id.ts index 0da78c5..843da95 100644 --- a/src/enums/project-service-id.ts +++ b/src/enums/project-service-id.ts @@ -18,4 +18,4 @@ export enum ProjectServiceId { Messaging = 'messaging', Advisor = 'advisor', Oauth2 = 'oauth2', -} \ No newline at end of file +} diff --git a/src/enums/project-smtp-secure.ts b/src/enums/project-smtp-secure.ts index d3d3768..03d38af 100644 --- a/src/enums/project-smtp-secure.ts +++ b/src/enums/project-smtp-secure.ts @@ -1,4 +1,4 @@ export enum ProjectSMTPSecure { Tls = 'tls', Ssl = 'ssl', -} \ No newline at end of file +} diff --git a/src/enums/proxy-resource-type.ts b/src/enums/proxy-resource-type.ts index e04c804..0bb3f1e 100644 --- a/src/enums/proxy-resource-type.ts +++ b/src/enums/proxy-resource-type.ts @@ -1,4 +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 index 89236c7..ef69507 100644 --- a/src/enums/proxy-rule-deployment-resource-type.ts +++ b/src/enums/proxy-rule-deployment-resource-type.ts @@ -1,4 +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 index 67b8e4c..f717f93 100644 --- a/src/enums/proxy-rule-status.ts +++ b/src/enums/proxy-rule-status.ts @@ -2,4 +2,4 @@ export enum ProxyRuleStatus { Unverified = 'unverified', Verifying = 'verifying', Verified = 'verified', -} \ No newline at end of file +} diff --git a/src/enums/region.ts b/src/enums/region.ts index 948dd0b..30fc88c 100644 --- a/src/enums/region.ts +++ b/src/enums/region.ts @@ -5,4 +5,4 @@ export enum Region { Sfo = 'sfo', Sgp = 'sgp', Tor = 'tor', -} \ No newline at end of file +} diff --git a/src/enums/relation-mutate.ts b/src/enums/relation-mutate.ts index 722a757..87a4313 100644 --- a/src/enums/relation-mutate.ts +++ b/src/enums/relation-mutate.ts @@ -2,4 +2,4 @@ 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 index 532015a..da13601 100644 --- a/src/enums/relationship-type.ts +++ b/src/enums/relationship-type.ts @@ -3,4 +3,4 @@ export enum RelationshipType { ManyToOne = 'manyToOne', ManyToMany = 'manyToMany', OneToMany = 'oneToMany', -} \ No newline at end of file +} diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index 63e04b2..ecc4e82 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -77,6 +77,7 @@ export enum Runtime { Bun11 = 'bun-1.1', Bun12 = 'bun-1.2', Bun13 = 'bun-1.3', + Bun14 = 'bun-1.4', Go123 = 'go-1.23', Go124 = 'go-1.24', Go125 = 'go-1.25', @@ -91,4 +92,4 @@ export enum Runtime { Flutter338 = 'flutter-3.38', Flutter341 = 'flutter-3.41', Flutter344 = 'flutter-3.44', -} \ No newline at end of file +} diff --git a/src/enums/smtp-encryption.ts b/src/enums/smtp-encryption.ts index 876177b..5fe9c93 100644 --- a/src/enums/smtp-encryption.ts +++ b/src/enums/smtp-encryption.ts @@ -2,4 +2,4 @@ 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 index 425d65c..f5bfac4 100644 --- a/src/enums/status-code.ts +++ b/src/enums/status-code.ts @@ -3,4 +3,4 @@ export enum StatusCode { Found = '302', TemporaryRedirect = '307', PermanentRedirect = '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 index a199cd9..246bfc4 100644 --- a/src/enums/tables-db-index-type.ts +++ b/src/enums/tables-db-index-type.ts @@ -3,4 +3,4 @@ export enum TablesDBIndexType { 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 index bd72cfb..afcaea0 100644 --- a/src/enums/template-reference-type.ts +++ b/src/enums/template-reference-type.ts @@ -2,4 +2,4 @@ export enum TemplateReferenceType { Commit = 'commit', Branch = 'branch', Tag = 'tag', -} \ No newline at end of file +} diff --git a/src/enums/timezone.ts b/src/enums/timezone.ts index 207298a..24c08db 100644 --- a/src/enums/timezone.ts +++ b/src/enums/timezone.ts @@ -418,4 +418,4 @@ export enum Timezone { PacificWake = 'pacific/wake', PacificWallis = 'pacific/wallis', Utc = 'utc', -} \ No newline at end of file +} diff --git a/src/enums/vcs-reference-type.ts b/src/enums/vcs-reference-type.ts index cb5270f..55f1d89 100644 --- a/src/enums/vcs-reference-type.ts +++ b/src/enums/vcs-reference-type.ts @@ -2,4 +2,4 @@ export enum VCSReferenceType { Branch = 'branch', Commit = 'commit', Tag = 'tag', -} \ No newline at end of file +} diff --git a/src/enums/vectors-db-index-type.ts b/src/enums/vectors-db-index-type.ts new file mode 100644 index 0000000..d497359 --- /dev/null +++ b/src/enums/vectors-db-index-type.ts @@ -0,0 +1,8 @@ +export enum VectorsDBIndexType { + HnswEuclidean = 'hnsw_euclidean', + HnswDot = 'hnsw_dot', + HnswCosine = 'hnsw_cosine', + Object = 'object', + Key = 'key', + Unique = 'unique', +} diff --git a/src/id.ts b/src/id.ts index 33495cc..d9ebe83 100644 --- a/src/id.ts +++ b/src/id.ts @@ -14,7 +14,8 @@ export class ID { const msec = now.getMilliseconds(); // Convert to hexadecimal - const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0'); + const hexTimestamp = + sec.toString(16) + msec.toString(16).padStart(5, '0'); return hexTimestamp; } @@ -25,12 +26,12 @@ export class ID { * @returns {string} */ public static custom(id: string): string { - return id + return id; } /** * Have Appwrite generate a unique ID for you. - * + * * @param {number} padding. Default is 7. * @returns {string} */ diff --git a/src/index.ts b/src/index.ts index 58388a1..d63a2ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,13 +5,17 @@ export { Apps } from './services/apps'; export { Avatars } from './services/avatars'; export { Backups } from './services/backups'; export { Databases } from './services/databases'; +export { DocumentsDB } from './services/documents-db'; export { Embeddings } from './services/embeddings'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; +export { Mongo } from './services/mongo'; +export { Mysql } from './services/mysql'; export { Oauth2 } from './services/oauth-2'; export { Organization } from './services/organization'; +export { Postgresql } from './services/postgresql'; export { Presences } from './services/presences'; export { Project } from './services/project'; export { Proxy } from './services/proxy'; @@ -22,6 +26,7 @@ export { TablesDB } from './services/tables-db'; export { Teams } from './services/teams'; export { Tokens } from './services/tokens'; export { Users } from './services/users'; +export { VectorsDB } from './services/vectors-db'; export { Webhooks } from './services/webhooks'; export type { Models, Payload, UploadProgress } from './client'; export type { QueryTypes, QueryTypesList } from './query'; @@ -44,6 +49,7 @@ 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 { DocumentsDBIndexType } from './enums/documents-db-index-type'; export { EmbeddingModel } from './enums/embedding-model'; export { Runtime } from './enums/runtime'; export { ProjectKeyScopes } from './enums/project-key-scopes'; @@ -76,12 +82,14 @@ 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 { VectorsDBIndexType } from './enums/vectors-db-index-type'; export { DatabaseType } from './enums/database-type'; export { DatabaseStatus } from './enums/database-status'; 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 { ExecutionResourceType } from './enums/execution-resource-type'; export { ExecutionTrigger } from './enums/execution-trigger'; export { ExecutionStatus } from './enums/execution-status'; export { OAuth2GooglePrompt } from './enums/o-auth-2-google-prompt'; diff --git a/src/inputFile.ts b/src/inputFile.ts index 0545928..f1648b8 100644 --- a/src/inputFile.ts +++ b/src/inputFile.ts @@ -1,144 +1,190 @@ -import { File } from "undici"; +import { File } from 'undici'; type FsPromises = { - stat: (path: string) => Promise<{ size: number }>; - open: (path: string, flags: string) => Promise<{ - read: (buffer: Uint8Array, offset: number, length: number, position: number) => Promise<{ bytesRead: number }>; - close: () => Promise; - }>; - readFile: (path: string) => Promise; + stat: (path: string) => Promise<{ size: number }>; + open: ( + path: string, + flags: string, + ) => Promise<{ + read: ( + buffer: Uint8Array, + offset: number, + length: number, + position: number, + ) => Promise<{ bytesRead: number }>; + close: () => Promise; + }>; + readFile: (path: string) => Promise; }; function isEdgeRuntime(): boolean { - return typeof globalThis !== 'undefined' && typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime !== 'undefined'; + return ( + typeof globalThis !== 'undefined' && + typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime !== + 'undefined' + ); } function assertFileSystemAvailable(): void { - if (isEdgeRuntime()) { - throw new Error('File system operations are not supported in edge runtimes. Please use InputFile.fromBuffer instead.'); - } + if (isEdgeRuntime()) { + throw new Error( + 'File system operations are not supported in edge runtimes. Please use InputFile.fromBuffer instead.', + ); + } } async function getFs(): Promise { - assertFileSystemAvailable(); - - try { - const fs = await import('fs'); - return fs.promises; - } catch { - throw new Error('File system operations are not available in this runtime. Please use InputFile.fromBuffer instead.'); - } + assertFileSystemAvailable(); + + try { + const fs = await import('fs'); + return fs.promises; + } catch { + throw new Error( + 'File system operations are not available in this runtime. Please use InputFile.fromBuffer instead.', + ); + } } function getFilename(path: string): string { - const segments = path.replace(/\\/g, '/').split('/').filter(Boolean); - return segments.pop() ?? 'file'; + const segments = path.replace(/\\/g, '/').split('/').filter(Boolean); + return segments.pop() ?? 'file'; } type BlobLike = { - size: number; - slice: (start: number, end: number) => BlobLike; - arrayBuffer: () => Promise; + size: number; + slice: (start: number, end: number) => BlobLike; + arrayBuffer: () => Promise; }; type InputFileSource = - | { type: 'path'; path: string } - | { type: 'buffer'; data: Uint8Array } - | { type: 'blob'; data: BlobLike }; + | { type: 'path'; path: string } + | { type: 'buffer'; data: Uint8Array } + | { type: 'blob'; data: BlobLike }; export class InputFile { - private source: InputFileSource; - filename: string; + private source: InputFileSource; + filename: string; + + private constructor(source: InputFileSource, filename: string) { + this.source = source; + this.filename = filename; + } - private constructor(source: InputFileSource, filename: string) { - this.source = source; - this.filename = filename; - } + static fromBuffer( + parts: BlobLike | Uint8Array | ArrayBuffer | string, + name: string, + ): InputFile { + if ( + parts && + !ArrayBuffer.isView(parts) && + typeof (parts as BlobLike).arrayBuffer === 'function' + ) { + return new InputFile( + { type: 'blob', data: parts as BlobLike }, + name, + ); + } - static fromBuffer(parts: BlobLike | Uint8Array | ArrayBuffer | string, name: string): InputFile { - if (parts && !ArrayBuffer.isView(parts) && typeof (parts as BlobLike).arrayBuffer === 'function') { - return new InputFile({ type: 'blob', data: parts as BlobLike }, name); + if (typeof parts === 'string') { + return new InputFile( + { type: 'buffer', data: new TextEncoder().encode(parts) }, + name, + ); + } + + if (parts instanceof ArrayBuffer) { + return new InputFile( + { type: 'buffer', data: new Uint8Array(parts) }, + name, + ); + } + + if (ArrayBuffer.isView(parts)) { + return new InputFile( + { + type: 'buffer', + data: new Uint8Array( + parts.buffer, + parts.byteOffset, + parts.byteLength, + ), + }, + name, + ); + } + + throw new Error('Unsupported input type for InputFile.fromBuffer'); } - if (typeof parts === 'string') { - return new InputFile({ type: 'buffer', data: new TextEncoder().encode(parts) }, name); + static fromPath(path: string, name?: string): InputFile { + assertFileSystemAvailable(); + return new InputFile({ type: 'path', path }, name ?? getFilename(path)); } - if (parts instanceof ArrayBuffer) { - return new InputFile({ type: 'buffer', data: new Uint8Array(parts) }, name); + static fromPlainText(content: string, name: string): InputFile { + return new InputFile( + { type: 'buffer', data: new TextEncoder().encode(content) }, + name, + ); } - if (ArrayBuffer.isView(parts)) { - return new InputFile({ - type: 'buffer', - data: new Uint8Array(parts.buffer, parts.byteOffset, parts.byteLength), - }, name); + async size(): Promise { + switch (this.source.type) { + case 'path': { + const fs = await getFs(); + return (await fs.stat(this.source.path)).size; + } + case 'buffer': + return this.source.data.length; + case 'blob': + return this.source.data.size; + } } - throw new Error('Unsupported input type for InputFile.fromBuffer'); - } + async slice(start: number, end: number): Promise { + const length = end - start; + + switch (this.source.type) { + case 'path': { + const fs = await getFs(); + const handle = await fs.open(this.source.path, 'r'); + try { + const buffer = new Uint8Array(length); + const result = await handle.read(buffer, 0, length, start); + return result.bytesRead === buffer.length + ? buffer + : buffer.subarray(0, result.bytesRead); + } finally { + await handle.close(); + } + } + case 'buffer': + return this.source.data.subarray(start, end); + case 'blob': { + const arrayBuffer = await this.source.data + .slice(start, end) + .arrayBuffer(); + return new Uint8Array(arrayBuffer); + } + } + } - static fromPath(path: string, name?: string): InputFile { - assertFileSystemAvailable(); - return new InputFile({ type: 'path', path }, name ?? getFilename(path)); - } - - static fromPlainText(content: string, name: string): InputFile { - return new InputFile({ type: 'buffer', data: new TextEncoder().encode(content) }, name); - } - - async size(): Promise { - switch (this.source.type) { - case 'path': { - const fs = await getFs(); - return (await fs.stat(this.source.path)).size; - } - case 'buffer': - return this.source.data.length; - case 'blob': - return this.source.data.size; + async toFile(): Promise { + const data = await this.toUint8Array(); + return new File([data], this.filename); } - } - - async slice(start: number, end: number): Promise { - const length = end - start; - - switch (this.source.type) { - case 'path': { - const fs = await getFs(); - const handle = await fs.open(this.source.path, 'r'); - try { - const buffer = new Uint8Array(length); - const result = await handle.read(buffer, 0, length, start); - return result.bytesRead === buffer.length ? buffer : buffer.subarray(0, result.bytesRead); - } finally { - await handle.close(); + + private async toUint8Array(): Promise { + switch (this.source.type) { + case 'path': { + const fs = await getFs(); + return await fs.readFile(this.source.path); + } + case 'buffer': + return this.source.data; + case 'blob': + return new Uint8Array(await this.source.data.arrayBuffer()); } - } - case 'buffer': - return this.source.data.subarray(start, end); - case 'blob': { - const arrayBuffer = await this.source.data.slice(start, end).arrayBuffer(); - return new Uint8Array(arrayBuffer); - } - } - } - - async toFile(): Promise { - const data = await this.toUint8Array(); - return new File([data], this.filename); - } - - private async toUint8Array(): Promise { - switch (this.source.type) { - case 'path': { - const fs = await getFs(); - return await fs.readFile(this.source.path); - } - case 'buffer': - return this.source.data; - case 'blob': - return new Uint8Array(await this.source.data.arrayBuffer()); } - } } diff --git a/src/models.ts b/src/models.ts index 14faf01..5ad29b7 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1,27 +1,26 @@ -import { DatabaseType } from "./enums/database-type" -import { DatabaseStatus } from "./enums/database-status" -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 { ProjectAuthMethodId } from "./enums/project-auth-method-id" -import { ProjectServiceId } from "./enums/project-service-id" -import { ProjectProtocolId } from "./enums/project-protocol-id" -import { OAuth2GooglePrompt } from "./enums/o-auth-2-google-prompt" -import { OAuth2OidcPrompt } from "./enums/o-auth-2-oidc-prompt" -import { PlatformType } from "./enums/platform-type" -import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-resource-type" -import { ProxyRuleStatus } from "./enums/proxy-rule-status" -import { MessageStatus } from "./enums/message-status" -import { BillingPlanGroup } from "./enums/billing-plan-group" +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 { ExecutionResourceType } from './enums/execution-resource-type'; +import { ExecutionTrigger } from './enums/execution-trigger'; +import { ExecutionStatus } from './enums/execution-status'; +import { ProjectAuthMethodId } from './enums/project-auth-method-id'; +import { ProjectServiceId } from './enums/project-service-id'; +import { ProjectProtocolId } from './enums/project-protocol-id'; +import { OAuth2GooglePrompt } from './enums/o-auth-2-google-prompt'; +import { OAuth2OidcPrompt } from './enums/o-auth-2-oidc-prompt'; +import { PlatformType } from './enums/platform-type'; +import { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; +import { ProxyRuleStatus } from './enums/proxy-rule-status'; +import { MessageStatus } from './enums/message-status'; +import { BillingPlanGroup } from './enums/billing-plan-group'; /** * Appwrite Models */ export namespace Models { - declare const __default: unique symbol; /** @@ -36,12 +35,14 @@ export namespace Models { * List of rows. */ rows: Row[]; - } + }; /** * Documents List */ - export type DocumentList = { + export type DocumentList< + Document extends Models.Document = Models.DefaultDocument, + > = { /** * Total number of documents that matched your query. */ @@ -50,7 +51,7 @@ export namespace Models { * List of documents. */ documents: Document[]; - } + }; /** * Presences List @@ -64,7 +65,7 @@ export namespace Models { * List of presences. */ presences: Presence[]; - } + }; /** * Tables List @@ -78,7 +79,7 @@ export namespace Models { * List of tables. */ tables: Table[]; - } + }; /** * Collections List @@ -92,7 +93,7 @@ export namespace Models { * List of collections. */ collections: Collection[]; - } + }; /** * Databases List @@ -106,7 +107,7 @@ export namespace Models { * List of databases. */ databases: Database[]; - } + }; /** * Indexes List @@ -120,7 +121,7 @@ export namespace Models { * List of indexes. */ indexes: Index[]; - } + }; /** * Column Indexes List @@ -134,12 +135,14 @@ export namespace Models { * List of indexes. */ indexes: ColumnIndex[]; - } + }; /** * Users List */ - export type UserList = { + export type UserList< + Preferences extends Models.Preferences = Models.DefaultPreferences, + > = { /** * Total number of users that matched your query. */ @@ -148,7 +151,7 @@ export namespace Models { * List of users. */ users: User[]; - } + }; /** * Sessions List @@ -162,7 +165,7 @@ export namespace Models { * List of sessions. */ sessions: Session[]; - } + }; /** * Identities List @@ -176,7 +179,7 @@ export namespace Models { * List of identities. */ identities: Identity[]; - } + }; /** * Logs List @@ -190,7 +193,7 @@ export namespace Models { * List of logs. */ logs: Log[]; - } + }; /** * Files List @@ -204,7 +207,7 @@ export namespace Models { * List of files. */ files: File[]; - } + }; /** * Buckets List @@ -218,7 +221,7 @@ export namespace Models { * List of buckets. */ buckets: Bucket[]; - } + }; /** * Resource Tokens List @@ -232,12 +235,14 @@ export namespace Models { * List of tokens. */ tokens: ResourceToken[]; - } + }; /** * Teams List */ - export type TeamList = { + export type TeamList< + Preferences extends Models.Preferences = Models.DefaultPreferences, + > = { /** * Total number of teams that matched your query. */ @@ -246,7 +251,7 @@ export namespace Models { * List of teams. */ teams: Team[]; - } + }; /** * Memberships List @@ -260,7 +265,7 @@ export namespace Models { * List of memberships. */ memberships: Membership[]; - } + }; /** * Sites List @@ -274,7 +279,7 @@ export namespace Models { * List of sites. */ sites: Site[]; - } + }; /** * Functions List @@ -288,7 +293,7 @@ export namespace Models { * List of functions. */ functions: Function[]; - } + }; /** * Frameworks List @@ -302,7 +307,7 @@ export namespace Models { * List of frameworks. */ frameworks: Framework[]; - } + }; /** * Runtimes List @@ -316,7 +321,7 @@ export namespace Models { * List of runtimes. */ runtimes: Runtime[]; - } + }; /** * Deployments List @@ -330,7 +335,7 @@ export namespace Models { * List of deployments. */ deployments: Deployment[]; - } + }; /** * Executions List @@ -344,7 +349,7 @@ export namespace Models { * List of executions. */ executions: Execution[]; - } + }; /** * Projects List @@ -358,7 +363,7 @@ export namespace Models { * List of projects. */ projects: Project[]; - } + }; /** * Webhooks List @@ -372,7 +377,7 @@ export namespace Models { * List of webhooks. */ webhooks: Webhook[]; - } + }; /** * API Keys List @@ -386,7 +391,7 @@ export namespace Models { * List of keys. */ keys: Key[]; - } + }; /** * Countries List @@ -400,7 +405,7 @@ export namespace Models { * List of countries. */ countries: Country[]; - } + }; /** * Continents List @@ -414,7 +419,7 @@ export namespace Models { * List of continents. */ continents: Continent[]; - } + }; /** * Languages List @@ -428,7 +433,7 @@ export namespace Models { * List of languages. */ languages: Language[]; - } + }; /** * Currencies List @@ -442,7 +447,7 @@ export namespace Models { * List of currencies. */ currencies: Currency[]; - } + }; /** * Phones List @@ -456,7 +461,7 @@ export namespace Models { * List of phones. */ phones: Phone[]; - } + }; /** * Variables List @@ -470,7 +475,7 @@ export namespace Models { * List of variables. */ variables: Variable[]; - } + }; /** * Mock Numbers List @@ -484,7 +489,7 @@ export namespace Models { * List of mockNumbers. */ mockNumbers: MockNumber[]; - } + }; /** * Policies List @@ -497,8 +502,24 @@ export namespace Models { /** * List of policies. */ - policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordStrength | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyMfaFactors | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail | Models.PolicyDenyCorporateEmail)[]; - } + policies: ( + | Models.PolicyPasswordDictionary + | Models.PolicyPasswordHistory + | Models.PolicyPasswordStrength + | Models.PolicyPasswordPersonalData + | Models.PolicySessionAlert + | Models.PolicySessionDuration + | Models.PolicySessionInvalidation + | Models.PolicySessionLimit + | Models.PolicyUserLimit + | Models.PolicyMembershipPrivacy + | Models.PolicyMfaFactors + | Models.PolicyDenyAliasedEmail + | Models.PolicyDenyDisposableEmail + | Models.PolicyDenyFreeEmail + | Models.PolicyDenyCorporateEmail + )[]; + }; /** * Email Templates List @@ -512,7 +533,7 @@ export namespace Models { * List of templates. */ templates: EmailTemplate[]; - } + }; /** * Rule List @@ -526,7 +547,7 @@ export namespace Models { * List of rules. */ rules: ProxyRule[]; - } + }; /** * Locale codes list @@ -540,7 +561,7 @@ export namespace Models { * List of localeCodes. */ localeCodes: LocaleCode[]; - } + }; /** * Provider list @@ -554,7 +575,7 @@ export namespace Models { * List of providers. */ providers: Provider[]; - } + }; /** * Message list @@ -568,7 +589,7 @@ export namespace Models { * List of messages. */ messages: Message[]; - } + }; /** * Topic list @@ -582,7 +603,7 @@ export namespace Models { * List of topics. */ topics: Topic[]; - } + }; /** * Subscriber list @@ -596,7 +617,7 @@ export namespace Models { * List of subscribers. */ subscribers: Subscriber[]; - } + }; /** * Target list @@ -610,7 +631,7 @@ export namespace Models { * List of targets. */ targets: Target[]; - } + }; /** * Transaction List @@ -624,7 +645,7 @@ export namespace Models { * List of transactions. */ transactions: Transaction[]; - } + }; /** * Specifications List @@ -638,7 +659,21 @@ export namespace Models { * List of specifications. */ specifications: Specification[]; - } + }; + + /** + * VectorsDB Collections List + */ + export type VectorsdbCollectionList = { + /** + * Total number of collections that matched your query. + */ + total: number; + /** + * List of collections. + */ + collections: VectorsdbCollection[]; + }; /** * Embedding list @@ -652,7 +687,7 @@ export namespace Models { * List of embeddings. */ embeddings: Embedding[]; - } + }; /** * Insights List @@ -666,7 +701,7 @@ export namespace Models { * List of insights. */ insights: Insight[]; - } + }; /** * Reports List @@ -680,7 +715,7 @@ export namespace Models { * List of reports. */ reports: Report[]; - } + }; /** * Database @@ -726,6 +761,18 @@ export namespace Models { * Number of secondary high availability replicas, excluding the primary. Null when backing configuration is unavailable. */ replicas?: number; + /** + * Error message when the dedicated backing failed. Null when the database has no dedicated backing or has not failed. + */ + error?: string; + /** + * Container status of the dedicated backing: active or inactive. Null when the database has no dedicated backing or the runtime has not reported one. + */ + containerStatus?: string; + /** + * Idle-lifecycle state of the dedicated backing: active, warm, cold, or hibernated. Null when the database has no dedicated backing or the runtime has not reported one. + */ + lifecycleState?: string; /** * Database backup policies. */ @@ -734,7 +781,7 @@ export namespace Models { * Database backup archives. */ archives?: BackupArchive[]; - } + }; /** * Embedding @@ -756,7 +803,7 @@ export namespace Models { * Error message if embedding generation fails. Empty string if no error. */ error: string; - } + }; /** * Collection @@ -797,7 +844,26 @@ export namespace Models { /** * Collection attributes. */ - 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)[]; + 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 + )[]; /** * Collection indexes. */ @@ -810,7 +876,7 @@ export namespace Models { * Currently used document size in bytes based on defined attributes. */ bytesUsed: number; - } + }; /** * Attributes List @@ -823,8 +889,27 @@ export namespace Models { /** * List of attributes. */ - 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)[]; - } + 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 @@ -874,7 +959,7 @@ export namespace Models { * Defines whether this attribute is encrypted or not. */ encrypt?: boolean; - } + }; /** * AttributeInteger @@ -924,7 +1009,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: number; - } + }; /** * AttributeBigInt @@ -974,7 +1059,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: number | bigint; - } + }; /** * AttributeFloat @@ -1024,7 +1109,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: number; - } + }; /** * AttributeBoolean @@ -1066,7 +1151,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: boolean; - } + }; /** * AttributeEmail @@ -1112,7 +1197,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; - } + }; /** * AttributeEnum @@ -1162,7 +1247,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; - } + }; /** * AttributeIP @@ -1208,7 +1293,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; - } + }; /** * AttributeURL @@ -1254,7 +1339,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; - } + }; /** * AttributeDatetime @@ -1300,7 +1385,7 @@ export namespace Models { * Default value for attribute when not provided. Only null is optional */ default?: string; - } + }; /** * AttributeRelationship @@ -1362,7 +1447,7 @@ export namespace Models { * Whether this is the parent or child side of the relationship */ side: string; - } + }; /** * AttributePoint @@ -1404,7 +1489,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: number[]; - } + }; /** * AttributeLine @@ -1446,7 +1531,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: number[][]; - } + }; /** * AttributePolygon @@ -1488,7 +1573,7 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: number[][][]; - } + }; /** * AttributeVarchar @@ -1538,7 +1623,7 @@ export namespace Models { * Defines whether this attribute is encrypted or not. */ encrypt?: boolean; - } + }; /** * AttributeText @@ -1584,7 +1669,7 @@ export namespace Models { * Defines whether this attribute is encrypted or not. */ encrypt?: boolean; - } + }; /** * AttributeMediumtext @@ -1630,7 +1715,7 @@ export namespace Models { * Defines whether this attribute is encrypted or not. */ encrypt?: boolean; - } + }; /** * AttributeLongtext @@ -1676,7 +1761,145 @@ export namespace Models { * Defines whether this attribute is encrypted or not. */ encrypt?: boolean; - } + }; + + /** + * VectorsDB Collection + */ + export type VectorsdbCollection = { + /** + * Collection ID. + */ + $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[]; + /** + * Database ID. + */ + databaseId: string; + /** + * Collection name. + */ + name: 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. + */ + enabled: boolean; + /** + * Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + documentSecurity: boolean; + /** + * Collection attributes. + */ + attributes: (Models.AttributeObject | Models.AttributeVector)[]; + /** + * Collection indexes. + */ + indexes: Index[]; + /** + * Maximum document size in bytes. Returns 0 when no limit applies. + */ + bytesMax: number; + /** + * Currently used document size in bytes based on defined attributes. + */ + bytesUsed: number; + /** + * Embedding dimension. + */ + dimension: number; + }; + + /** + * AttributeObject + */ + export type AttributeObject = { + /** + * 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; + }; + + /** + * AttributeVector + */ + export type AttributeVector = { + /** + * 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; + /** + * Vector dimensions. + */ + size: number; + }; /** * Table @@ -1717,7 +1940,26 @@ export namespace Models { /** * 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)[]; + 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. */ @@ -1730,7 +1972,7 @@ export namespace Models { * Currently used row size in bytes based on defined columns. */ bytesUsed: number; - } + }; /** * Columns List @@ -1743,8 +1985,27 @@ export namespace Models { /** * 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)[]; - } + 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 @@ -1794,7 +2055,7 @@ export namespace Models { * Defines whether this column is encrypted or not. */ encrypt?: boolean; - } + }; /** * ColumnInteger @@ -1844,7 +2105,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: number; - } + }; /** * ColumnBigInt @@ -1894,7 +2155,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: number | bigint; - } + }; /** * ColumnFloat @@ -1944,7 +2205,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: number; - } + }; /** * ColumnBoolean @@ -1986,7 +2247,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: boolean; - } + }; /** * ColumnEmail @@ -2032,7 +2293,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; - } + }; /** * ColumnEnum @@ -2082,7 +2343,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; - } + }; /** * ColumnIP @@ -2128,7 +2389,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; - } + }; /** * ColumnURL @@ -2174,7 +2435,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: string; - } + }; /** * ColumnDatetime @@ -2220,7 +2481,7 @@ export namespace Models { * Default value for column when not provided. Only null is optional */ default?: string; - } + }; /** * ColumnRelationship @@ -2282,7 +2543,7 @@ export namespace Models { * Whether this is the parent or child side of the relationship */ side: string; - } + }; /** * ColumnPoint @@ -2324,7 +2585,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: number[]; - } + }; /** * ColumnLine @@ -2366,7 +2627,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: number[][]; - } + }; /** * ColumnPolygon @@ -2408,7 +2669,7 @@ export namespace Models { * Default value for column when not provided. Cannot be set when column is required. */ default?: number[][][]; - } + }; /** * ColumnVarchar @@ -2458,7 +2719,7 @@ export namespace Models { * Defines whether this column is encrypted or not. */ encrypt?: boolean; - } + }; /** * ColumnText @@ -2504,7 +2765,7 @@ export namespace Models { * Defines whether this column is encrypted or not. */ encrypt?: boolean; - } + }; /** * ColumnMediumtext @@ -2550,7 +2811,7 @@ export namespace Models { * Defines whether this column is encrypted or not. */ encrypt?: boolean; - } + }; /** * ColumnLongtext @@ -2596,7 +2857,7 @@ export namespace Models { * Defines whether this column is encrypted or not. */ encrypt?: boolean; - } + }; /** * Index @@ -2642,7 +2903,7 @@ export namespace Models { * Index orders. */ orders?: string[]; - } + }; /** * Index @@ -2688,7 +2949,7 @@ export namespace Models { * Index orders. */ orders?: string[]; - } + }; /** * Row @@ -2722,7 +2983,7 @@ export namespace Models { * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ $permissions: string[]; - } + }; export type DefaultRow = Row & { [key: string]: any; @@ -2761,7 +3022,7 @@ export namespace Models { * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ $permissions: string[]; - } + }; export type DefaultDocument = Document & { [key: string]: any; @@ -2808,7 +3069,7 @@ export namespace Models { * Presence metadata. */ metadata?: object; - } + }; /** * Log @@ -2902,12 +3163,14 @@ export namespace Models { * Country name. */ countryName: string; - } + }; /** * User */ - export type User = { + export type User< + Preferences extends Models.Preferences = Models.DefaultPreferences, + > = { /** * User ID. */ @@ -3012,7 +3275,7 @@ export namespace Models { * 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 @@ -3022,7 +3285,7 @@ export namespace Models { * Algo type. */ type: string; - } + }; /** * AlgoSHA @@ -3032,7 +3295,7 @@ export namespace Models { * Algo type. */ type: string; - } + }; /** * AlgoPHPass @@ -3042,7 +3305,7 @@ export namespace Models { * Algo type. */ type: string; - } + }; /** * AlgoBcrypt @@ -3052,7 +3315,7 @@ export namespace Models { * Algo type. */ type: string; - } + }; /** * AlgoScrypt @@ -3078,7 +3341,7 @@ export namespace Models { * Length used to compute hash. */ length: number; - } + }; /** * AlgoScryptModified @@ -3100,7 +3363,7 @@ export namespace Models { * Key used to compute hash. */ signerKey: string; - } + }; /** * AlgoArgon2 @@ -3122,13 +3385,12 @@ export namespace Models { * Number of threads used to compute hash. */ threads: number; - } + }; /** * Preferences */ - export type Preferences = { - } + export type Preferences = {}; export type DefaultPreferences = Preferences & { [key: string]: any; @@ -3255,7 +3517,7 @@ export namespace Models { * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. */ mfaUpdatedAt: string; - } + }; /** * Identity @@ -3301,7 +3563,7 @@ export namespace Models { * Identity Provider Refresh Token. */ providerRefreshToken: string; - } + }; /** * Token @@ -3331,7 +3593,7 @@ export namespace Models { * 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 @@ -3341,7 +3603,7 @@ export namespace Models { * JWT encoded string. */ jwt: string; - } + }; /** * Locale @@ -3419,7 +3681,7 @@ export namespace Models { * Registered organization of the IP */ connectionOrganization?: string; - } + }; /** * LocaleCode @@ -3433,7 +3695,7 @@ export namespace Models { * Locale name */ name: string; - } + }; /** * File @@ -3503,7 +3765,7 @@ export namespace Models { * 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 @@ -3565,7 +3827,7 @@ export namespace Models { * Total size of this bucket in bytes. */ totalSize: number; - } + }; /** * ResourceToken @@ -3599,12 +3861,14 @@ export namespace Models { * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. */ accessedAt: string; - } + }; /** * Team */ - export type Team = { + export type Team< + Preferences extends Models.Preferences = Models.DefaultPreferences, + > = { /** * Team ID. */ @@ -3629,7 +3893,7 @@ export namespace Models { * Team preferences as a key-value object */ prefs: Preferences; - } + }; /** * Membership @@ -3695,7 +3959,7 @@ export namespace Models { * User list of roles */ roles: string[]; - } + }; /** * Site @@ -3765,6 +4029,10 @@ export namespace Models { * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". */ latestDeploymentStatus: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; /** * Site variables. */ @@ -3837,7 +4105,7 @@ export namespace Models { * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. */ fallbackFile: string; - } + }; /** * Function @@ -3971,7 +4239,7 @@ export namespace Models { * Machine specification for executions. */ runtimeSpecification: string; - } + }; /** * Runtime @@ -4009,7 +4277,7 @@ export namespace Models { * List of supported architectures. */ supports: string[]; - } + }; /** * Framework @@ -4035,7 +4303,7 @@ export namespace Models { * List of supported adapters. */ adapters: FrameworkAdapter[]; - } + }; /** * Framework Adapter @@ -4061,7 +4329,7 @@ export namespace Models { * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. */ fallbackFile: string; - } + }; /** * Deployment @@ -4175,7 +4443,7 @@ export namespace Models { * The branch of the vcs repository */ providerBranchUrl: string; - } + }; /** * Execution @@ -4198,19 +4466,23 @@ export namespace Models { */ $permissions: string[]; /** - * Function ID. + * Function or site ID. + */ + resourceId: string; + /** + * Execution resource type. */ - functionId: string; + resourceType: ExecutionResourceType; /** - * Function's deployment ID used to create the execution. + * 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`. + * The trigger that caused the resource 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`. + * The status of the resource execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. */ status: ExecutionStatus; /** @@ -4238,11 +4510,11 @@ export namespace Models { */ 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. + * Resource 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. + * Resource 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; /** @@ -4253,7 +4525,7 @@ export namespace Models { * The scheduled time for execution. If left empty, execution will be queued immediately. */ scheduledAt?: string; - } + }; /** * Project @@ -4370,7 +4642,7 @@ export namespace Models { /** * Whether WAF enforcement is enabled for the project. */ - wafEnabled: boolean; + wafEnabled?: boolean; /** * Billing limits reached */ @@ -4443,7 +4715,7 @@ export namespace Models { * OAuth2 server discovery URL */ oAuth2ServerDiscoveryUrl?: string; - } + }; /** * ProjectAuthMethod @@ -4457,7 +4729,7 @@ export namespace Models { * Auth method status. */ enabled: boolean; - } + }; /** * ProjectService @@ -4471,7 +4743,7 @@ export namespace Models { * Service status. */ enabled: boolean; - } + }; /** * ProjectProtocol @@ -4485,7 +4757,7 @@ export namespace Models { * Protocol status. */ enabled: boolean; - } + }; /** * Webhook @@ -4543,7 +4815,7 @@ export namespace Models { * Number of consecutive failed webhook attempts. */ attempts: number; - } + }; /** * Key @@ -4585,7 +4857,7 @@ export namespace Models { * List of SDK user agents that used this key. */ sdks: string[]; - } + }; /** * Ephemeral Key @@ -4627,7 +4899,7 @@ export namespace Models { * List of SDK user agents that used this key. */ sdks: string[]; - } + }; /** * DevKey @@ -4665,7 +4937,7 @@ export namespace Models { * List of SDK user agents that used this key. */ sdks: string[]; - } + }; /** * Mock Number @@ -4676,7 +4948,7 @@ export namespace Models { */ number: string; /** - * Mock OTP for the number. + * Mock OTP for the number. */ otp: string; /** @@ -4687,7 +4959,7 @@ export namespace Models { * Attribute update date in ISO 8601 format. */ $updatedAt: string; - } + }; /** * OAuth2GitHub @@ -4709,7 +4981,7 @@ export namespace Models { * GitHub OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Discord @@ -4731,7 +5003,7 @@ export namespace Models { * Discord OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Figma @@ -4753,7 +5025,7 @@ export namespace Models { * Figma OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Dropbox @@ -4775,7 +5047,7 @@ export namespace Models { * Dropbox OAuth2 app secret. */ appSecret: string; - } + }; /** * OAuth2Dailymotion @@ -4797,7 +5069,7 @@ export namespace Models { * Dailymotion OAuth2 API secret. */ apiSecret: string; - } + }; /** * OAuth2Bitbucket @@ -4819,7 +5091,7 @@ export namespace Models { * Bitbucket OAuth2 secret. */ secret: string; - } + }; /** * OAuth2Bitly @@ -4841,7 +5113,7 @@ export namespace Models { * Bitly OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Box @@ -4863,7 +5135,7 @@ export namespace Models { * Box OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Autodesk @@ -4885,7 +5157,7 @@ export namespace Models { * Autodesk OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Google @@ -4911,7 +5183,7 @@ export namespace Models { * Google OAuth2 prompt values. */ prompt: OAuth2GooglePrompt[]; - } + }; /** * OAuth2Zoom @@ -4933,7 +5205,7 @@ export namespace Models { * Zoom OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Zoho @@ -4955,7 +5227,7 @@ export namespace Models { * Zoho OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Yandex @@ -4977,7 +5249,7 @@ export namespace Models { * Yandex OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2X @@ -4999,7 +5271,7 @@ export namespace Models { * X OAuth2 secret key. */ secretKey: string; - } + }; /** * OAuth2WordPress @@ -5021,7 +5293,7 @@ export namespace Models { * WordPress OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Twitch @@ -5043,7 +5315,7 @@ export namespace Models { * Twitch OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Stripe @@ -5065,7 +5337,7 @@ export namespace Models { * Stripe OAuth2 API secret key. */ apiSecretKey: string; - } + }; /** * OAuth2Spotify @@ -5087,7 +5359,7 @@ export namespace Models { * Spotify OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Slack @@ -5109,7 +5381,7 @@ export namespace Models { * Slack OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Podio @@ -5131,7 +5403,7 @@ export namespace Models { * Podio OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Notion @@ -5153,7 +5425,7 @@ export namespace Models { * Notion OAuth2 client secret. */ oauthClientSecret: string; - } + }; /** * OAuth2Salesforce @@ -5175,7 +5447,7 @@ export namespace Models { * Salesforce OAuth2 consumer secret. */ customerSecret: string; - } + }; /** * OAuth2Yahoo @@ -5197,7 +5469,29 @@ export namespace Models { * Yahoo OAuth2 client secret. */ clientSecret: string; - } + }; + + /** + * OAuth2HuggingFace + */ + export type OAuth2HuggingFace = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Hugging Face OAuth2 client ID. + */ + clientId: string; + /** + * Hugging Face OAuth2 client secret. + */ + clientSecret: string; + }; /** * OAuth2Linkedin @@ -5219,7 +5513,7 @@ export namespace Models { * LinkedIn OAuth2 primary client secret. */ primaryClientSecret: string; - } + }; /** * OAuth2Disqus @@ -5241,7 +5535,7 @@ export namespace Models { * Disqus OAuth2 secret key. */ secretKey: string; - } + }; /** * OAuth2Amazon @@ -5263,7 +5557,7 @@ export namespace Models { * Amazon OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Etsy @@ -5285,7 +5579,7 @@ export namespace Models { * Etsy OAuth2 shared secret. */ sharedSecret: string; - } + }; /** * OAuth2Facebook @@ -5307,7 +5601,7 @@ export namespace Models { * Facebook OAuth2 app secret. */ appSecret: string; - } + }; /** * OAuth2Tradeshift @@ -5329,7 +5623,7 @@ export namespace Models { * Tradeshift OAuth2 client secret. */ oauth2ClientSecret: string; - } + }; /** * OAuth2Paypal @@ -5351,7 +5645,7 @@ export namespace Models { * PayPal OAuth2 secret key. */ secretKey: string; - } + }; /** * OAuth2Gitlab @@ -5377,7 +5671,7 @@ export namespace Models { * GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. */ endpoint: string; - } + }; /** * OAuth2Appwrite @@ -5399,7 +5693,7 @@ export namespace Models { * Appwrite OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Authentik @@ -5425,7 +5719,7 @@ export namespace Models { * Authentik OAuth2 endpoint domain. */ endpoint: string; - } + }; /** * OAuth2Auth0 @@ -5451,7 +5745,7 @@ export namespace Models { * Auth0 OAuth2 endpoint domain. */ endpoint: string; - } + }; /** * OAuth2FusionAuth @@ -5477,7 +5771,7 @@ export namespace Models { * FusionAuth OAuth2 endpoint domain. */ endpoint: string; - } + }; /** * OAuth2Keycloak @@ -5507,7 +5801,7 @@ export namespace Models { * Keycloak OAuth2 realm name. */ realmName: string; - } + }; /** * OAuth2Oidc @@ -5553,7 +5847,7 @@ export namespace Models { * Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds. */ maxAge?: number; - } + }; /** * OAuth2Okta @@ -5583,7 +5877,7 @@ export namespace Models { * Okta OAuth2 authorization server ID. */ authorizationServerId: string; - } + }; /** * OAuth2Kick @@ -5605,7 +5899,7 @@ export namespace Models { * Kick OAuth2 client secret. */ clientSecret: string; - } + }; /** * OAuth2Apple @@ -5635,7 +5929,7 @@ export namespace Models { * Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. */ p8File: string; - } + }; /** * OAuth2Microsoft @@ -5661,7 +5955,7 @@ export namespace Models { * Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. */ tenant: string; - } + }; /** * OAuth2 Providers List @@ -5674,8 +5968,51 @@ export namespace Models { /** * 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.OAuth2Appwrite | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft)[]; - } + 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.OAuth2Appwrite + | Models.OAuth2Authentik + | Models.OAuth2Auth0 + | Models.OAuth2FusionAuth + | Models.OAuth2Keycloak + | Models.OAuth2Oidc + | Models.OAuth2Apple + | Models.OAuth2Okta + | Models.OAuth2Kick + | Models.OAuth2Microsoft + | Models.OAuth2HuggingFace + )[]; + }; /** * Policy Password Dictionary @@ -5689,7 +6026,7 @@ export namespace Models { * Whether password dictionary policy is enabled. */ enabled: boolean; - } + }; /** * Policy Password History @@ -5703,7 +6040,7 @@ export namespace Models { * Password history length. A value of 0 means the policy is disabled. */ total: number; - } + }; /** * Policy Password Strength @@ -5733,7 +6070,7 @@ export namespace Models { * Whether passwords must include at least one symbol. */ symbols: boolean; - } + }; /** * Policy Password Personal Data @@ -5747,7 +6084,7 @@ export namespace Models { * Whether password personal data policy is enabled. */ enabled: boolean; - } + }; /** * Policy Session Alert @@ -5761,7 +6098,7 @@ export namespace Models { * Whether session alert policy is enabled. */ enabled: boolean; - } + }; /** * Policy Session Duration @@ -5775,7 +6112,7 @@ export namespace Models { * Session duration in seconds. */ duration: number; - } + }; /** * Policy Session Invalidation @@ -5789,7 +6126,7 @@ export namespace Models { * Whether session invalidation policy is enabled. */ enabled: boolean; - } + }; /** * Policy Session Limit @@ -5803,7 +6140,7 @@ export namespace Models { * Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. */ total: number; - } + }; /** * Policy User Limit @@ -5817,7 +6154,7 @@ export namespace Models { * Maximum number of users allowed in the project. A value of 0 means the policy is disabled. */ total: number; - } + }; /** * Policy Membership Privacy @@ -5851,7 +6188,7 @@ export namespace Models { * Whether user last access time is visible in memberships. */ userAccessedAt: boolean; - } + }; /** * Policy MFA Factors @@ -5877,7 +6214,7 @@ export namespace Models { * Whether the custom factor can be used to complete an MFA challenge. */ custom: boolean; - } + }; /** * Platform Web @@ -5907,7 +6244,7 @@ export namespace Models { * Web app hostname. Empty string for other platforms. */ hostname: string; - } + }; /** * Platform Apple @@ -5937,7 +6274,7 @@ export namespace Models { * Apple bundle identifier. */ bundleIdentifier: string; - } + }; /** * Platform Android @@ -5967,7 +6304,7 @@ export namespace Models { * Android application ID. */ applicationId: string; - } + }; /** * Platform Windows @@ -5997,7 +6334,7 @@ export namespace Models { * Windows package identifier name. */ packageIdentifierName: string; - } + }; /** * Platform Linux @@ -6027,7 +6364,7 @@ export namespace Models { * Linux package name. */ packageName: string; - } + }; /** * Platforms List @@ -6040,8 +6377,14 @@ export namespace Models { /** * List of platforms. */ - platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; - } + platforms: ( + | Models.PlatformWeb + | Models.PlatformApple + | Models.PlatformAndroid + | Models.PlatformWindows + | Models.PlatformLinux + )[]; + }; /** * Variable @@ -6079,7 +6422,7 @@ export namespace Models { * 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 @@ -6093,7 +6436,7 @@ export namespace Models { * Country two-character ISO 3166-1 alpha code. */ code: string; - } + }; /** * Continent @@ -6107,7 +6450,7 @@ export namespace Models { * Continent two letter code. */ code: string; - } + }; /** * Language @@ -6125,7 +6468,7 @@ export namespace Models { * Language native name. */ nativeName: string; - } + }; /** * Currency @@ -6159,7 +6502,7 @@ export namespace Models { * Currency plural name */ namePlural: string; - } + }; /** * Phone @@ -6177,7 +6520,7 @@ export namespace Models { * Country name. */ countryName: string; - } + }; /** * Headers @@ -6191,7 +6534,7 @@ export namespace Models { * Header value. */ value: string; - } + }; /** * Specification @@ -6213,7 +6556,7 @@ export namespace Models { * Size slug. */ slug: string; - } + }; /** * Rule @@ -6279,7 +6622,7 @@ export namespace Models { * Certificate auto-renewal date in ISO 8601 format. */ renewAt: string; - } + }; /** * EmailTemplate @@ -6317,7 +6660,7 @@ export namespace Models { * Email subject */ subject: string; - } + }; /** * MFA Challenge @@ -6339,7 +6682,7 @@ export namespace Models { * Token expiration date in ISO 8601 format. */ expire: string; - } + }; /** * MFA Challenge Secret @@ -6365,7 +6708,7 @@ export namespace Models { * Challenge code to be delivered to the end user through a custom channel. */ code: string; - } + }; /** * MFA Recovery Codes @@ -6375,7 +6718,7 @@ export namespace Models { * Recovery codes. */ recoveryCodes: string[]; - } + }; /** * MFAType @@ -6389,7 +6732,7 @@ export namespace Models { * URI for authenticator apps. */ uri: string; - } + }; /** * MFAFactors @@ -6415,7 +6758,7 @@ export namespace Models { * Can custom factor be used for MFA challenge for this account. */ custom: boolean; - } + }; /** * Provider @@ -6457,7 +6800,7 @@ export namespace Models { * Provider options. */ options?: object; - } + }; /** * Message @@ -6515,7 +6858,7 @@ export namespace Models { * Status of delivery. */ status: MessageStatus; - } + }; /** * Topic @@ -6553,7 +6896,7 @@ export namespace Models { * Subscribe permissions. */ subscribe: string[]; - } + }; /** * Transaction @@ -6583,7 +6926,7 @@ export namespace Models { * Expiration time in ISO 8601 format. */ expiresAt: string; - } + }; /** * Subscriber @@ -6625,7 +6968,7 @@ export namespace Models { * The target provider type. Can be one of the following: `email`, `sms` or `push`. */ providerType: string; - } + }; /** * Target @@ -6667,7 +7010,7 @@ export namespace Models { * Is the target expired. */ expired: boolean; - } + }; /** * Insight @@ -6741,7 +7084,7 @@ export namespace Models { * User ID that dismissed the insight. Empty when not dismissed. */ dismissedBy?: string; - } + }; /** * InsightCTA @@ -6763,7 +7106,7 @@ export namespace Models { * Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). */ params: object; - } + }; /** * Report @@ -6817,7 +7160,7 @@ export namespace Models { * Time the report was analyzed in ISO 8601 format. */ analyzedAt?: string; - } + }; /** * ActivityEvent @@ -6939,7 +7282,7 @@ export namespace Models { * Version of the SDK that triggered the event. */ sdkVersion: string; - } + }; /** * AdditionalResource @@ -6969,7 +7312,7 @@ export namespace Models { * Description on invoice */ invoiceDesc: string; - } + }; /** * Archive @@ -7023,7 +7366,121 @@ export namespace Models { * The resource type to backup. Set only if this archive should backup a single resource. */ resourceType?: string; - } + }; + + /** + * Backup + */ + export type DedicatedDatabaseBackup = { + /** + * Backup ID. + */ + $id: string; + /** + * Backup creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Database ID this backup belongs to. + */ + databaseId: string; + /** + * Project ID. + */ + projectId: string; + /** + * Backup policy ID when the backup was created by a schedule. + */ + policyId: string; + /** + * Backup trigger. Possible values: manual, schedule. + */ + trigger: string; + /** + * Backup type. Possible values: full (complete database snapshot), incremental (changes since last backup), wal (write-ahead log continuous archival). + */ + type: string; + /** + * Backup type that was requested. Differs from `type` when the backend could not run the requested type and took a different one instead, in which case `fallbackReason` explains why. Empty for backups taken before the requested type was recorded. + */ + requestedType: string; + /** + * Why the backend ran a different backup type than the one requested. Empty when the backup ran as requested. + */ + fallbackReason: string; + /** + * Backup status. Possible values: pending (queued for processing), running (currently in progress), completed (successfully finished), failed (encountered an error), verified (integrity check passed). + */ + status: string; + /** + * Backup size in bytes. + */ + sizeBytes: number; + /** + * Backup start time in ISO 8601 format. + */ + startedAt?: string; + /** + * Backup completion time in ISO 8601 format. + */ + completedAt?: string; + /** + * Backup verification time in ISO 8601 format. + */ + verifiedAt?: string; + /** + * Backup expiration time in ISO 8601 format. + */ + expiresAt?: string; + /** + * Transaction-log position the backup anchors at, in the engine's own notation: PostgreSQL `{walSegment}|{lsn}`, MySQL and MariaDB `{binlogFile}|{offset}`, MongoDB `{seconds}|{increment}`. Empty when the backup recorded no position, which is the case for backup types that carry none. + */ + logPosition?: string; + /** + * Error message if backup failed. + */ + error: string; + }; + + /** + * BackupList + */ + export type DedicatedDatabaseBackupList = { + /** + * Total number of backups. + */ + total: number; + /** + * List of backups. + */ + backups: DedicatedDatabaseBackup[]; + }; + + /** + * BackupStorageConfig + */ + export type DedicatedDatabaseBackupStorage = { + /** + * Storage provider. Possible values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + */ + provider: string; + /** + * Storage bucket or container name. + */ + bucket: string; + /** + * Storage region. + */ + region: string; + /** + * Object key prefix for backups. + */ + prefix: string; + /** + * Custom endpoint for S3-compatible storage. + */ + endpoint: string; + }; /** * Limits @@ -7061,7 +7518,7 @@ export namespace Models { * Budget limit percentage */ budgetLimit?: number; - } + }; /** * billingPlan @@ -7279,6 +7736,10 @@ export namespace Models { * Does plan support credit */ supportsCredits: boolean; + /** + * Does plan support dedicated databases. + */ + supportsDedicatedDatabases: boolean; /** * Does plan support blocking disposable email addresses. */ @@ -7339,11 +7800,15 @@ export namespace Models { * Details of the program this plan is a part of. */ program?: Program; + /** + * Included monthly dedicated-database compute credit in USD. Resets each billing cycle with no roll-over. + */ + databaseComputeCredit: number; /** * Dedicated database limits available to this plan. */ dedicatedDatabases?: BillingPlanDedicatedDatabaseLimits; - } + }; /** * Addon @@ -7357,7 +7822,7 @@ export namespace Models { * Addon projects */ projects?: BillingPlanAddonDetails; - } + }; /** * Details @@ -7395,7 +7860,7 @@ export namespace Models { * Description on invoice */ invoiceDesc: string; - } + }; /** * PlanLimits @@ -7409,7 +7874,7 @@ export namespace Models { * Daily credits limit (if applicable) */ dailyCredits?: number; - } + }; /** * dedicatedDatabaseLimits @@ -7491,7 +7956,7 @@ export namespace Models { * Replica synchronization modes available for dedicated databases. */ allowedSyncModes?: string[]; - } + }; /** * BillingPlanSupportedAddons @@ -7509,7 +7974,7 @@ export namespace Models { * Whether the plan supports Premium Geo DB addon (organization-level) */ premiumGeoDBOrg: boolean; - } + }; /** * Block @@ -7559,7 +8024,75 @@ export namespace Models { * Billing plan of the organization that owns the project. */ billingPlan: string; - } + }; + + /** + * Branch + */ + export type DedicatedDatabaseBranch = { + /** + * Branch identifier. + */ + branchId: string; + /** + * Branch name. + */ + branchName: string; + /** + * Kubernetes namespace where the branch is deployed. + */ + namespace: string; + /** + * Unix timestamp when the branch expires. + */ + expiresAt: number; + /** + * Branch hostname for direct connections. + */ + host: string; + /** + * Branch port. Null until the backing reports one. + */ + port: number; + /** + * Advertised catalog the client connects to. MySQL/MariaDB use default; Postgres uses the routing label. + */ + database: string; + /** + * Database username. Shared with the parent database. + */ + username: string; + /** + * Database password. Shared with the parent database. + */ + password: string; + /** + * Whether SSL is required. + */ + ssl: boolean; + /** + * Database engine. Possible values: postgresql, mysql, mongodb. + */ + engine: string; + /** + * Full connection string for the branch. + */ + connectionString: string; + }; + + /** + * BranchList + */ + export type DedicatedDatabaseBranchList = { + /** + * Total number of branches. + */ + total: number; + /** + * List of branches. + */ + branches: DedicatedDatabaseBranch[]; + }; /** * Database Migration @@ -7605,6 +8138,10 @@ export namespace Models { * Number of documents still pending replication to the target. */ lagDocuments: number; + /** + * Highest source changelog sequence applied to the target so far. + */ + changelogWatermark: number; /** * Time the migrated data was verified against the source in ISO 8601 format. */ @@ -7629,7 +8166,7 @@ export namespace Models { * Whether the migration is paused. */ paused: boolean; - } + }; /** * DedicatedDatabase @@ -7827,7 +8364,105 @@ export namespace Models { * Error message if status is failed. */ error: string; - } + }; + + /** + * Execution + */ + export type DedicatedDatabaseExecution = { + /** + * Result rows as a list of column-name => value maps. Empty for non-returning statements. + */ + rows: Record[]; + /** + * Number of rows returned (for SELECT) or affected (for INSERT/UPDATE/DELETE). + */ + rowCount: number; + /** + * Column metadata in result-set order. + */ + columns: DedicatedDatabaseExecutionColumn[]; + /** + * Server-side execution time in milliseconds. + */ + durationMs: number; + /** + * True when the configured row or byte cap was hit and the result was truncated. + */ + truncated: boolean; + /** + * Serialised payload size in bytes. + */ + bytes: number; + }; + + /** + * ExecutionColumn + */ + export type DedicatedDatabaseExecutionColumn = { + /** + * Column name as returned by the database. + */ + name: string; + /** + * Engine-specific column type (e.g. int4, text, timestamptz). + */ + type: string; + }; + + /** + * Restoration + */ + export type DedicatedDatabaseRestoration = { + /** + * Restoration ID. + */ + $id: string; + /** + * Restoration creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Database ID being restored into. + */ + databaseId: string; + /** + * Source database ID when restoring a backup into another database. + */ + sourceDatabaseId: string; + /** + * Project ID. + */ + projectId: string; + /** + * Backup ID used for restoration (null for PITR). + */ + backupId: string; + /** + * Restoration type. Possible values: backup (restore from a specific backup snapshot), pitr (point-in-time recovery to a specific timestamp). + */ + type: string; + /** + * Restoration status. Possible values: pending (queued for processing), running (currently in progress), completed (successfully finished), failed (encountered an error). + */ + status: string; + /** + * Target time for PITR restoration in ISO 8601 format. + */ + targetTime: string; + /** + * Restoration start time in ISO 8601 format. + */ + startedAt: string; + /** + * Restoration completion time in ISO 8601 format. + */ + completedAt: string; + /** + * Error message if restoration failed. + */ + error: string; + }; /** * Status @@ -7889,7 +8524,25 @@ export namespace Models { * Storage volume information. */ volumes: DatabaseStatusVolume[]; - } + }; + + /** + * Extensions + */ + export type DedicatedDatabaseExtensions = { + /** + * List of installed extensions. + */ + installed: string[]; + /** + * List of available extensions that can be installed. + */ + available: string[]; + /** + * Curated metadata (display name, description, category) for each available extension. + */ + metadata: PostgresExtension[]; + }; /** * Member @@ -7908,10 +8561,14 @@ export namespace Models { */ status: string; /** - * Replication lag in seconds. Null when the lag is not known: a primary has none to report, and a member the backend has not probed has none yet. + * Whether the engine reports this member's replication stream as up. Null when no reading was taken: a primary has no stream to report, and a member that is not active, or whose probe did not answer, has none yet. False is a reading and null is the absence of one, so the two are not interchangeable. Read it beside lagSeconds before expecting a failover that names no target to find a promotable standby: a member streaming at a known lag is one, and a member reporting null is not evidence either way. + */ + replicating?: boolean; + /** + * Replication lag in seconds. Null when the lag is not known: a primary has none to report, and a member the backend has not probed has none yet. Also null against `replicating: true`, for a member that is streaming but whose engine printed no numeric lag. */ lagSeconds?: number; - } + }; /** * Operation @@ -7934,7 +8591,7 @@ export namespace Models { */ type: string; /** - * Operation status. Possible values: running (in progress), completed (finished successfully), failed (ended in an error). + * Operation status. Possible values: queued (accepted and waiting to resume), running (in progress), completed (finished successfully), failed (ended in an error). */ status: string; /** @@ -7961,7 +8618,7 @@ export namespace Models { * Failure message if the operation failed. */ errorMessage: string; - } + }; /** * OperationList @@ -7975,7 +8632,7 @@ export namespace Models { * List of operations. */ operations: DedicatedDatabaseOperation[]; - } + }; /** * Replicas @@ -8013,7 +8670,7 @@ export namespace Models { * Per-pod statuses for the primary and every replica. */ members: DedicatedDatabaseMember[]; - } + }; /** * Invalidation @@ -8035,12 +8692,14 @@ export namespace Models { * Invalidation status. */ status: string; - } + }; /** * Organization */ - export type Organization = { + export type Organization< + Preferences extends Models.Preferences = Models.DefaultPreferences, + > = { /** * Team ID. */ @@ -8181,7 +8840,21 @@ export namespace Models { * Selected projects */ projects: string[]; - } + }; + + /** + * PITRWindows + */ + export type DedicatedDatabasePITRWindows = { + /** + * Earliest available recovery point. + */ + earliest: string; + /** + * Latest available recovery point. + */ + latest: string; + }; /** * backup @@ -8235,7 +8908,7 @@ export namespace Models { * Is this policy enabled. */ enabled: boolean; - } + }; /** * Policy Deny Aliased Email @@ -8249,7 +8922,7 @@ export namespace Models { * Whether the deny aliased email policy is enabled. */ enabled: boolean; - } + }; /** * Policy Deny Disposable Email @@ -8263,7 +8936,7 @@ export namespace Models { * Whether the deny disposable email policy is enabled. */ enabled: boolean; - } + }; /** * Policy Deny Free Email @@ -8277,7 +8950,7 @@ export namespace Models { * Whether the deny free email policy is enabled. */ enabled: boolean; - } + }; /** * Policy Deny Corporate Email @@ -8291,7 +8964,75 @@ export namespace Models { * Whether the deny non-corporate email policy is enabled. */ enabled: boolean; - } + }; + + /** + * PoolerConfig + */ + export type DedicatedDatabasePooler = { + /** + * Whether connection pooling is enabled. + */ + enabled: boolean; + /** + * Connection pool mode. Possible values: transaction (releases connections back to pool after each transaction), session (holds connections for the entire client session). + */ + mode: string; + /** + * Client-connection ceiling the pooler accepts. Enforced on MySQL and MariaDB; on PostgreSQL the pooler has no client cap, so this reports the database's advertised networkMaxConnections and cannot be set here. + */ + maxConnections: number; + /** + * Default pool size per user. + */ + defaultPoolSize: number; + /** + * Pooler listening port. + */ + port: number; + /** + * Whether SELECTs are routed to HA replicas while writes and locked reads stay on the primary. Active only when HA is enabled. + */ + readWriteSplitting: boolean; + /** + * Effective CPU request applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (5% of DB CPU, floor 100m) unless overridden. + */ + poolerCpuRequest: string; + /** + * Effective CPU limit applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (10% of DB CPU, floor 200m) unless overridden. + */ + poolerCpuLimit: string; + /** + * Effective memory request applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (7.5% of DB memory, floor 64Mi) unless overridden. + */ + poolerMemoryRequest: string; + /** + * Effective memory limit applied to the pooler sidecar container (Kubernetes quantity). Returns the proportional default (15% of DB memory, floor 128Mi) unless overridden. + */ + poolerMemoryLimit: string; + }; + + /** + * Postgres extension + */ + export type PostgresExtension = { + /** + * Extension key used with CREATE EXTENSION. + */ + key: string; + /** + * Human-readable extension name. + */ + name: string; + /** + * Short description of what the extension provides. + */ + description: string; + /** + * Category the extension belongs to. + */ + category: string; + }; /** * Program @@ -8333,7 +9074,7 @@ export namespace Models { * Billing plan ID that this is program is associated with. */ billingPlanId: string; - } + }; /** * Restoration @@ -8380,10 +9121,24 @@ export namespace Models { */ resources: string[]; /** - * Optional data in key-value object. + * Optional data in key-value object. */ options: string; - } + }; + + /** + * Dedicated database restorations list + */ + export type DedicatedDatabaseRestorationList = { + /** + * Total number of restorations that matched your query. + */ + total: number; + /** + * List of restorations. + */ + restorations: DedicatedDatabaseRestoration[]; + }; /** * Specification @@ -8425,7 +9180,7 @@ export namespace Models { * Whether the specification is available on the current plan. */ enabled: boolean; - } + }; /** * SpecificationList @@ -8443,7 +9198,7 @@ export namespace Models { * Overage and add-on pricing shared across all specifications. */ pricing: DedicatedDatabaseSpecificationPricing; - } + }; /** * SpecificationPricing @@ -8465,7 +9220,7 @@ export namespace Models { * Point-in-time recovery price as a fraction of the specification cost. */ pitrRate: number; - } + }; /** * Connections @@ -8479,7 +9234,7 @@ export namespace Models { * The engine's own max_connections. On a pooled database this is the backend limit the pooler multiplexes onto, not the ceiling a client pool may reach — that is networkMaxConnections on the database resource. */ max: number; - } + }; /** * Replica @@ -8498,10 +9253,14 @@ export namespace Models { */ healthy: boolean; /** - * Replication lag in seconds (null for primary). + * Whether the engine reports this member's replication stream as up. Null when no reading was taken: a primary has no stream to report, and a member that is not healthy, or whose probe did not answer, has none yet. `healthy` is a reachability probe of the member itself and says nothing about replication, so a healthy member may still not be replicating. + */ + replicating?: boolean; + /** + * Replication lag in seconds (null for primary). Also null against `replicating: true`, for a member that is streaming but whose engine printed no numeric lag. */ lagSeconds?: number; - } + }; /** * Volume @@ -8523,7 +9282,7 @@ export namespace Models { * Whether the volume is mounted. */ mounted: boolean; - } + }; /** * usageBillingPlan @@ -8573,7 +9332,7 @@ export namespace Models { * Credits additional resources */ credits?: AdditionalResource; - } + }; /** * App @@ -8683,7 +9442,7 @@ export namespace Models { * List of application secrets. */ secrets: AppSecret[]; - } + }; /** * AppSecret @@ -8725,7 +9484,7 @@ export namespace Models { * Time the secret was last used for authentication in ISO 8601 format. Null if never used. */ lastAccessedAt?: string; - } + }; /** * AppSecretPlaintext @@ -8767,7 +9526,7 @@ export namespace Models { * Time the secret was last used for authentication in ISO 8601 format. Null if never used. */ lastAccessedAt?: string; - } + }; /** * AppScope @@ -8793,7 +9552,7 @@ export namespace Models { * Whether the scope is deprecated. Deprecated scopes can still be requested but should not be offered for new grants. */ deprecated: boolean; - } + }; /** * AppInstallation @@ -8826,7 +9585,7 @@ export namespace Models { /** * Authorization details granted to the application. Rich authorization request (RFC 9396) style entries; the Appwrite Console stores authorized project IDs here. */ - authorizationDetails: object; + authorizationDetails: Record[]; /** * ID of the user who created the installation. */ @@ -8839,7 +9598,7 @@ export namespace Models { * Time an access token was last issued for the installation in ISO 8601 format. Null if never used. */ lastAccessedAt?: string; - } + }; /** * AppKey @@ -8881,7 +9640,7 @@ export namespace Models { * Time the app key was last used for authentication in ISO 8601 format. Null if never used. */ lastAccessedAt?: string; - } + }; /** * OAuth2 Authorize @@ -8895,7 +9654,7 @@ export namespace Models { * URL the end user should be redirected to when the flow can complete without consent. Empty when consent is still required. */ redirectUrl: string; - } + }; /** * OAuth2 Approve @@ -8905,7 +9664,7 @@ export namespace Models { * URL the end user should be redirected to after the grant is approved, carrying the authorization `code` and/or `id_token` along with the original `state`. */ redirectUrl: string; - } + }; /** * OAuth2 Reject @@ -8915,7 +9674,7 @@ export namespace Models { * URL the end user should be redirected to after the grant is rejected, carrying an `access_denied` error. */ redirectUrl: string; - } + }; /** * OAuth2 Grant @@ -8969,7 +9728,7 @@ export namespace Models { * Grant expiration time in ISO 8601 format. */ expire: string; - } + }; /** * OAuth2 Device Authorization @@ -8999,7 +9758,7 @@ export namespace Models { * Minimum polling interval for the token endpoint in seconds. */ interval: number; - } + }; /** * OAuth2 PAR @@ -9013,7 +9772,7 @@ export namespace Models { * Lifetime of the authorization request handle in seconds. */ expires_in: number; - } + }; /** * OAuth2 Token @@ -9047,7 +9806,7 @@ export namespace Models { * OpenID Connect ID token. Returned when the `openid` scope is granted. */ id_token?: string; - } + }; /** * OAuth2 Consent @@ -9093,7 +9852,7 @@ export namespace Models { * Consent expiration time in ISO 8601 format. Empty when the consent has no token-bound expiry yet. */ expire: string; - } + }; /** * OAuth2 Consent Token @@ -9143,7 +9902,7 @@ export namespace Models { * Expiration time of the current access token of this family in ISO 8601 format. */ expire: string; - } + }; /** * OAuth2 Project @@ -9161,7 +9920,7 @@ export namespace Models { * API endpoint of the region the project is deployed in. Empty when the region has no public hostname configured. */ endpoint: string; - } + }; /** * OAuth2 Organization @@ -9171,7 +9930,7 @@ export namespace Models { * Organization ID. */ $id: string; - } + }; /** * OAuth2 accessible projects list @@ -9185,7 +9944,7 @@ export namespace Models { * List of projects. */ projects: Oauth2Project[]; - } + }; /** * OAuth2 accessible organizations list @@ -9199,7 +9958,7 @@ export namespace Models { * List of organizations. */ organizations: Oauth2Organization[]; - } + }; /** * OAuth2 consents list @@ -9213,7 +9972,7 @@ export namespace Models { * List of consents. */ consents: Oauth2Consent[]; - } + }; /** * OAuth2 consent tokens list @@ -9227,7 +9986,7 @@ export namespace Models { * List of tokens. */ tokens: Oauth2ConsentToken[]; - } + }; /** * Activity event list @@ -9241,7 +10000,7 @@ export namespace Models { * List of events. */ events: ActivityEvent[]; - } + }; /** * Backup archive list @@ -9255,7 +10014,7 @@ export namespace Models { * List of archives. */ archives: BackupArchive[]; - } + }; /** * Backup policy list @@ -9269,7 +10028,7 @@ export namespace Models { * List of policies. */ policies: BackupPolicy[]; - } + }; /** * Backup restoration list @@ -9283,7 +10042,7 @@ export namespace Models { * List of restorations. */ restorations: BackupRestoration[]; - } + }; /** * Database Migrations List @@ -9297,7 +10056,21 @@ export namespace Models { * List of migrations. */ migrations: DatabaseMigration[]; - } + }; + + /** + * Dedicated databases list + */ + export type DedicatedDatabaseList = { + /** + * Total number of databases that matched your query. + */ + total: number; + /** + * List of databases. + */ + databases: DedicatedDatabase[]; + }; /** * Apps list @@ -9311,7 +10084,7 @@ export namespace Models { * List of apps. */ apps: App[]; - } + }; /** * App secrets list @@ -9325,7 +10098,7 @@ export namespace Models { * List of secrets. */ secrets: AppSecret[]; - } + }; /** * App scopes list @@ -9339,7 +10112,7 @@ export namespace Models { * List of scopes. */ scopes: AppScope[]; - } + }; /** * App installations list @@ -9353,7 +10126,7 @@ export namespace Models { * List of installations. */ installations: AppInstallation[]; - } + }; /** * App keys list @@ -9367,5 +10140,5 @@ export namespace Models { * List of keys. */ keys: AppKey[]; - } + }; } diff --git a/src/operator.ts b/src/operator.ts index 2386a6c..86b5920 100644 --- a/src/operator.ts +++ b/src/operator.ts @@ -3,306 +3,304 @@ export type OperatorValuesList = string[] | number[] | boolean[] | any[]; export type OperatorValues = OperatorValuesSingle | OperatorValuesList; export enum Condition { - Equal = "equal", - NotEqual = "notEqual", - GreaterThan = "greaterThan", - GreaterThanEqual = "greaterThanEqual", - LessThan = "lessThan", - LessThanEqual = "lessThanEqual", - Contains = "contains", - IsNull = "isNull", - IsNotNull = "isNotNull", + Equal = 'equal', + NotEqual = 'notEqual', + GreaterThan = 'greaterThan', + GreaterThanEqual = 'greaterThanEqual', + LessThan = 'lessThan', + LessThanEqual = 'lessThanEqual', + Contains = 'contains', + IsNull = 'isNull', + IsNotNull = 'isNotNull', } /** * Helper class to generate operator strings for atomic operations. */ export class Operator { - method: string; - values: OperatorValuesList | undefined; + method: string; + values: OperatorValuesList | undefined; - /** - * Constructor for Operator class. - * - * @param {string} method - * @param {OperatorValues} values - */ - constructor( - method: string, - values?: OperatorValues - ) { - this.method = method; + /** + * Constructor for Operator class. + * + * @param {string} method + * @param {OperatorValues} values + */ + constructor(method: string, values?: OperatorValues) { + this.method = method; - if (values !== undefined) { - if (Array.isArray(values)) { - this.values = values; - } else { - this.values = [values] as OperatorValuesList; - } + if (values !== undefined) { + if (Array.isArray(values)) { + this.values = values; + } else { + this.values = [values] as OperatorValuesList; + } + } } - } - /** - * Convert the operator object to a JSON string. - * - * @returns {string} - */ - toString(): string { - return JSON.stringify({ - method: this.method, - values: this.values, - }); - } - - /** - * Increment a numeric attribute by a specified value. - * - * @param {number} value - * @param {number} max - * @returns {string} - */ - static increment = (value: number = 1, max?: number): string => { - if (isNaN(value) || !isFinite(value)) { - throw new Error("Value cannot be NaN or Infinity"); - } - if (max !== undefined && (isNaN(max) || !isFinite(max))) { - throw new Error("Max cannot be NaN or Infinity"); - } - const values: any[] = [value]; - if (max !== undefined) { - values.push(max); + /** + * Convert the operator object to a JSON string. + * + * @returns {string} + */ + toString(): string { + return JSON.stringify({ + method: this.method, + values: this.values, + }); } - return new Operator("increment", values).toString(); - }; - /** - * Decrement a numeric attribute by a specified value. - * - * @param {number} value - * @param {number} min - * @returns {string} - */ - static decrement = (value: number = 1, min?: number): string => { - if (isNaN(value) || !isFinite(value)) { - throw new Error("Value cannot be NaN or Infinity"); - } - if (min !== undefined && (isNaN(min) || !isFinite(min))) { - throw new Error("Min cannot be NaN or Infinity"); - } - const values: any[] = [value]; - if (min !== undefined) { - values.push(min); - } - return new Operator("decrement", values).toString(); - }; + /** + * Increment a numeric attribute by a specified value. + * + * @param {number} value + * @param {number} max + * @returns {string} + */ + static increment = (value: number = 1, max?: number): string => { + if (isNaN(value) || !isFinite(value)) { + throw new Error('Value cannot be NaN or Infinity'); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error('Max cannot be NaN or Infinity'); + } + const values: any[] = [value]; + if (max !== undefined) { + values.push(max); + } + return new Operator('increment', values).toString(); + }; - /** - * Multiply a numeric attribute by a specified factor. - * - * @param {number} factor - * @param {number} max - * @returns {string} - */ - static multiply = (factor: number, max?: number): string => { - if (isNaN(factor) || !isFinite(factor)) { - throw new Error("Factor cannot be NaN or Infinity"); - } - if (max !== undefined && (isNaN(max) || !isFinite(max))) { - throw new Error("Max cannot be NaN or Infinity"); - } - const values: any[] = [factor]; - if (max !== undefined) { - values.push(max); - } - return new Operator("multiply", values).toString(); - }; + /** + * Decrement a numeric attribute by a specified value. + * + * @param {number} value + * @param {number} min + * @returns {string} + */ + static decrement = (value: number = 1, min?: number): string => { + if (isNaN(value) || !isFinite(value)) { + throw new Error('Value cannot be NaN or Infinity'); + } + if (min !== undefined && (isNaN(min) || !isFinite(min))) { + throw new Error('Min cannot be NaN or Infinity'); + } + const values: any[] = [value]; + if (min !== undefined) { + values.push(min); + } + return new Operator('decrement', values).toString(); + }; - /** - * Divide a numeric attribute by a specified divisor. - * - * @param {number} divisor - * @param {number} min - * @returns {string} - */ - static divide = (divisor: number, min?: number): string => { - if (isNaN(divisor) || !isFinite(divisor)) { - throw new Error("Divisor cannot be NaN or Infinity"); - } - if (min !== undefined && (isNaN(min) || !isFinite(min))) { - throw new Error("Min cannot be NaN or Infinity"); - } - if (divisor === 0) { - throw new Error("Divisor cannot be zero"); - } - const values: any[] = [divisor]; - if (min !== undefined) { - values.push(min); - } - return new Operator("divide", values).toString(); - }; + /** + * Multiply a numeric attribute by a specified factor. + * + * @param {number} factor + * @param {number} max + * @returns {string} + */ + static multiply = (factor: number, max?: number): string => { + if (isNaN(factor) || !isFinite(factor)) { + throw new Error('Factor cannot be NaN or Infinity'); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error('Max cannot be NaN or Infinity'); + } + const values: any[] = [factor]; + if (max !== undefined) { + values.push(max); + } + return new Operator('multiply', values).toString(); + }; - /** - * Apply modulo operation on a numeric attribute. - * - * @param {number} divisor - * @returns {string} - */ - static modulo = (divisor: number): string => { - if (isNaN(divisor) || !isFinite(divisor)) { - throw new Error("Divisor cannot be NaN or Infinity"); - } - if (divisor === 0) { - throw new Error("Divisor cannot be zero"); - } - return new Operator("modulo", [divisor]).toString(); - }; + /** + * Divide a numeric attribute by a specified divisor. + * + * @param {number} divisor + * @param {number} min + * @returns {string} + */ + static divide = (divisor: number, min?: number): string => { + if (isNaN(divisor) || !isFinite(divisor)) { + throw new Error('Divisor cannot be NaN or Infinity'); + } + if (min !== undefined && (isNaN(min) || !isFinite(min))) { + throw new Error('Min cannot be NaN or Infinity'); + } + if (divisor === 0) { + throw new Error('Divisor cannot be zero'); + } + const values: any[] = [divisor]; + if (min !== undefined) { + values.push(min); + } + return new Operator('divide', values).toString(); + }; - /** - * Raise a numeric attribute to a specified power. - * - * @param {number} exponent - * @param {number} max - * @returns {string} - */ - static power = (exponent: number, max?: number): string => { - if (isNaN(exponent) || !isFinite(exponent)) { - throw new Error("Exponent cannot be NaN or Infinity"); - } - if (max !== undefined && (isNaN(max) || !isFinite(max))) { - throw new Error("Max cannot be NaN or Infinity"); - } - const values: any[] = [exponent]; - if (max !== undefined) { - values.push(max); - } - return new Operator("power", values).toString(); - }; + /** + * Apply modulo operation on a numeric attribute. + * + * @param {number} divisor + * @returns {string} + */ + static modulo = (divisor: number): string => { + if (isNaN(divisor) || !isFinite(divisor)) { + throw new Error('Divisor cannot be NaN or Infinity'); + } + if (divisor === 0) { + throw new Error('Divisor cannot be zero'); + } + return new Operator('modulo', [divisor]).toString(); + }; + + /** + * Raise a numeric attribute to a specified power. + * + * @param {number} exponent + * @param {number} max + * @returns {string} + */ + static power = (exponent: number, max?: number): string => { + if (isNaN(exponent) || !isFinite(exponent)) { + throw new Error('Exponent cannot be NaN or Infinity'); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error('Max cannot be NaN or Infinity'); + } + const values: any[] = [exponent]; + if (max !== undefined) { + values.push(max); + } + return new Operator('power', values).toString(); + }; - /** - * Append values to an array attribute. - * - * @param {any[]} values - * @returns {string} - */ - static arrayAppend = (values: any[]): string => - new Operator("arrayAppend", values).toString(); + /** + * Append values to an array attribute. + * + * @param {any[]} values + * @returns {string} + */ + static arrayAppend = (values: any[]): string => + new Operator('arrayAppend', values).toString(); - /** - * Prepend values to an array attribute. - * - * @param {any[]} values - * @returns {string} - */ - static arrayPrepend = (values: any[]): string => - new Operator("arrayPrepend", values).toString(); + /** + * Prepend values to an array attribute. + * + * @param {any[]} values + * @returns {string} + */ + static arrayPrepend = (values: any[]): string => + new Operator('arrayPrepend', values).toString(); - /** - * Insert a value at a specific index in an array attribute. - * - * @param {number} index - * @param {any} value - * @returns {string} - */ - static arrayInsert = (index: number, value: any): string => - new Operator("arrayInsert", [index, value]).toString(); + /** + * Insert a value at a specific index in an array attribute. + * + * @param {number} index + * @param {any} value + * @returns {string} + */ + static arrayInsert = (index: number, value: any): string => + new Operator('arrayInsert', [index, value]).toString(); - /** - * Remove a value from an array attribute. - * - * @param {any} value - * @returns {string} - */ - static arrayRemove = (value: any): string => - new Operator("arrayRemove", [value]).toString(); + /** + * Remove a value from an array attribute. + * + * @param {any} value + * @returns {string} + */ + static arrayRemove = (value: any): string => + new Operator('arrayRemove', [value]).toString(); - /** - * Remove duplicate values from an array attribute. - * - * @returns {string} - */ - static arrayUnique = (): string => - new Operator("arrayUnique", []).toString(); + /** + * Remove duplicate values from an array attribute. + * + * @returns {string} + */ + static arrayUnique = (): string => + new Operator('arrayUnique', []).toString(); - /** - * Keep only values that exist in both the current array and the provided array. - * - * @param {any[]} values - * @returns {string} - */ - static arrayIntersect = (values: any[]): string => - new Operator("arrayIntersect", values).toString(); + /** + * Keep only values that exist in both the current array and the provided array. + * + * @param {any[]} values + * @returns {string} + */ + static arrayIntersect = (values: any[]): string => + new Operator('arrayIntersect', values).toString(); - /** - * Remove values from the array that exist in the provided array. - * - * @param {any[]} values - * @returns {string} - */ - static arrayDiff = (values: any[]): string => - new Operator("arrayDiff", values).toString(); + /** + * Remove values from the array that exist in the provided array. + * + * @param {any[]} values + * @returns {string} + */ + static arrayDiff = (values: any[]): string => + new Operator('arrayDiff', values).toString(); - /** - * Filter array values based on a condition. - * - * @param {Condition} condition - * @param {any} value - * @returns {string} - */ - static arrayFilter = (condition: Condition, value?: any): string => { - const values: any[] = [condition as string, value === undefined ? null : value]; - return new Operator("arrayFilter", values).toString(); - }; + /** + * Filter array values based on a condition. + * + * @param {Condition} condition + * @param {any} value + * @returns {string} + */ + static arrayFilter = (condition: Condition, value?: any): string => { + const values: any[] = [ + condition as string, + value === undefined ? null : value, + ]; + return new Operator('arrayFilter', values).toString(); + }; - /** - * Concatenate a value to a string or array attribute. - * - * @param {any} value - * @returns {string} - */ - static stringConcat = (value: any): string => - new Operator("stringConcat", [value]).toString(); + /** + * Concatenate a value to a string or array attribute. + * + * @param {any} value + * @returns {string} + */ + static stringConcat = (value: any): string => + new Operator('stringConcat', [value]).toString(); - /** - * Replace occurrences of a search string with a replacement string. - * - * @param {string} search - * @param {string} replace - * @returns {string} - */ - static stringReplace = (search: string, replace: string): string => - new Operator("stringReplace", [search, replace]).toString(); + /** + * Replace occurrences of a search string with a replacement string. + * + * @param {string} search + * @param {string} replace + * @returns {string} + */ + static stringReplace = (search: string, replace: string): string => + new Operator('stringReplace', [search, replace]).toString(); - /** - * Toggle a boolean attribute. - * - * @returns {string} - */ - static toggle = (): string => - new Operator("toggle", []).toString(); + /** + * Toggle a boolean attribute. + * + * @returns {string} + */ + static toggle = (): string => new Operator('toggle', []).toString(); - /** - * Add days to a date attribute. - * - * @param {number} days - * @returns {string} - */ - static dateAddDays = (days: number): string => - new Operator("dateAddDays", [days]).toString(); + /** + * Add days to a date attribute. + * + * @param {number} days + * @returns {string} + */ + static dateAddDays = (days: number): string => + new Operator('dateAddDays', [days]).toString(); - /** - * Subtract days from a date attribute. - * - * @param {number} days - * @returns {string} - */ - static dateSubDays = (days: number): string => - new Operator("dateSubDays", [days]).toString(); + /** + * Subtract days from a date attribute. + * + * @param {number} days + * @returns {string} + */ + static dateSubDays = (days: number): string => + new Operator('dateSubDays', [days]).toString(); - /** - * Set a date attribute to the current date and time. - * - * @returns {string} - */ - static dateSetNow = (): string => - new Operator("dateSetNow", []).toString(); + /** + * Set a date attribute to the current date and time. + * + * @returns {string} + */ + static dateSetNow = (): string => new Operator('dateSetNow', []).toString(); } diff --git a/src/permission.ts b/src/permission.ts index 94d9ced..758211b 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -10,7 +10,7 @@ export class Permission { */ static read = (role: string): string => { return `read("${role}")`; - } + }; /** * Generate write permission string for the provided role. @@ -23,7 +23,7 @@ export class Permission { */ static write = (role: string): string => { return `write("${role}")`; - } + }; /** * Generate create permission string for the provided role. @@ -33,7 +33,7 @@ export class Permission { */ static create = (role: string): string => { return `create("${role}")`; - } + }; /** * Generate update permission string for the provided role. @@ -43,7 +43,7 @@ export class Permission { */ static update = (role: string): string => { return `update("${role}")`; - } + }; /** * Generate delete permission string for the provided role. @@ -53,5 +53,5 @@ export class Permission { */ static delete = (role: string): string => { return `delete("${role}")`; - } + }; } diff --git a/src/query.ts b/src/query.ts index e0e9725..7a7da88 100644 --- a/src/query.ts +++ b/src/query.ts @@ -2,7 +2,8 @@ import JSONbigModule from 'json-bigint'; const JSONbig = JSONbigModule({ useNativeBigInt: true }); type QueryTypesSingle = string | number | bigint | boolean; -export type QueryTypesList = string[] | number[] | bigint[] | boolean[] | Query[] | any[]; +export type QueryTypesList = + string[] | number[] | bigint[] | boolean[] | Query[] | any[]; export type QueryTypes = QueryTypesSingle | QueryTypesList; type AttributesTypes = string | string[]; @@ -10,597 +11,652 @@ type AttributesTypes = string | string[]; * Helper class to generate query strings. */ export class Query { - method: string; - attribute: AttributesTypes | undefined; - values: QueryTypesList | undefined; - - /** - * Constructor for Query class. - * - * @param {string} method - * @param {AttributesTypes} attribute - * @param {QueryTypes} values - */ - constructor( - method: string, - attribute?: AttributesTypes, - values?: QueryTypes - ) { - this.method = method; - this.attribute = attribute; - - if (values !== undefined) { - if (Array.isArray(values)) { - this.values = values; - } else { - this.values = [values] as QueryTypesList; - } + method: string; + attribute: AttributesTypes | undefined; + values: QueryTypesList | undefined; + + /** + * Constructor for Query class. + * + * @param {string} method + * @param {AttributesTypes} attribute + * @param {QueryTypes} values + */ + constructor( + method: string, + attribute?: AttributesTypes, + values?: QueryTypes, + ) { + this.method = method; + this.attribute = attribute; + + if (values !== undefined) { + if (Array.isArray(values)) { + this.values = values; + } else { + this.values = [values] as QueryTypesList; + } + } } - } - - /** - * Convert the query object to a JSON string. - * - * @returns {string} - */ - toString(): string { - return JSONbig.stringify({ - method: this.method, - attribute: this.attribute, - values: this.values, - }); - } - - /** - * Filter resources where attribute is equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static equal = (attribute: string, value: QueryTypes): string => - new Query("equal", attribute, value).toString(); - - /** - * Filter resources where attribute is not equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static notEqual = (attribute: string, value: QueryTypes): string => - new Query("notEqual", attribute, value).toString(); - - /** - * Filter resources where attribute matches a regular expression pattern. - * - * @param {string} attribute The attribute to filter on. - * @param {string} pattern The regular expression pattern to match. - * @returns {string} - */ - static regex = (attribute: string, pattern: string): string => - new Query("regex", attribute, pattern).toString(); - - /** - * Filter resources where attribute is less than value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static lessThan = (attribute: string, value: QueryTypes): string => - new Query("lessThan", attribute, value).toString(); - - /** - * Filter resources where attribute is less than or equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static lessThanEqual = (attribute: string, value: QueryTypes): string => - new Query("lessThanEqual", attribute, value).toString(); - - /** - * Filter resources where attribute is greater than value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static greaterThan = (attribute: string, value: QueryTypes): string => - new Query("greaterThan", attribute, value).toString(); - - /** - * Filter resources where attribute is greater than or equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static greaterThanEqual = (attribute: string, value: QueryTypes): string => - new Query("greaterThanEqual", attribute, value).toString(); - - /** - * Filter resources where attribute is null. - * - * @param {string} attribute - * @returns {string} - */ - static isNull = (attribute: string): string => - new Query("isNull", attribute).toString(); - - /** - * Filter resources where attribute is not null. - * - * @param {string} attribute - * @returns {string} - */ - static isNotNull = (attribute: string): string => - new Query("isNotNull", attribute).toString(); - - /** - * Filter resources where the specified attributes exist. - * - * @param {string[]} attributes The list of attributes that must exist. - * @returns {string} - */ - static exists = (attributes: string[]): string => - new Query("exists", undefined, attributes).toString(); - - /** - * Filter resources where the specified attributes do not exist. - * - * @param {string[]} attributes The list of attributes that must not exist. - * @returns {string} - */ - static notExists = (attributes: string[]): string => - new Query("notExists", undefined, attributes).toString(); - - /** - * Filter resources where attribute is between start and end (inclusive). - * - * @param {string} attribute - * @param {string | number | bigint} start - * @param {string | number | bigint} end - * @returns {string} - */ - static between = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => - new Query("between", attribute, [start, end] as QueryTypesList).toString(); - - /** - * Filter resources where attribute starts with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static startsWith = (attribute: string, value: string): string => - new Query("startsWith", attribute, value).toString(); - - /** - * Filter resources where attribute ends with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static endsWith = (attribute: string, value: string): string => - new Query("endsWith", attribute, value).toString(); - - /** - * Specify which attributes should be returned by the API call. - * - * @param {string[]} attributes - * @returns {string} - */ - static select = (attributes: string[]): string => - new Query("select", undefined, attributes).toString(); - - /** - * Filter resources by searching attribute for value. - * A fulltext index on attribute is required for this query to work. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static search = (attribute: string, value: string): string => - new Query("search", attribute, value).toString(); - - /** - * Sort results by attribute descending. - * - * @param {string} attribute - * @returns {string} - */ - static orderDesc = (attribute: string): string => - new Query("orderDesc", attribute).toString(); - - /** - * Sort results by attribute ascending. - * - * @param {string} attribute - * @returns {string} - */ - static orderAsc = (attribute: string): string => - new Query("orderAsc", attribute).toString(); - - /** - * Sort results randomly. - * - * @returns {string} - */ - static orderRandom = (): string => - new Query("orderRandom").toString(); - - /** - * Return results after documentId. - * - * @param {string} documentId - * @returns {string} - */ - static cursorAfter = (documentId: string): string => - new Query("cursorAfter", undefined, documentId).toString(); - - /** - * Return results before documentId. - * - * @param {string} documentId - * @returns {string} - */ - static cursorBefore = (documentId: string): string => - new Query("cursorBefore", undefined, documentId).toString(); - - /** - * Return only limit results. - * - * @param {number} limit - * @returns {string} - */ - static limit = (limit: number): string => - new Query("limit", undefined, limit).toString(); - - /** - * Filter resources by skipping the first offset results. - * - * @param {number} offset - * @returns {string} - */ - static offset = (offset: number): string => - new Query("offset", undefined, offset).toString(); - - /** - * Filter resources where attribute contains the specified value. - * For string attributes, checks if the string contains the substring. - * - * Note: For array attributes, use {@link containsAny} or {@link containsAll} instead. - * @param {string} attribute - * @param {string | string[]} value - * @returns {string} - */ - static contains = (attribute: string, value: string | any[]): string => - new Query("contains", attribute, value).toString(); - - /** - * Filter resources where attribute contains ANY of the specified values. - * For array and relationship attributes, matches documents where the attribute - * contains at least one of the given values. - * - * @param {string} attribute - * @param {any[]} value - * @returns {string} - */ - static containsAny = (attribute: string, value: any[]): string => - new Query("containsAny", attribute, value).toString(); - - /** - * Filter resources where attribute contains ALL of the specified values. - * For array and relationship attributes, matches documents where the attribute - * contains every one of the given values. - * - * @param {string} attribute - * @param {any[]} value - * @returns {string} - */ - static containsAll = (attribute: string, value: any[]): string => - new Query("containsAll", attribute, value).toString(); - - /** - * Filter resources where attribute does not contain the specified value. - * - * @param {string} attribute - * @param {string | any[]} value - * @returns {string} - */ - static notContains = (attribute: string, value: string | any[]): string => - new Query("notContains", attribute, value).toString(); - - /** - * Filter resources by searching attribute for value (inverse of search). - * A fulltext index on attribute is required for this query to work. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static notSearch = (attribute: string, value: string): string => - new Query("notSearch", attribute, value).toString(); - - /** - * Filter resources where attribute is not between start and end (exclusive). - * - * @param {string} attribute - * @param {string | number | bigint} start - * @param {string | number | bigint} end - * @returns {string} - */ - static notBetween = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => - new Query("notBetween", attribute, [start, end] as QueryTypesList).toString(); - - /** - * Filter resources where attribute does not start with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static notStartsWith = (attribute: string, value: string): string => - new Query("notStartsWith", attribute, value).toString(); - - /** - * Filter resources where attribute does not end with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static notEndsWith = (attribute: string, value: string): string => - new Query("notEndsWith", attribute, value).toString(); - - /** - * Filter resources where document was created before date. - * - * @param {string} value - * @returns {string} - */ - static createdBefore = (value: string): string => - Query.lessThan("$createdAt", value); - - /** - * Filter resources where document was created after date. - * - * @param {string} value - * @returns {string} - */ - static createdAfter = (value: string): string => - Query.greaterThan("$createdAt", value); - - /** - * Filter resources where document was created between dates. - * - * @param {string} start - * @param {string} end - * @returns {string} - */ - static createdBetween = (start: string, end: string): string => - Query.between("$createdAt", start, end); - - /** - * Filter resources where document was updated before date. - * - * @param {string} value - * @returns {string} - */ - static updatedBefore = (value: string): string => - Query.lessThan("$updatedAt", value); - - /** - * Filter resources where document was updated after date. - * - * @param {string} value - * @returns {string} - */ - static updatedAfter = (value: string): string => - Query.greaterThan("$updatedAt", value); - - /** - * Filter resources where document was updated between dates. - * - * @param {string} start - * @param {string} end - * @returns {string} - */ - static updatedBetween = (start: string, end: string): string => - Query.between("$updatedAt", start, end); - - /** - * Combine multiple queries using logical OR operator. - * - * @param {string[]} queries - * @returns {string} - */ - static or = (queries: string[]) => - new Query("or", undefined, queries.map((query) => JSONbig.parse(query))).toString(); - - /** - * Combine multiple queries using logical AND operator. - * - * @param {string[]} queries - * @returns {string} - */ - static and = (queries: string[]) => - new Query("and", undefined, queries.map((query) => JSONbig.parse(query))).toString(); - - /** - * Filter array elements where at least one element matches all the specified queries. - * - * @param {string} attribute The attribute containing the array to filter on. - * @param {string[]} queries The list of query strings to match against array elements. - * @returns {string} - */ - static elemMatch = (attribute: string, queries: string[]): string => - new Query( - "elemMatch", - attribute, - queries.map((query) => JSONbig.parse(query)) - ).toString(); - - /** - * Filter resources where attribute is at a specific distance from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources where attribute is not at a specific distance from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources where attribute is at a distance less than the specified value from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources using vector dot product similarity. - * - * @param {string} attribute - * @param {number[]} vector - * @returns {string} - */ - static vectorDot = (attribute: string, vector: number[]): string => - new Query("vectorDot", attribute, [vector] as QueryTypesList).toString(); - - /** - * Filter resources using vector cosine similarity. - * - * @param {string} attribute - * @param {number[]} vector - * @returns {string} - */ - static vectorCosine = (attribute: string, vector: number[]): string => - new Query("vectorCosine", attribute, [vector] as QueryTypesList).toString(); - - /** - * Filter resources using vector Euclidean distance. - * - * @param {string} attribute - * @param {number[]} vector - * @returns {string} - */ - static vectorEuclidean = (attribute: string, vector: number[]): string => - new Query("vectorEuclidean", attribute, [vector] as QueryTypesList).toString(); - - /** - * Filter resources where attribute intersects with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static intersects = (attribute: string, values: any[]): string => - new Query("intersects", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not intersect with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notIntersects = (attribute: string, values: any[]): string => - new Query("notIntersects", attribute, [values]).toString(); - - /** - * Filter resources where attribute crosses the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static crosses = (attribute: string, values: any[]): string => - new Query("crosses", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not cross the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notCrosses = (attribute: string, values: any[]): string => - new Query("notCrosses", attribute, [values]).toString(); - - /** - * Filter resources where attribute overlaps with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static overlaps = (attribute: string, values: any[]): string => - new Query("overlaps", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not overlap with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notOverlaps = (attribute: string, values: any[]): string => - new Query("notOverlaps", attribute, [values]).toString(); - - /** - * Filter resources where attribute touches the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static touches = (attribute: string, values: any[]): string => - new Query("touches", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not touch the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notTouches = (attribute: string, values: any[]): string => - new Query("notTouches", attribute, [values]).toString(); + + /** + * Convert the query object to a JSON string. + * + * @returns {string} + */ + toString(): string { + return JSONbig.stringify({ + method: this.method, + attribute: this.attribute, + values: this.values, + }); + } + + /** + * Filter resources where attribute is equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static equal = (attribute: string, value: QueryTypes): string => + new Query('equal', attribute, value).toString(); + + /** + * Filter resources where attribute is not equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static notEqual = (attribute: string, value: QueryTypes): string => + new Query('notEqual', attribute, value).toString(); + + /** + * Filter resources where attribute matches a regular expression pattern. + * + * @param {string} attribute The attribute to filter on. + * @param {string} pattern The regular expression pattern to match. + * @returns {string} + */ + static regex = (attribute: string, pattern: string): string => + new Query('regex', attribute, pattern).toString(); + + /** + * Filter resources where attribute is less than value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static lessThan = (attribute: string, value: QueryTypes): string => + new Query('lessThan', attribute, value).toString(); + + /** + * Filter resources where attribute is less than or equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static lessThanEqual = (attribute: string, value: QueryTypes): string => + new Query('lessThanEqual', attribute, value).toString(); + + /** + * Filter resources where attribute is greater than value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static greaterThan = (attribute: string, value: QueryTypes): string => + new Query('greaterThan', attribute, value).toString(); + + /** + * Filter resources where attribute is greater than or equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static greaterThanEqual = (attribute: string, value: QueryTypes): string => + new Query('greaterThanEqual', attribute, value).toString(); + + /** + * Filter resources where attribute is null. + * + * @param {string} attribute + * @returns {string} + */ + static isNull = (attribute: string): string => + new Query('isNull', attribute).toString(); + + /** + * Filter resources where attribute is not null. + * + * @param {string} attribute + * @returns {string} + */ + static isNotNull = (attribute: string): string => + new Query('isNotNull', attribute).toString(); + + /** + * Filter resources where the specified attributes exist. + * + * @param {string[]} attributes The list of attributes that must exist. + * @returns {string} + */ + static exists = (attributes: string[]): string => + new Query('exists', undefined, attributes).toString(); + + /** + * Filter resources where the specified attributes do not exist. + * + * @param {string[]} attributes The list of attributes that must not exist. + * @returns {string} + */ + static notExists = (attributes: string[]): string => + new Query('notExists', undefined, attributes).toString(); + + /** + * Filter resources where attribute is between start and end (inclusive). + * + * @param {string} attribute + * @param {string | number | bigint} start + * @param {string | number | bigint} end + * @returns {string} + */ + static between = ( + attribute: string, + start: string | number | bigint, + end: string | number | bigint, + ): string => + new Query('between', attribute, [ + start, + end, + ] as QueryTypesList).toString(); + + /** + * Filter resources where attribute starts with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static startsWith = (attribute: string, value: string): string => + new Query('startsWith', attribute, value).toString(); + + /** + * Filter resources where attribute ends with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static endsWith = (attribute: string, value: string): string => + new Query('endsWith', attribute, value).toString(); + + /** + * Specify which attributes should be returned by the API call. + * + * @param {string[]} attributes + * @returns {string} + */ + static select = (attributes: string[]): string => + new Query('select', undefined, attributes).toString(); + + /** + * Filter resources by searching attribute for value. + * A fulltext index on attribute is required for this query to work. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static search = (attribute: string, value: string): string => + new Query('search', attribute, value).toString(); + + /** + * Sort results by attribute descending. + * + * @param {string} attribute + * @returns {string} + */ + static orderDesc = (attribute: string): string => + new Query('orderDesc', attribute).toString(); + + /** + * Sort results by attribute ascending. + * + * @param {string} attribute + * @returns {string} + */ + static orderAsc = (attribute: string): string => + new Query('orderAsc', attribute).toString(); + + /** + * Sort results randomly. + * + * @returns {string} + */ + static orderRandom = (): string => new Query('orderRandom').toString(); + + /** + * Return results after documentId. + * + * @param {string} documentId + * @returns {string} + */ + static cursorAfter = (documentId: string): string => + new Query('cursorAfter', undefined, documentId).toString(); + + /** + * Return results before documentId. + * + * @param {string} documentId + * @returns {string} + */ + static cursorBefore = (documentId: string): string => + new Query('cursorBefore', undefined, documentId).toString(); + + /** + * Return only limit results. + * + * @param {number} limit + * @returns {string} + */ + static limit = (limit: number): string => + new Query('limit', undefined, limit).toString(); + + /** + * Filter resources by skipping the first offset results. + * + * @param {number} offset + * @returns {string} + */ + static offset = (offset: number): string => + new Query('offset', undefined, offset).toString(); + + /** + * Filter resources where attribute contains the specified value. + * For string attributes, checks if the string contains the substring. + * + * Note: For array attributes, use {@link containsAny} or {@link containsAll} instead. + * @param {string} attribute + * @param {string | string[]} value + * @returns {string} + */ + static contains = (attribute: string, value: string | any[]): string => + new Query('contains', attribute, value).toString(); + + /** + * Filter resources where attribute contains ANY of the specified values. + * For array and relationship attributes, matches documents where the attribute + * contains at least one of the given values. + * + * @param {string} attribute + * @param {any[]} value + * @returns {string} + */ + static containsAny = (attribute: string, value: any[]): string => + new Query('containsAny', attribute, value).toString(); + + /** + * Filter resources where attribute contains ALL of the specified values. + * For array and relationship attributes, matches documents where the attribute + * contains every one of the given values. + * + * @param {string} attribute + * @param {any[]} value + * @returns {string} + */ + static containsAll = (attribute: string, value: any[]): string => + new Query('containsAll', attribute, value).toString(); + + /** + * Filter resources where attribute does not contain the specified value. + * + * @param {string} attribute + * @param {string | any[]} value + * @returns {string} + */ + static notContains = (attribute: string, value: string | any[]): string => + new Query('notContains', attribute, value).toString(); + + /** + * Filter resources by searching attribute for value (inverse of search). + * A fulltext index on attribute is required for this query to work. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static notSearch = (attribute: string, value: string): string => + new Query('notSearch', attribute, value).toString(); + + /** + * Filter resources where attribute is not between start and end (exclusive). + * + * @param {string} attribute + * @param {string | number | bigint} start + * @param {string | number | bigint} end + * @returns {string} + */ + static notBetween = ( + attribute: string, + start: string | number | bigint, + end: string | number | bigint, + ): string => + new Query('notBetween', attribute, [ + start, + end, + ] as QueryTypesList).toString(); + + /** + * Filter resources where attribute does not start with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static notStartsWith = (attribute: string, value: string): string => + new Query('notStartsWith', attribute, value).toString(); + + /** + * Filter resources where attribute does not end with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static notEndsWith = (attribute: string, value: string): string => + new Query('notEndsWith', attribute, value).toString(); + + /** + * Filter resources where document was created before date. + * + * @param {string} value + * @returns {string} + */ + static createdBefore = (value: string): string => + Query.lessThan('$createdAt', value); + + /** + * Filter resources where document was created after date. + * + * @param {string} value + * @returns {string} + */ + static createdAfter = (value: string): string => + Query.greaterThan('$createdAt', value); + + /** + * Filter resources where document was created between dates. + * + * @param {string} start + * @param {string} end + * @returns {string} + */ + static createdBetween = (start: string, end: string): string => + Query.between('$createdAt', start, end); + + /** + * Filter resources where document was updated before date. + * + * @param {string} value + * @returns {string} + */ + static updatedBefore = (value: string): string => + Query.lessThan('$updatedAt', value); + + /** + * Filter resources where document was updated after date. + * + * @param {string} value + * @returns {string} + */ + static updatedAfter = (value: string): string => + Query.greaterThan('$updatedAt', value); + + /** + * Filter resources where document was updated between dates. + * + * @param {string} start + * @param {string} end + * @returns {string} + */ + static updatedBetween = (start: string, end: string): string => + Query.between('$updatedAt', start, end); + + /** + * Combine multiple queries using logical OR operator. + * + * @param {string[]} queries + * @returns {string} + */ + static or = (queries: string[]) => + new Query( + 'or', + undefined, + queries.map((query) => JSONbig.parse(query)), + ).toString(); + + /** + * Combine multiple queries using logical AND operator. + * + * @param {string[]} queries + * @returns {string} + */ + static and = (queries: string[]) => + new Query( + 'and', + undefined, + queries.map((query) => JSONbig.parse(query)), + ).toString(); + + /** + * Filter array elements where at least one element matches all the specified queries. + * + * @param {string} attribute The attribute containing the array to filter on. + * @param {string[]} queries The list of query strings to match against array elements. + * @returns {string} + */ + static elemMatch = (attribute: string, queries: string[]): string => + new Query( + 'elemMatch', + attribute, + queries.map((query) => JSONbig.parse(query)), + ).toString(); + + /** + * Filter resources where attribute is at a specific distance from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceEqual = ( + attribute: string, + values: any[], + distance: number, + meters: boolean = true, + ): string => + new Query('distanceEqual', attribute, [ + [values, distance, meters], + ] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is not at a specific distance from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceNotEqual = ( + attribute: string, + values: any[], + distance: number, + meters: boolean = true, + ): string => + new Query('distanceNotEqual', attribute, [ + [values, distance, meters], + ] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceGreaterThan = ( + attribute: string, + values: any[], + distance: number, + meters: boolean = true, + ): string => + new Query('distanceGreaterThan', attribute, [ + [values, distance, meters], + ] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is at a distance less than the specified value from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceLessThan = ( + attribute: string, + values: any[], + distance: number, + meters: boolean = true, + ): string => + new Query('distanceLessThan', attribute, [ + [values, distance, meters], + ] as QueryTypesList).toString(); + + /** + * Filter resources using vector dot product similarity. + * + * @param {string} attribute + * @param {number[]} vector + * @returns {string} + */ + static vectorDot = (attribute: string, vector: number[]): string => + new Query('vectorDot', attribute, [ + vector, + ] as QueryTypesList).toString(); + + /** + * Filter resources using vector cosine similarity. + * + * @param {string} attribute + * @param {number[]} vector + * @returns {string} + */ + static vectorCosine = (attribute: string, vector: number[]): string => + new Query('vectorCosine', attribute, [ + vector, + ] as QueryTypesList).toString(); + + /** + * Filter resources using vector Euclidean distance. + * + * @param {string} attribute + * @param {number[]} vector + * @returns {string} + */ + static vectorEuclidean = (attribute: string, vector: number[]): string => + new Query('vectorEuclidean', attribute, [ + vector, + ] as QueryTypesList).toString(); + + /** + * Filter resources where attribute intersects with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static intersects = (attribute: string, values: any[]): string => + new Query('intersects', attribute, [values]).toString(); + + /** + * Filter resources where attribute does not intersect with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notIntersects = (attribute: string, values: any[]): string => + new Query('notIntersects', attribute, [values]).toString(); + + /** + * Filter resources where attribute crosses the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static crosses = (attribute: string, values: any[]): string => + new Query('crosses', attribute, [values]).toString(); + + /** + * Filter resources where attribute does not cross the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notCrosses = (attribute: string, values: any[]): string => + new Query('notCrosses', attribute, [values]).toString(); + + /** + * Filter resources where attribute overlaps with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static overlaps = (attribute: string, values: any[]): string => + new Query('overlaps', attribute, [values]).toString(); + + /** + * Filter resources where attribute does not overlap with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notOverlaps = (attribute: string, values: any[]): string => + new Query('notOverlaps', attribute, [values]).toString(); + + /** + * Filter resources where attribute touches the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static touches = (attribute: string, values: any[]): string => + new Query('touches', attribute, [values]).toString(); + + /** + * Filter resources where attribute does not touch the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notTouches = (attribute: string, values: any[]): string => + new Query('notTouches', attribute, [values]).toString(); } diff --git a/src/role.ts b/src/role.ts index 79f8c6b..51a05aa 100644 --- a/src/role.ts +++ b/src/role.ts @@ -2,99 +2,98 @@ * Helper class to generate role strings for `Permission`. */ export class Role { - /** * Grants access to anyone. - * + * * This includes authenticated and unauthenticated users. - * + * * @returns {string} */ public static any(): string { - return 'any' + return 'any'; } /** * Grants access to a specific user by user ID. - * + * * You can optionally pass verified or unverified for * `status` to target specific types of users. * - * @param {string} id - * @param {string} status + * @param {string} id + * @param {string} status * @returns {string} */ public static user(id: string, status: string = ''): string { if (status === '') { - return `user:${id}` + return `user:${id}`; } - return `user:${id}/${status}` + return `user:${id}/${status}`; } /** * Grants access to any authenticated or anonymous user. - * + * * You can optionally pass verified or unverified for * `status` to target specific types of users. - * - * @param {string} status + * + * @param {string} status * @returns {string} */ public static users(status: string = ''): string { if (status === '') { - return 'users' + return 'users'; } - return `users/${status}` + return `users/${status}`; } /** * Grants access to any guest user without a session. - * + * * Authenticated users don't have access to this role. - * + * * @returns {string} */ public static guests(): string { - return 'guests' + return 'guests'; } /** * Grants access to a team by team ID. - * + * * You can optionally pass a role for `role` to target * team members with the specified role. - * - * @param {string} id - * @param {string} role + * + * @param {string} id + * @param {string} role * @returns {string} */ public static team(id: string, role: string = ''): string { if (role === '') { - return `team:${id}` + return `team:${id}`; } - return `team:${id}/${role}` + return `team:${id}/${role}`; } /** * Grants access to a specific member of a team. - * + * * When the member is removed from the team, they will * no longer have access. - * - * @param {string} id + * + * @param {string} id * @returns {string} */ public static member(id: string): string { - return `member:${id}` + return `member:${id}`; } /** * Grants access to a user with the specified label. - * - * @param {string} name + * + * @param {string} name * @returns {string} */ public static label(name: string): string { - return `label:${name}` + return `label:${name}`; } -} \ No newline at end of file +} diff --git a/src/services/account.ts b/src/services/account.ts index 849902c..b871ac7 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1,11 +1,9 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, 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; @@ -19,23 +17,19 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - get(): Promise> { - + get< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(): Promise> { const apiPath = '/account'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -48,7 +42,14 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - create(params: { userId: string, email: string, password: string, name?: string }): Promise>; + create< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + password: string; + name?: string; + }): Promise>; /** * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). * @@ -60,29 +61,49 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(userId: string, email: string, password: string, name?: string): Promise>; create( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + userId: string, + email: string, + password: string, + name?: string, + ): Promise>; + create( + paramsOrFirst: + | { userId: string; email: string; password: string; name?: string } + | string, + ...rest: [string?, string?, string?] ): Promise> { - 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 }; + 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 + 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"'); } @@ -90,37 +111,33 @@ export class Account { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/account'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -131,7 +148,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - listConsents(params?: { queries?: string[], total?: boolean }): Promise; + listConsents(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of the OAuth2 consents the current user has given to third-party apps. * @@ -141,47 +161,51 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listConsents(queries?: string[], total?: boolean): Promise; listConsents( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listConsents( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/account/consents'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -202,39 +226,41 @@ export class Account { */ getConsent(consentId: string): Promise; getConsent( - paramsOrFirst: { consentId: string } | string + paramsOrFirst: { consentId: string } | string, ): Promise { let params: { consentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { consentId: string }; } else { params = { - consentId: paramsOrFirst as string + consentId: paramsOrFirst as string, }; } - - const consentId = params.consentId; + const consentId = params.consentId; if (typeof consentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "consentId"'); + throw new AppwriteException( + 'Missing required parameter: "consentId"', + ); } - - const apiPath = '/account/consents/{consentId}'.replace('{consentId}', encodeURIComponent(String(consentId))); - const payload: Payload = {}; + const apiPath = '/account/consents/{consentId}'.replace( + '{consentId}', + encodeURIComponent(String(consentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -254,41 +280,41 @@ export class Account { * @deprecated Use the object parameter style method for a better developer experience. */ deleteConsent(consentId: string): Promise<{}>; - deleteConsent( - paramsOrFirst: { consentId: string } | string - ): Promise<{}> { + deleteConsent(paramsOrFirst: { consentId: string } | string): Promise<{}> { let params: { consentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { consentId: string }; } else { params = { - consentId: paramsOrFirst as string + consentId: paramsOrFirst as string, }; } - - const consentId = params.consentId; + const consentId = params.consentId; if (typeof consentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "consentId"'); + throw new AppwriteException( + 'Missing required parameter: "consentId"', + ); } - - const apiPath = '/account/consents/{consentId}'.replace('{consentId}', encodeURIComponent(String(consentId))); - const payload: Payload = {}; + const apiPath = '/account/consents/{consentId}'.replace( + '{consentId}', + encodeURIComponent(String(consentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -300,7 +326,11 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - listConsentTokens(params: { consentId: string, queries?: string[], total?: boolean }): Promise; + listConsentTokens(params: { + consentId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of the token families issued under an OAuth2 consent. Each entry represents one authorized device or session; the token secrets themselves are never returned. * @@ -311,52 +341,63 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listConsentTokens(consentId: string, queries?: string[], total?: boolean): Promise; listConsentTokens( - paramsOrFirst: { consentId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + consentId: string, + queries?: string[], + total?: boolean, + ): Promise; + listConsentTokens( + paramsOrFirst: + { consentId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - let params: { consentId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { consentId: string, queries?: string[], total?: boolean }; + let params: { consentId: string; queries?: string[]; total?: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + consentId: string; + queries?: string[]; + total?: boolean; + }; } else { params = { consentId: paramsOrFirst as string, queries: rest[0] as string[], - total: rest[1] as boolean + total: rest[1] as boolean, }; } - + const consentId = params.consentId; const queries = params.queries; const total = params.total; - if (typeof consentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "consentId"'); + throw new AppwriteException( + 'Missing required parameter: "consentId"', + ); } - - const apiPath = '/account/consents/{consentId}/tokens'.replace('{consentId}', encodeURIComponent(String(consentId))); - const payload: Payload = {}; + const apiPath = '/account/consents/{consentId}/tokens'.replace( + '{consentId}', + encodeURIComponent(String(consentId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -367,7 +408,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - getConsentToken(params: { consentId: string, tokenId: string }): Promise; + getConsentToken(params: { + consentId: string; + tokenId: string; + }): Promise; /** * Get a token family issued under an OAuth2 consent by its unique ID. The token secrets themselves are never returned. * @@ -377,47 +421,56 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getConsentToken(consentId: string, tokenId: string): Promise; getConsentToken( - paramsOrFirst: { consentId: string, tokenId: string } | string, - ...rest: [(string)?] + consentId: string, + tokenId: string, + ): Promise; + getConsentToken( + paramsOrFirst: { consentId: string; tokenId: string } | string, + ...rest: [string?] ): Promise { - let params: { consentId: string, tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { consentId: string, tokenId: string }; + let params: { consentId: string; tokenId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + consentId: string; + tokenId: string; + }; } else { params = { consentId: paramsOrFirst as string, - tokenId: rest[0] as string + tokenId: rest[0] as string, }; } - + const consentId = params.consentId; const tokenId = params.tokenId; - if (typeof consentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "consentId"'); + throw new AppwriteException( + 'Missing required parameter: "consentId"', + ); } if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/account/consents/{consentId}/tokens/{tokenId}'.replace('{consentId}', encodeURIComponent(String(consentId))).replace('{tokenId}', encodeURIComponent(String(tokenId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tokenId"', + ); + } + const apiPath = '/account/consents/{consentId}/tokens/{tokenId}' + .replace('{consentId}', encodeURIComponent(String(consentId))) + .replace('{tokenId}', encodeURIComponent(String(tokenId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -428,7 +481,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteConsentToken(params: { consentId: string, tokenId: string }): Promise<{}>; + deleteConsentToken(params: { + consentId: string; + tokenId: string; + }): Promise<{}>; /** * Delete a token family issued under an OAuth2 consent by its unique ID. The access and refresh tokens of the family stop working immediately; other token families and the consent itself are unaffected. * @@ -440,63 +496,74 @@ export class Account { */ deleteConsentToken(consentId: string, tokenId: string): Promise<{}>; deleteConsentToken( - paramsOrFirst: { consentId: string, tokenId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { consentId: string; tokenId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { consentId: string, tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { consentId: string, tokenId: string }; + let params: { consentId: string; tokenId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + consentId: string; + tokenId: string; + }; } else { params = { consentId: paramsOrFirst as string, - tokenId: rest[0] as string + tokenId: rest[0] as string, }; } - + const consentId = params.consentId; const tokenId = params.tokenId; - if (typeof consentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "consentId"'); + throw new AppwriteException( + 'Missing required parameter: "consentId"', + ); } if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/account/consents/{consentId}/tokens/{tokenId}'.replace('{consentId}', encodeURIComponent(String(consentId))).replace('{tokenId}', encodeURIComponent(String(tokenId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tokenId"', + ); + } + const apiPath = '/account/consents/{consentId}/tokens/{tokenId}' + .replace('{consentId}', encodeURIComponent(String(consentId))) + .replace('{tokenId}', encodeURIComponent(String(tokenId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. - * + * * * @param {string} params.email - User email. * @param {string} params.password - User password. Must be at least 8 chars. * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(params: { email: string, password: string }): Promise>; + updateEmail< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + email: string; + password: string; + }): Promise>; /** * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. - * + * * * @param {string} email - User email. * @param {string} password - User password. Must be at least 8 chars. @@ -504,54 +571,60 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmail(email: string, password: string): Promise>; - updateEmail( - paramsOrFirst: { email: string, password: string } | string, - ...rest: [(string)?] + updateEmail< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(email: string, password: string): Promise>; + updateEmail< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { email: string; password: string } | string, + ...rest: [string?] ): Promise> { - let params: { email: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { email: string, password: string }; + let params: { email: string; password: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + email: string; + password: string; + }; } else { params = { email: paramsOrFirst as string, - password: rest[0] as string + password: rest[0] as string, }; } - + const email = params.email; const password = params.password; - if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/account/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -562,7 +635,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - listIdentities(params?: { queries?: string[], total?: boolean }): Promise; + listIdentities(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get the list of identities for the currently logged in user. * @@ -572,47 +648,51 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIdentities(queries?: string[], total?: boolean): Promise; listIdentities( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listIdentities( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/account/identities'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -633,39 +713,41 @@ export class Account { */ deleteIdentity(identityId: string): Promise<{}>; deleteIdentity( - paramsOrFirst: { identityId: string } | string + paramsOrFirst: { identityId: string } | string, ): Promise<{}> { let params: { identityId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { identityId: string }; } else { params = { - identityId: paramsOrFirst as string + identityId: paramsOrFirst as string, }; } - - const identityId = params.identityId; + const identityId = params.identityId; if (typeof identityId === 'undefined') { - throw new AppwriteException('Missing required parameter: "identityId"'); + throw new AppwriteException( + 'Missing required parameter: "identityId"', + ); } - - const apiPath = '/account/identities/{identityId}'.replace('{identityId}', encodeURIComponent(String(identityId))); - const payload: Payload = {}; + const apiPath = '/account/identities/{identityId}'.replace( + '{identityId}', + encodeURIComponent(String(identityId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -676,7 +758,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params?: { queries?: string[], total?: boolean }): Promise; + listLogs(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. * @@ -688,45 +773,46 @@ export class Account { */ listLogs(queries?: string[], total?: boolean): Promise; listLogs( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/account/logs'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -736,7 +822,9 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateMFA(params: { mfa: boolean }): Promise>; + updateMFA< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { mfa: boolean }): Promise>; /** * Enable or disable MFA on an account. * @@ -745,45 +833,46 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMFA(mfa: boolean): Promise>; - updateMFA( - paramsOrFirst: { mfa: boolean } | boolean + updateMFA< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(mfa: boolean): Promise>; + updateMFA< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { mfa: boolean } | boolean, ): Promise> { let params: { mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { mfa: boolean }; } else { params = { - mfa: paramsOrFirst as boolean + mfa: paramsOrFirst as boolean, }; } - - const mfa = params.mfa; + const mfa = params.mfa; if (typeof mfa === 'undefined') { throw new AppwriteException('Missing required parameter: "mfa"'); } - const apiPath = '/account/mfa'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; + apiPayload['mfa'] = mfa; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -794,7 +883,9 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead. */ - createMfaAuthenticator(params: { type: AuthenticatorType }): Promise; + createMfaAuthenticator(params: { + type: AuthenticatorType; + }): Promise; /** * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. * @@ -805,40 +896,41 @@ export class Account { */ createMfaAuthenticator(type: AuthenticatorType): Promise; createMfaAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType, ): Promise { let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'type' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { type: AuthenticatorType }; } else { params = { - type: paramsOrFirst as AuthenticatorType + type: paramsOrFirst as AuthenticatorType, }; } - - const type = params.type; + const type = params.type; if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/account/mfa/authenticators/{type}'.replace( + '{type}', + encodeURIComponent(String(type)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -848,7 +940,9 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createMFAAuthenticator(params: { type: AuthenticatorType }): Promise; + createMFAAuthenticator(params: { + type: AuthenticatorType; + }): Promise; /** * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. * @@ -859,40 +953,41 @@ export class Account { */ createMFAAuthenticator(type: AuthenticatorType): Promise; createMFAAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType, ): Promise { let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'type' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { type: AuthenticatorType }; } else { params = { - type: paramsOrFirst as AuthenticatorType + type: paramsOrFirst as AuthenticatorType, }; } - - const type = params.type; + const type = params.type; if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/account/mfa/authenticators/{type}'.replace( + '{type}', + encodeURIComponent(String(type)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -904,7 +999,12 @@ export class Account { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead. */ - updateMfaAuthenticator(params: { type: AuthenticatorType, otp: string }): Promise>; + updateMfaAuthenticator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + type: AuthenticatorType; + otp: string; + }): Promise>; /** * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -914,51 +1014,60 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMfaAuthenticator(type: AuthenticatorType, otp: string): Promise>; - updateMfaAuthenticator( - paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType, - ...rest: [(string)?] + updateMfaAuthenticator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(type: AuthenticatorType, otp: string): Promise>; + updateMfaAuthenticator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: + { type: AuthenticatorType; otp: string } | AuthenticatorType, + ...rest: [string?] ): Promise> { - let params: { type: AuthenticatorType, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string }; + let params: { type: AuthenticatorType; otp: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('type' in paramsOrFirst || 'otp' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + type: AuthenticatorType; + otp: string; + }; } else { params = { type: paramsOrFirst as AuthenticatorType, - otp: rest[0] as string + otp: rest[0] as string, }; } - + const type = params.type; const otp = params.otp; - if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof otp === 'undefined') { throw new AppwriteException('Missing required parameter: "otp"'); } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/account/mfa/authenticators/{type}'.replace( + '{type}', + encodeURIComponent(String(type)), + ); + const apiPayload: Payload = {}; if (typeof otp !== 'undefined') { - payload['otp'] = otp; + apiPayload['otp'] = otp; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -969,7 +1078,12 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateMFAAuthenticator(params: { type: AuthenticatorType, otp: string }): Promise>; + updateMFAAuthenticator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + type: AuthenticatorType; + otp: string; + }): Promise>; /** * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -979,51 +1093,60 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMFAAuthenticator(type: AuthenticatorType, otp: string): Promise>; - updateMFAAuthenticator( - paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType, - ...rest: [(string)?] + updateMFAAuthenticator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(type: AuthenticatorType, otp: string): Promise>; + updateMFAAuthenticator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: + { type: AuthenticatorType; otp: string } | AuthenticatorType, + ...rest: [string?] ): Promise> { - let params: { type: AuthenticatorType, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string }; + let params: { type: AuthenticatorType; otp: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('type' in paramsOrFirst || 'otp' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + type: AuthenticatorType; + otp: string; + }; } else { params = { type: paramsOrFirst as AuthenticatorType, - otp: rest[0] as string + otp: rest[0] as string, }; } - + const type = params.type; const otp = params.otp; - if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof otp === 'undefined') { throw new AppwriteException('Missing required parameter: "otp"'); } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/account/mfa/authenticators/{type}'.replace( + '{type}', + encodeURIComponent(String(type)), + ); + const apiPayload: Payload = {}; if (typeof otp !== 'undefined') { - payload['otp'] = otp; + apiPayload['otp'] = otp; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1045,39 +1168,40 @@ export class Account { */ deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>; deleteMfaAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType, ): Promise<{}> { let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'type' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { type: AuthenticatorType }; } else { params = { - type: paramsOrFirst as AuthenticatorType + type: paramsOrFirst as AuthenticatorType, }; } - - const type = params.type; + const type = params.type; if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/account/mfa/authenticators/{type}'.replace( + '{type}', + encodeURIComponent(String(type)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1098,39 +1222,40 @@ export class Account { */ deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>; deleteMFAAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType, ): Promise<{}> { let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'type' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { type: AuthenticatorType }; } else { params = { - type: paramsOrFirst as AuthenticatorType + type: paramsOrFirst as AuthenticatorType, }; } - - const type = params.type; + const type = params.type; if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/account/mfa/authenticators/{type}'.replace( + '{type}', + encodeURIComponent(String(type)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1141,7 +1266,9 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead. */ - createMfaChallenge(params: { factor: AuthenticationFactor }): Promise; + createMfaChallenge(params: { + factor: AuthenticationFactor; + }): Promise; /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -1150,45 +1277,45 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMfaChallenge(factor: AuthenticationFactor): Promise; createMfaChallenge( - paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor + factor: AuthenticationFactor, + ): Promise; + createMfaChallenge( + paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor, ): Promise { let params: { factor: AuthenticationFactor }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'factor' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { factor: AuthenticationFactor }; } else { params = { - factor: paramsOrFirst as AuthenticationFactor + factor: paramsOrFirst as AuthenticationFactor, }; } - - const factor = params.factor; + const factor = params.factor; if (typeof factor === 'undefined') { throw new AppwriteException('Missing required parameter: "factor"'); } - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof factor !== 'undefined') { - payload['factor'] = factor; + apiPayload['factor'] = factor; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1198,7 +1325,9 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createMFAChallenge(params: { factor: AuthenticationFactor }): Promise; + createMFAChallenge(params: { + factor: AuthenticationFactor; + }): Promise; /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -1207,45 +1336,45 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMFAChallenge(factor: AuthenticationFactor): Promise; createMFAChallenge( - paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor + factor: AuthenticationFactor, + ): Promise; + createMFAChallenge( + paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor, ): Promise { let params: { factor: AuthenticationFactor }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'factor' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { factor: AuthenticationFactor }; } else { params = { - factor: paramsOrFirst as AuthenticationFactor + factor: paramsOrFirst as AuthenticationFactor, }; } - - const factor = params.factor; + const factor = params.factor; if (typeof factor === 'undefined') { throw new AppwriteException('Missing required parameter: "factor"'); } - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof factor !== 'undefined') { - payload['factor'] = factor; + apiPayload['factor'] = factor; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1257,7 +1386,10 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead. */ - updateMfaChallenge(params: { challengeId: string, otp: string }): Promise; + updateMfaChallenge(params: { + challengeId: string; + otp: string; + }): Promise; /** * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -1267,54 +1399,59 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMfaChallenge(challengeId: string, otp: string): Promise; updateMfaChallenge( - paramsOrFirst: { challengeId: string, otp: string } | string, - ...rest: [(string)?] + challengeId: string, + otp: string, + ): Promise; + updateMfaChallenge( + paramsOrFirst: { challengeId: string; otp: string } | string, + ...rest: [string?] ): Promise { - let params: { challengeId: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { challengeId: string, otp: string }; + let params: { challengeId: string; otp: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + challengeId: string; + otp: string; + }; } else { params = { challengeId: paramsOrFirst as string, - otp: rest[0] as string + otp: rest[0] as string, }; } - + const challengeId = params.challengeId; const otp = params.otp; - if (typeof challengeId === 'undefined') { - throw new AppwriteException('Missing required parameter: "challengeId"'); + throw new AppwriteException( + 'Missing required parameter: "challengeId"', + ); } if (typeof otp === 'undefined') { throw new AppwriteException('Missing required parameter: "otp"'); } - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof challengeId !== 'undefined') { - payload['challengeId'] = challengeId; + apiPayload['challengeId'] = challengeId; } if (typeof otp !== 'undefined') { - payload['otp'] = otp; + apiPayload['otp'] = otp; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1325,7 +1462,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updateMFAChallenge(params: { challengeId: string, otp: string }): Promise; + updateMFAChallenge(params: { + challengeId: string; + otp: string; + }): Promise; /** * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -1335,54 +1475,59 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMFAChallenge(challengeId: string, otp: string): Promise; updateMFAChallenge( - paramsOrFirst: { challengeId: string, otp: string } | string, - ...rest: [(string)?] + challengeId: string, + otp: string, + ): Promise; + updateMFAChallenge( + paramsOrFirst: { challengeId: string; otp: string } | string, + ...rest: [string?] ): Promise { - let params: { challengeId: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { challengeId: string, otp: string }; + let params: { challengeId: string; otp: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + challengeId: string; + otp: string; + }; } else { params = { challengeId: paramsOrFirst as string, - otp: rest[0] as string + otp: rest[0] as string, }; } - + const challengeId = params.challengeId; const otp = params.otp; - if (typeof challengeId === 'undefined') { - throw new AppwriteException('Missing required parameter: "challengeId"'); + throw new AppwriteException( + 'Missing required parameter: "challengeId"', + ); } if (typeof otp === 'undefined') { throw new AppwriteException('Missing required parameter: "otp"'); } - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof challengeId !== 'undefined') { - payload['challengeId'] = challengeId; + apiPayload['challengeId'] = challengeId; } if (typeof otp !== 'undefined') { - payload['otp'] = otp; + apiPayload['otp'] = otp; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1393,22 +1538,16 @@ export class Account { * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead. */ listMfaFactors(): Promise { - const apiPath = '/account/mfa/factors'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1418,22 +1557,16 @@ export class Account { * @returns {Promise} */ listMFAFactors(): Promise { - const apiPath = '/account/mfa/factors'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1444,22 +1577,16 @@ export class Account { * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead. */ getMfaRecoveryCodes(): Promise { - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1469,22 +1596,16 @@ export class Account { * @returns {Promise} */ getMFARecoveryCodes(): Promise { - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1495,23 +1616,17 @@ export class Account { * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead. */ createMfaRecoveryCodes(): Promise { - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1521,23 +1636,17 @@ export class Account { * @returns {Promise} */ createMFARecoveryCodes(): Promise { - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1548,23 +1657,17 @@ export class Account { * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead. */ updateMfaRecoveryCodes(): Promise { - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1574,23 +1677,17 @@ export class Account { * @returns {Promise} */ updateMFARecoveryCodes(): Promise { - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1600,7 +1697,9 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(params: { name: string }): Promise>; + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { name: string }): Promise>; /** * Update currently logged in user account name. * @@ -1609,45 +1708,46 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateName(name: string): Promise>; - updateName( - paramsOrFirst: { name: string } | string + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(name: string): Promise>; + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { name: string } | string, ): Promise> { let params: { name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { name: string }; } else { params = { - name: paramsOrFirst as string + name: paramsOrFirst as string, }; } - - const name = params.name; + const name = params.name; if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/account/name'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1658,7 +1758,12 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(params: { password: string, oldPassword?: string }): Promise>; + updatePassword< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + password: string; + oldPassword?: string; + }): Promise>; /** * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. * @@ -1668,51 +1773,60 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePassword(password: string, oldPassword?: string): Promise>; - updatePassword( - paramsOrFirst: { password: string, oldPassword?: string } | string, - ...rest: [(string)?] + updatePassword< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + password: string, + oldPassword?: string, + ): Promise>; + updatePassword< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { password: string; oldPassword?: string } | string, + ...rest: [string?] ): Promise> { - let params: { password: string, oldPassword?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { password: string, oldPassword?: string }; + let params: { password: string; oldPassword?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + password: string; + oldPassword?: string; + }; } else { params = { password: paramsOrFirst as string, - oldPassword: rest[0] as string + oldPassword: rest[0] as string, }; } - + const password = params.password; const oldPassword = params.oldPassword; - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/account/password'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof oldPassword !== 'undefined') { - payload['oldPassword'] = oldPassword; + apiPayload['oldPassword'] = oldPassword; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1723,7 +1837,12 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(params: { phone: string, password: string }): Promise>; + updatePhone< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + phone: string; + password: string; + }): Promise>; /** * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. * @@ -1733,54 +1852,60 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePhone(phone: string, password: string): Promise>; - updatePhone( - paramsOrFirst: { phone: string, password: string } | string, - ...rest: [(string)?] + updatePhone< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(phone: string, password: string): Promise>; + updatePhone< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { phone: string; password: string } | string, + ...rest: [string?] ): Promise> { - let params: { phone: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { phone: string, password: string }; + let params: { phone: string; password: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + phone: string; + password: string; + }; } else { params = { phone: paramsOrFirst as string, - password: rest[0] as string + password: rest[0] as string, }; } - + const phone = params.phone; const password = params.password; - if (typeof phone === 'undefined') { throw new AppwriteException('Missing required parameter: "phone"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/account/phone'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof phone !== 'undefined') { - payload['phone'] = phone; + apiPayload['phone'] = phone; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1789,23 +1914,19 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(): Promise { - + getPrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(): Promise { const apiPath = '/account/prefs'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1815,7 +1936,11 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updatePrefs(params: { prefs: Partial }): Promise>; + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + prefs: Partial; + }): Promise>; /** * Update currently logged in user account preferences. 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. * @@ -1824,45 +1949,47 @@ export class Account { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePrefs(prefs: Partial): Promise>; - updatePrefs( - paramsOrFirst: { prefs: Partial } | Partial + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(prefs: Partial): Promise>; + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { prefs: Partial } | Partial, ): Promise> { let params: { prefs: Partial }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('prefs' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'prefs' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { prefs: Partial }; } else { params = { - prefs: paramsOrFirst as Partial + prefs: paramsOrFirst as Partial, }; } - - const prefs = params.prefs; + const prefs = params.prefs; if (typeof prefs === 'undefined') { throw new AppwriteException('Missing required parameter: "prefs"'); } - const apiPath = '/account/prefs'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; + apiPayload['prefs'] = prefs; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1873,7 +2000,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createRecovery(params: { email: string, url: string }): Promise; + createRecovery(params: { + email: string; + url: string; + }): Promise; /** * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. * @@ -1885,57 +2015,54 @@ export class Account { */ createRecovery(email: string, url: string): Promise; createRecovery( - paramsOrFirst: { email: string, url: string } | string, - ...rest: [(string)?] + paramsOrFirst: { email: string; url: string } | string, + ...rest: [string?] ): Promise { - let params: { email: string, url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { email: string, url: string }; + let params: { email: string; url: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { email: string; url: string }; } else { params = { email: paramsOrFirst as string, - url: rest[0] as string + url: rest[0] as string, }; } - + const email = params.email; const url = params.url; - if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } - const apiPath = '/account/recovery'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. - * + * * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. * * @param {string} params.userId - User ID. @@ -1944,10 +2071,14 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updateRecovery(params: { userId: string, secret: string, password: string }): Promise; + updateRecovery(params: { + userId: string; + secret: string; + password: string; + }): Promise; /** * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. - * + * * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. * * @param {string} userId - User ID. @@ -1957,27 +2088,39 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRecovery(userId: string, secret: string, password: string): Promise; updateRecovery( - paramsOrFirst: { userId: string, secret: string, password: string } | string, - ...rest: [(string)?, (string)?] + userId: string, + secret: string, + password: string, + ): Promise; + updateRecovery( + paramsOrFirst: + { userId: string; secret: string; password: string } | string, + ...rest: [string?, string?] ): Promise { - let params: { userId: string, secret: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string, password: string }; + let params: { userId: string; secret: string; password: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + secret: string; + password: string; + }; } else { params = { userId: paramsOrFirst as string, secret: rest[0] as string, - password: rest[1] as string + password: rest[1] as string, }; } - + const userId = params.userId; const secret = params.secret; const password = params.password; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1985,34 +2128,30 @@ export class Account { throw new AppwriteException('Missing required parameter: "secret"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/account/recovery'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -2022,22 +2161,16 @@ export class Account { * @returns {Promise} */ listSessions(): Promise { - const apiPath = '/account/sessions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -2047,22 +2180,16 @@ export class Account { * @returns {Promise<{}>} */ deleteSessions(): Promise<{}> { - const apiPath = '/account/sessions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -2072,28 +2199,22 @@ export class Account { * @returns {Promise} */ createAnonymousSession(): Promise { - const apiPath = '/account/sessions/anonymous'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the 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 {string} params.email - User email. @@ -2101,10 +2222,13 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createEmailPasswordSession(params: { email: string, password: string }): Promise; + createEmailPasswordSession(params: { + email: string; + password: string; + }): Promise; /** * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the 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 {string} email - User email. @@ -2113,54 +2237,59 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createEmailPasswordSession(email: string, password: string): Promise; createEmailPasswordSession( - paramsOrFirst: { email: string, password: string } | string, - ...rest: [(string)?] + email: string, + password: string, + ): Promise; + createEmailPasswordSession( + paramsOrFirst: { email: string; password: string } | string, + ...rest: [string?] ): Promise { - let params: { email: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { email: string, password: string }; + let params: { email: string; password: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + email: string; + password: string; + }; } else { params = { email: paramsOrFirst as string, - password: rest[0] as string + password: rest[0] as string, }; } - + const email = params.email; const password = params.password; - if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/account/sessions/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2172,7 +2301,10 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. */ - updateMagicURLSession(params: { userId: string, secret: string }): Promise; + updateMagicURLSession(params: { + userId: string; + secret: string; + }): Promise; /** * 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. * @@ -2182,54 +2314,57 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMagicURLSession(userId: string, secret: string): Promise; updateMagicURLSession( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] + userId: string, + secret: string, + ): Promise; + updateMagicURLSession( + paramsOrFirst: { userId: string; secret: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; + let params: { userId: string; secret: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + secret: string; + }; } else { params = { userId: paramsOrFirst as string, - secret: rest[0] as string + secret: rest[0] as string, }; } - + const userId = params.userId; const secret = params.secret; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof secret === 'undefined') { throw new AppwriteException('Missing required parameter: "secret"'); } - const apiPath = '/account/sessions/magic-url'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -2241,7 +2376,10 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. */ - updatePhoneSession(params: { userId: string, secret: string }): Promise; + updatePhoneSession(params: { + userId: string; + secret: string; + }): Promise; /** * 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. * @@ -2253,52 +2391,52 @@ export class Account { */ updatePhoneSession(userId: string, secret: string): Promise; updatePhoneSession( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] + paramsOrFirst: { userId: string; secret: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; + let params: { userId: string; secret: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + secret: string; + }; } else { params = { userId: paramsOrFirst as string, - secret: rest[0] as string + secret: rest[0] as string, }; } - + const userId = params.userId; const secret = params.secret; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof secret === 'undefined') { throw new AppwriteException('Missing required parameter: "secret"'); } - const apiPath = '/account/sessions/phone'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -2309,7 +2447,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createSession(params: { userId: string, secret: string }): Promise; + createSession(params: { + userId: string; + secret: string; + }): Promise; /** * 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. * @@ -2321,52 +2462,52 @@ export class Account { */ createSession(userId: string, secret: string): Promise; createSession( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] + paramsOrFirst: { userId: string; secret: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; + let params: { userId: string; secret: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + secret: string; + }; } else { params = { userId: paramsOrFirst as string, - secret: rest[0] as string + secret: rest[0] as string, }; } - + const userId = params.userId; const secret = params.secret; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof secret === 'undefined') { throw new AppwriteException('Missing required parameter: "secret"'); } - const apiPath = '/account/sessions/token'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2387,39 +2528,41 @@ export class Account { */ getSession(sessionId: string): Promise; getSession( - paramsOrFirst: { sessionId: string } | string + paramsOrFirst: { sessionId: string } | string, ): Promise { let params: { sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { sessionId: string }; } else { params = { - sessionId: paramsOrFirst as string + sessionId: paramsOrFirst as string, }; } - - const sessionId = params.sessionId; + const sessionId = params.sessionId; if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); + throw new AppwriteException( + 'Missing required parameter: "sessionId"', + ); } - - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', encodeURIComponent(String(sessionId))); - const payload: Payload = {}; + const apiPath = '/account/sessions/{sessionId}'.replace( + '{sessionId}', + encodeURIComponent(String(sessionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -2440,40 +2583,42 @@ export class Account { */ updateSession(sessionId: string): Promise; updateSession( - paramsOrFirst: { sessionId: string } | string + paramsOrFirst: { sessionId: string } | string, ): Promise { let params: { sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { sessionId: string }; } else { params = { - sessionId: paramsOrFirst as string + sessionId: paramsOrFirst as string, }; } - - const sessionId = params.sessionId; + const sessionId = params.sessionId; if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); + throw new AppwriteException( + 'Missing required parameter: "sessionId"', + ); } - - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', encodeURIComponent(String(sessionId))); - const payload: Payload = {}; + const apiPath = '/account/sessions/{sessionId}'.replace( + '{sessionId}', + encodeURIComponent(String(sessionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2493,40 +2638,40 @@ export class Account { * @deprecated Use the object parameter style method for a better developer experience. */ deleteSession(sessionId: string): Promise<{}>; - deleteSession( - paramsOrFirst: { sessionId: string } | string - ): Promise<{}> { + deleteSession(paramsOrFirst: { sessionId: string } | string): Promise<{}> { let params: { sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { sessionId: string }; } else { params = { - sessionId: paramsOrFirst as string + sessionId: paramsOrFirst as string, }; } - - const sessionId = params.sessionId; + const sessionId = params.sessionId; if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); + throw new AppwriteException( + 'Missing required parameter: "sessionId"', + ); } - - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', encodeURIComponent(String(sessionId))); - const payload: Payload = {}; + const apiPath = '/account/sessions/{sessionId}'.replace( + '{sessionId}', + encodeURIComponent(String(sessionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -2535,31 +2680,27 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - updateStatus(): Promise> { - + updateStatus< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(): Promise> { const apiPath = '/account/status'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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. - * + * * 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 {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. 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. * @param {string} params.email - User email. @@ -2567,12 +2708,16 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise; + createEmailToken(params: { + userId: string; + email: string; + phrase?: boolean; + }): Promise; /** * 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. - * + * * 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 {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. 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. * @param {string} email - User email. @@ -2581,66 +2726,72 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createEmailToken(userId: string, email: string, phrase?: boolean): Promise; createEmailToken( - paramsOrFirst: { userId: string, email: string, phrase?: boolean } | string, - ...rest: [(string)?, (boolean)?] + userId: string, + email: string, + phrase?: boolean, + ): Promise; + createEmailToken( + paramsOrFirst: + { userId: string; email: string; phrase?: boolean } | string, + ...rest: [string?, boolean?] ): Promise { - let params: { userId: string, email: string, phrase?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, phrase?: boolean }; + let params: { userId: string; email: string; phrase?: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + email: string; + phrase?: boolean; + }; } else { params = { userId: paramsOrFirst as string, email: rest[0] as string, - phrase: rest[1] as boolean + phrase: rest[1] as boolean, }; } - + const userId = params.userId; const email = params.email; const phrase = params.phrase; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } - const apiPath = '/account/tokens/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof phrase !== 'undefined') { - payload['phrase'] = phrase; + apiPayload['phrase'] = phrase; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to 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 link sent to the user's email address is valid for 1 hour. - * + * * 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 {string} params.userId - 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. 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. * @param {string} params.email - User email. @@ -2649,12 +2800,17 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise; + createMagicURLToken(params: { + userId: string; + email: string; + url?: string; + phrase?: boolean; + }): Promise; /** * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to 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 link sent to the user's email address is valid for 1 hour. - * + * * 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 {string} userId - 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. 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. * @param {string} email - User email. @@ -2664,89 +2820,108 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise; createMagicURLToken( - paramsOrFirst: { userId: string, email: string, url?: string, phrase?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + userId: string, + email: string, + url?: string, + phrase?: boolean, + ): Promise; + createMagicURLToken( + paramsOrFirst: + | { userId: string; email: string; url?: string; phrase?: boolean } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - let params: { userId: string, email: string, url?: string, phrase?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, url?: string, phrase?: boolean }; + let params: { + userId: string; + email: string; + url?: string; + phrase?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + email: string; + url?: string; + phrase?: boolean; + }; } else { params = { userId: paramsOrFirst as string, email: rest[0] as string, url: rest[1] as string, - phrase: rest[2] as boolean + phrase: rest[2] as boolean, }; } - + const userId = params.userId; const email = params.email; const url = params.url; const phrase = params.phrase; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } - const apiPath = '/account/tokens/magic-url'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof phrase !== 'undefined') { - payload['phrase'] = phrase; + apiPayload['phrase'] = phrase; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** - * 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. - * + * 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 authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. - * + * * 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, appwrite, 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 {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, 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 {Promise} */ - createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): Promise; + createOAuth2Token(params: { + provider: OAuthProvider; + success?: string; + failure?: string; + scopes?: string[]; + }): Promise; /** - * 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. - * + * 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 authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. - * + * * 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, appwrite, 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 {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, 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. @@ -2754,62 +2929,90 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise; createOAuth2Token( - paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider, - ...rest: [(string)?, (string)?, (string[])?] + provider: OAuthProvider, + success?: string, + failure?: string, + scopes?: string[], + ): Promise; + createOAuth2Token( + paramsOrFirst: + | { + provider: OAuthProvider; + success?: string; + failure?: string; + scopes?: string[]; + } + | OAuthProvider, + ...rest: [string?, string?, string[]?] ): Promise { - 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[] }; + 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[] + 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"'); + throw new AppwriteException( + 'Missing required parameter: "provider"', + ); } - - const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', encodeURIComponent(String(provider))); - const payload: Payload = {}; + const apiPath = '/account/tokens/oauth2/{provider}'.replace( + '{provider}', + encodeURIComponent(String(provider)), + ); + const apiPayload: Payload = {}; if (typeof success !== 'undefined') { - payload['success'] = success; + apiPayload['success'] = success; } if (typeof failure !== 'undefined') { - payload['failure'] = failure; + apiPayload['failure'] = failure; } if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'text/html', - } + accept: 'text/html', + }; - return this.client.redirect( - 'get', - uri, - apiHeaders, - payload - ); + return this.client.redirect('get', uri, apiHeaders, apiPayload); } /** * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. 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 phone is valid for 15 minutes. - * + * * 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 {string} params.userId - 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. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. @@ -2817,10 +3020,13 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - createPhoneToken(params: { userId: string, phone: string }): Promise; + createPhoneToken(params: { + userId: string; + phone: string; + }): Promise; /** * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. 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 phone is valid for 15 minutes. - * + * * 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 {string} userId - 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. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. @@ -2831,59 +3037,56 @@ export class Account { */ createPhoneToken(userId: string, phone: string): Promise; createPhoneToken( - paramsOrFirst: { userId: string, phone: string } | string, - ...rest: [(string)?] + paramsOrFirst: { userId: string; phone: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, phone: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, phone: string }; + let params: { userId: string; phone: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { userId: string; phone: string }; } else { params = { userId: paramsOrFirst as string, - phone: rest[0] as string + phone: rest[0] as string, }; } - + const userId = params.userId; const phone = params.phone; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof phone === 'undefined') { throw new AppwriteException('Missing required parameter: "phone"'); } - const apiPath = '/account/tokens/phone'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof phone !== 'undefined') { - payload['phone'] = phone; + apiPayload['phone'] = phone; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. - * + * * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - * + * * * @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project 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. * @throws {AppwriteException} @@ -2892,9 +3095,9 @@ export class Account { createEmailVerification(params: { url: string }): Promise; /** * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. - * + * * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - * + * * * @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project 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. * @throws {AppwriteException} @@ -2903,50 +3106,47 @@ export class Account { */ createEmailVerification(url: string): Promise; createEmailVerification( - paramsOrFirst: { url: string } | string + paramsOrFirst: { url: string } | string, ): Promise { let params: { url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { url: string }; } else { params = { - url: paramsOrFirst as string + url: paramsOrFirst as string, }; } - - const url = params.url; + const url = params.url; if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. - * + * * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - * + * * * @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project 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. * @throws {AppwriteException} @@ -2956,9 +3156,9 @@ export class Account { createVerification(params: { url: string }): Promise; /** * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. - * + * * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - * + * * * @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project 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. * @throws {AppwriteException} @@ -2967,43 +3167,40 @@ export class Account { */ createVerification(url: string): Promise; createVerification( - paramsOrFirst: { url: string } | string + paramsOrFirst: { url: string } | string, ): Promise { let params: { url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { url: string }; } else { params = { - url: paramsOrFirst as string + url: paramsOrFirst as string, }; } - - const url = params.url; + const url = params.url; if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3014,7 +3211,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updateEmailVerification(params: { userId: string, secret: string }): Promise; + updateEmailVerification(params: { + userId: string; + secret: string; + }): Promise; /** * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. * @@ -3024,54 +3224,57 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmailVerification(userId: string, secret: string): Promise; updateEmailVerification( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] + userId: string, + secret: string, + ): Promise; + updateEmailVerification( + paramsOrFirst: { userId: string; secret: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; + let params: { userId: string; secret: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + secret: string; + }; } else { params = { userId: paramsOrFirst as string, - secret: rest[0] as string + secret: rest[0] as string, }; } - + const userId = params.userId; const secret = params.secret; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof secret === 'undefined') { throw new AppwriteException('Missing required parameter: "secret"'); } - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -3083,7 +3286,10 @@ export class Account { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead. */ - updateVerification(params: { userId: string, secret: string }): Promise; + updateVerification(params: { + userId: string; + secret: string; + }): Promise; /** * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. * @@ -3095,52 +3301,52 @@ export class Account { */ updateVerification(userId: string, secret: string): Promise; updateVerification( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] + paramsOrFirst: { userId: string; secret: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; + let params: { userId: string; secret: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + secret: string; + }; } else { params = { userId: paramsOrFirst as string, - secret: rest[0] as string + secret: rest[0] as string, }; } - + const userId = params.userId; const secret = params.secret; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof secret === 'undefined') { throw new AppwriteException('Missing required parameter: "secret"'); } - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -3150,23 +3356,17 @@ export class Account { * @returns {Promise} */ createPhoneVerification(): Promise { - const apiPath = '/account/verifications/phone'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3177,7 +3377,10 @@ export class Account { * @throws {AppwriteException} * @returns {Promise} */ - updatePhoneVerification(params: { userId: string, secret: string }): Promise; + updatePhoneVerification(params: { + userId: string; + secret: string; + }): Promise; /** * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. * @@ -3187,53 +3390,56 @@ export class Account { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePhoneVerification(userId: string, secret: string): Promise; updatePhoneVerification( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] + userId: string, + secret: string, + ): Promise; + updatePhoneVerification( + paramsOrFirst: { userId: string; secret: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; + let params: { userId: string; secret: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + secret: string; + }; } else { params = { userId: paramsOrFirst as string, - secret: rest[0] as string + secret: rest[0] as string, }; } - + const userId = params.userId; const secret = params.secret; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof secret === 'undefined') { throw new AppwriteException('Missing required parameter: "secret"'); } - const apiPath = '/account/verifications/phone'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } } diff --git a/src/services/activities.ts b/src/services/activities.ts index 53fca89..0b5eb51 100644 --- a/src/services/activities.ts +++ b/src/services/activities.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Activities { client: Client; @@ -17,7 +15,9 @@ export class Activities { * @throws {AppwriteException} * @returns {Promise} */ - listEvents(params?: { queries?: string[] }): Promise; + listEvents(params?: { + queries?: string[]; + }): Promise; /** * List all events for selected filters. * @@ -28,44 +28,42 @@ export class Activities { */ listEvents(queries?: string[]): Promise; listEvents( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[] } | string[], ): Promise { let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { queries?: string[] }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], }; } - - const queries = params.queries; - + const queries = params.queries; const apiPath = '/activities/events'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Get event by ID. - * + * * * @param {string} params.eventId - Event ID. * @throws {AppwriteException} @@ -74,7 +72,7 @@ export class Activities { getEvent(params: { eventId: string }): Promise; /** * Get event by ID. - * + * * * @param {string} eventId - Event ID. * @throws {AppwriteException} @@ -83,38 +81,40 @@ export class Activities { */ getEvent(eventId: string): Promise; getEvent( - paramsOrFirst: { eventId: string } | string + paramsOrFirst: { eventId: string } | string, ): Promise { let params: { eventId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { eventId: string }; } else { params = { - eventId: paramsOrFirst as string + eventId: paramsOrFirst as string, }; } - - const eventId = params.eventId; + const eventId = params.eventId; if (typeof eventId === 'undefined') { - throw new AppwriteException('Missing required parameter: "eventId"'); + throw new AppwriteException( + 'Missing required parameter: "eventId"', + ); } - - const apiPath = '/activities/events/{eventId}'.replace('{eventId}', encodeURIComponent(String(eventId))); - const payload: Payload = {}; + const apiPath = '/activities/events/{eventId}'.replace( + '{eventId}', + encodeURIComponent(String(eventId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } } diff --git a/src/services/advisor.ts b/src/services/advisor.ts index ccb67d3..d511b8e 100644 --- a/src/services/advisor.ts +++ b/src/services/advisor.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Advisor { client: Client; @@ -12,17 +10,20 @@ export class Advisor { /** * Get a list of all the project's analyzer reports. You can use the query params to filter your results. - * + * * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listReports(params?: { queries?: string[], total?: boolean }): Promise; + listReports(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all the project's analyzer reports. You can use the query params to filter your results. - * + * * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. @@ -30,52 +31,56 @@ export class Advisor { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listReports(queries?: string[], total?: boolean): Promise; listReports( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listReports( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/reports'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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} @@ -84,7 +89,7 @@ export class Advisor { getReport(params: { reportId: string }): Promise; /** * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. - * + * * * @param {string} reportId - Report ID. * @throws {AppwriteException} @@ -93,44 +98,46 @@ export class Advisor { */ getReport(reportId: string): Promise; getReport( - paramsOrFirst: { reportId: string } | string + paramsOrFirst: { reportId: string } | string, ): Promise { let params: { reportId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { reportId: string }; } else { params = { - reportId: paramsOrFirst as string + reportId: paramsOrFirst as string, }; } - - const reportId = params.reportId; + const reportId = params.reportId; if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); + throw new AppwriteException( + 'Missing required parameter: "reportId"', + ); } - - const apiPath = '/reports/{reportId}'.replace('{reportId}', encodeURIComponent(String(reportId))); - const payload: Payload = {}; + const apiPath = '/reports/{reportId}'.replace( + '{reportId}', + encodeURIComponent(String(reportId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. - * + * * * @param {string} params.reportId - Report ID. * @throws {AppwriteException} @@ -139,7 +146,7 @@ export class Advisor { deleteReport(params: { reportId: string }): Promise<{}>; /** * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. - * + * * * @param {string} reportId - Report ID. * @throws {AppwriteException} @@ -147,45 +154,45 @@ export class Advisor { * @deprecated Use the object parameter style method for a better developer experience. */ deleteReport(reportId: string): Promise<{}>; - deleteReport( - paramsOrFirst: { reportId: string } | string - ): Promise<{}> { + deleteReport(paramsOrFirst: { reportId: string } | string): Promise<{}> { let params: { reportId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { reportId: string }; } else { params = { - reportId: paramsOrFirst as string + reportId: paramsOrFirst as string, }; } - - const reportId = params.reportId; + const reportId = params.reportId; if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); + throw new AppwriteException( + 'Missing required parameter: "reportId"', + ); } - - const apiPath = '/reports/{reportId}'.replace('{reportId}', encodeURIComponent(String(reportId))); - const payload: Payload = {}; + const apiPath = '/reports/{reportId}'.replace( + '{reportId}', + encodeURIComponent(String(reportId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** * 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 @@ -193,10 +200,14 @@ export class Advisor { * @throws {AppwriteException} * @returns {Promise} */ - listInsights(params: { reportId: string, queries?: string[], total?: boolean }): Promise; + listInsights(params: { + reportId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List the insights produced under a single analyzer report. You can use the query params to filter your results further. - * + * * * @param {string} reportId - Parent report ID. * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy @@ -205,67 +216,81 @@ export class Advisor { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listInsights(reportId: string, queries?: string[], total?: boolean): Promise; listInsights( - paramsOrFirst: { reportId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + reportId: string, + queries?: string[], + total?: boolean, + ): Promise; + listInsights( + paramsOrFirst: + { reportId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - let params: { reportId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string, queries?: string[], total?: boolean }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "reportId"', + ); } - - const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', encodeURIComponent(String(reportId))); - const payload: Payload = {}; + const apiPath = '/reports/{reportId}/insights'.replace( + '{reportId}', + encodeURIComponent(String(reportId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Get an insight by its unique ID, scoped to its parent report. - * + * * * @param {string} params.reportId - Parent report ID. * @param {string} params.insightId - Insight ID. * @throws {AppwriteException} * @returns {Promise} */ - getInsight(params: { reportId: string, insightId: string }): Promise; + getInsight(params: { + reportId: string; + insightId: string; + }): Promise; /** * Get an insight by its unique ID, scoped to its parent report. - * + * * * @param {string} reportId - Parent report ID. * @param {string} insightId - Insight ID. @@ -275,44 +300,50 @@ export class Advisor { */ getInsight(reportId: string, insightId: string): Promise; getInsight( - paramsOrFirst: { reportId: string, insightId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { reportId: string; insightId: string } | string, + ...rest: [string?] ): Promise { - let params: { reportId: string, insightId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string, insightId: string }; + 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 + insightId: rest[0] as string, }; } - + const reportId = params.reportId; const insightId = params.insightId; - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); + throw new AppwriteException( + 'Missing required parameter: "reportId"', + ); } if (typeof insightId === 'undefined') { - throw new AppwriteException('Missing required parameter: "insightId"'); + throw new AppwriteException( + 'Missing required parameter: "insightId"', + ); } - - const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', encodeURIComponent(String(reportId))).replace('{insightId}', encodeURIComponent(String(insightId))); - const payload: Payload = {}; + const apiPath = '/reports/{reportId}/insights/{insightId}' + .replace('{reportId}', encodeURIComponent(String(reportId))) + .replace('{insightId}', encodeURIComponent(String(insightId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } } diff --git a/src/services/apps.ts b/src/services/apps.ts index f47da03..d13ab47 100644 --- a/src/services/apps.ts +++ b/src/services/apps.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Apps { client: Client; @@ -18,7 +16,10 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], total?: boolean }): Promise; + list(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * List applications. * @@ -30,45 +31,46 @@ export class Apps { */ list(queries?: string[], total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/apps'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -96,7 +98,27 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }): Promise; + create(params: { + appId: string; + name: string; + redirectUris: string[]; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + postLogoutRedirectUris?: string[]; + enabled?: boolean; + type?: string; + deviceFlow?: boolean; + teamId?: string; + }): Promise; /** * Create a new application. * @@ -123,15 +145,120 @@ export class Apps { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string): Promise; create( - paramsOrFirst: { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?, (string)?, (string)?, (string)?, (string)?, (string[])?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?, (string)?] + appId: string, + name: string, + redirectUris: string[], + description?: string, + clientUri?: string, + logoUri?: string, + privacyPolicyUrl?: string, + termsUrl?: string, + contacts?: string[], + tagline?: string, + tags?: string[], + images?: string[], + supportUrl?: string, + dataDeletionUrl?: string, + postLogoutRedirectUris?: string[], + enabled?: boolean, + type?: string, + deviceFlow?: boolean, + teamId?: string, + ): Promise; + create( + paramsOrFirst: + | { + appId: string; + name: string; + redirectUris: string[]; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + postLogoutRedirectUris?: string[]; + enabled?: boolean; + type?: string; + deviceFlow?: boolean; + teamId?: string; + } + | string, + ...rest: [ + string?, + string[]?, + string?, + string?, + string?, + string?, + string?, + string[]?, + string?, + string[]?, + string[]?, + string?, + string?, + string[]?, + boolean?, + string?, + boolean?, + string?, + ] ): Promise { - let params: { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, name: string, redirectUris: string[], description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, postLogoutRedirectUris?: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; + let params: { + appId: string; + name: string; + redirectUris: string[]; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + postLogoutRedirectUris?: string[]; + enabled?: boolean; + type?: string; + deviceFlow?: boolean; + teamId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + name: string; + redirectUris: string[]; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + postLogoutRedirectUris?: string[]; + enabled?: boolean; + type?: string; + deviceFlow?: boolean; + teamId?: string; + }; } else { params = { appId: paramsOrFirst as string, @@ -152,10 +279,10 @@ export class Apps { enabled: rest[14] as boolean, type: rest[15] as string, deviceFlow: rest[16] as boolean, - teamId: rest[17] as string + teamId: rest[17] as string, }; } - + const appId = params.appId; const name = params.name; const redirectUris = params.redirectUris; @@ -175,7 +302,6 @@ export class Apps { const type = params.type; const deviceFlow = params.deviceFlow; const teamId = params.teamId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } @@ -183,82 +309,78 @@ export class Apps { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof redirectUris === 'undefined') { - throw new AppwriteException('Missing required parameter: "redirectUris"'); + throw new AppwriteException( + 'Missing required parameter: "redirectUris"', + ); } - const apiPath = '/apps'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof appId !== 'undefined') { - payload['appId'] = appId; + apiPayload['appId'] = appId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof description !== 'undefined') { - payload['description'] = description; + apiPayload['description'] = description; } if (typeof clientUri !== 'undefined') { - payload['clientUri'] = clientUri; + apiPayload['clientUri'] = clientUri; } if (typeof logoUri !== 'undefined') { - payload['logoUri'] = logoUri; + apiPayload['logoUri'] = logoUri; } if (typeof privacyPolicyUrl !== 'undefined') { - payload['privacyPolicyUrl'] = privacyPolicyUrl; + apiPayload['privacyPolicyUrl'] = privacyPolicyUrl; } if (typeof termsUrl !== 'undefined') { - payload['termsUrl'] = termsUrl; + apiPayload['termsUrl'] = termsUrl; } if (typeof contacts !== 'undefined') { - payload['contacts'] = contacts; + apiPayload['contacts'] = contacts; } if (typeof tagline !== 'undefined') { - payload['tagline'] = tagline; + apiPayload['tagline'] = tagline; } if (typeof tags !== 'undefined') { - payload['tags'] = tags; + apiPayload['tags'] = tags; } if (typeof images !== 'undefined') { - payload['images'] = images; + apiPayload['images'] = images; } if (typeof supportUrl !== 'undefined') { - payload['supportUrl'] = supportUrl; + apiPayload['supportUrl'] = supportUrl; } if (typeof dataDeletionUrl !== 'undefined') { - payload['dataDeletionUrl'] = dataDeletionUrl; + apiPayload['dataDeletionUrl'] = dataDeletionUrl; } if (typeof redirectUris !== 'undefined') { - payload['redirectUris'] = redirectUris; + apiPayload['redirectUris'] = redirectUris; } if (typeof postLogoutRedirectUris !== 'undefined') { - payload['postLogoutRedirectUris'] = postLogoutRedirectUris; + apiPayload['postLogoutRedirectUris'] = postLogoutRedirectUris; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof deviceFlow !== 'undefined') { - payload['deviceFlow'] = deviceFlow; + apiPayload['deviceFlow'] = deviceFlow; } if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -268,22 +390,16 @@ export class Apps { * @returns {Promise} */ listInstallationScopes(): Promise { - const apiPath = '/apps/scopes/installations'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -293,22 +409,16 @@ export class Apps { * @returns {Promise} */ listOAuth2Scopes(): Promise { - const apiPath = '/apps/scopes/oauth2'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -328,40 +438,38 @@ export class Apps { * @deprecated Use the object parameter style method for a better developer experience. */ get(appId: string): Promise; - get( - paramsOrFirst: { appId: string } | string - ): Promise { + get(paramsOrFirst: { appId: string } | string): Promise { let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { appId: string }; } else { params = { - appId: paramsOrFirst as string + appId: paramsOrFirst as string, }; } - - const appId = params.appId; + const appId = params.appId; if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -390,7 +498,28 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string }): Promise; + update(params: { + appId: string; + name: string; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + enabled?: boolean; + redirectUris?: string[]; + postLogoutRedirectUris?: string[]; + type?: string; + deviceFlow?: boolean; + installationScopes?: string[]; + installationRedirectUrl?: string; + }): Promise; /** * Update an application by its unique ID. * @@ -418,15 +547,125 @@ export class Apps { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string): Promise; update( - paramsOrFirst: { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string[])?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (boolean)?, (string[])?, (string[])?, (string)?, (boolean)?, (string[])?, (string)?] + appId: string, + name: string, + description?: string, + clientUri?: string, + logoUri?: string, + privacyPolicyUrl?: string, + termsUrl?: string, + contacts?: string[], + tagline?: string, + tags?: string[], + images?: string[], + supportUrl?: string, + dataDeletionUrl?: string, + enabled?: boolean, + redirectUris?: string[], + postLogoutRedirectUris?: string[], + type?: string, + deviceFlow?: boolean, + installationScopes?: string[], + installationRedirectUrl?: string, + ): Promise; + update( + paramsOrFirst: + | { + appId: string; + name: string; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + enabled?: boolean; + redirectUris?: string[]; + postLogoutRedirectUris?: string[]; + type?: string; + deviceFlow?: boolean; + installationScopes?: string[]; + installationRedirectUrl?: string; + } + | string, + ...rest: [ + string?, + string?, + string?, + string?, + string?, + string?, + string[]?, + string?, + string[]?, + string[]?, + string?, + string?, + boolean?, + string[]?, + string[]?, + string?, + boolean?, + string[]?, + string?, + ] ): Promise { - let params: { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, name: string, description?: string, clientUri?: string, logoUri?: string, privacyPolicyUrl?: string, termsUrl?: string, contacts?: string[], tagline?: string, tags?: string[], images?: string[], supportUrl?: string, dataDeletionUrl?: string, enabled?: boolean, redirectUris?: string[], postLogoutRedirectUris?: string[], type?: string, deviceFlow?: boolean, installationScopes?: string[], installationRedirectUrl?: string }; + let params: { + appId: string; + name: string; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + enabled?: boolean; + redirectUris?: string[]; + postLogoutRedirectUris?: string[]; + type?: string; + deviceFlow?: boolean; + installationScopes?: string[]; + installationRedirectUrl?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + name: string; + description?: string; + clientUri?: string; + logoUri?: string; + privacyPolicyUrl?: string; + termsUrl?: string; + contacts?: string[]; + tagline?: string; + tags?: string[]; + images?: string[]; + supportUrl?: string; + dataDeletionUrl?: string; + enabled?: boolean; + redirectUris?: string[]; + postLogoutRedirectUris?: string[]; + type?: string; + deviceFlow?: boolean; + installationScopes?: string[]; + installationRedirectUrl?: string; + }; } else { params = { appId: paramsOrFirst as string, @@ -448,10 +687,10 @@ export class Apps { type: rest[15] as string, deviceFlow: rest[16] as boolean, installationScopes: rest[17] as string[], - installationRedirectUrl: rest[18] as string + installationRedirectUrl: rest[18] as string, }; } - + const appId = params.appId; const name = params.name; const description = params.description; @@ -472,87 +711,83 @@ export class Apps { const deviceFlow = params.deviceFlow; const installationScopes = params.installationScopes; const installationRedirectUrl = params.installationRedirectUrl; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - - const apiPath = '/apps/{appId}'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof description !== 'undefined') { - payload['description'] = description; + apiPayload['description'] = description; } if (typeof clientUri !== 'undefined') { - payload['clientUri'] = clientUri; + apiPayload['clientUri'] = clientUri; } if (typeof logoUri !== 'undefined') { - payload['logoUri'] = logoUri; + apiPayload['logoUri'] = logoUri; } if (typeof privacyPolicyUrl !== 'undefined') { - payload['privacyPolicyUrl'] = privacyPolicyUrl; + apiPayload['privacyPolicyUrl'] = privacyPolicyUrl; } if (typeof termsUrl !== 'undefined') { - payload['termsUrl'] = termsUrl; + apiPayload['termsUrl'] = termsUrl; } if (typeof contacts !== 'undefined') { - payload['contacts'] = contacts; + apiPayload['contacts'] = contacts; } if (typeof tagline !== 'undefined') { - payload['tagline'] = tagline; + apiPayload['tagline'] = tagline; } if (typeof tags !== 'undefined') { - payload['tags'] = tags; + apiPayload['tags'] = tags; } if (typeof images !== 'undefined') { - payload['images'] = images; + apiPayload['images'] = images; } if (typeof supportUrl !== 'undefined') { - payload['supportUrl'] = supportUrl; + apiPayload['supportUrl'] = supportUrl; } if (typeof dataDeletionUrl !== 'undefined') { - payload['dataDeletionUrl'] = dataDeletionUrl; + apiPayload['dataDeletionUrl'] = dataDeletionUrl; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof redirectUris !== 'undefined') { - payload['redirectUris'] = redirectUris; + apiPayload['redirectUris'] = redirectUris; } if (typeof postLogoutRedirectUris !== 'undefined') { - payload['postLogoutRedirectUris'] = postLogoutRedirectUris; + apiPayload['postLogoutRedirectUris'] = postLogoutRedirectUris; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof deviceFlow !== 'undefined') { - payload['deviceFlow'] = deviceFlow; + apiPayload['deviceFlow'] = deviceFlow; } if (typeof installationScopes !== 'undefined') { - payload['installationScopes'] = installationScopes; + apiPayload['installationScopes'] = installationScopes; } if (typeof installationRedirectUrl !== 'undefined') { - payload['installationRedirectUrl'] = installationRedirectUrl; + apiPayload['installationRedirectUrl'] = installationRedirectUrl; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -572,41 +807,39 @@ export class Apps { * @deprecated Use the object parameter style method for a better developer experience. */ delete(appId: string): Promise<{}>; - delete( - paramsOrFirst: { appId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { appId: string } | string): Promise<{}> { let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { appId: string }; } else { params = { - appId: paramsOrFirst as string + appId: paramsOrFirst as string, }; } - - const appId = params.appId; + const appId = params.appId; if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -618,7 +851,11 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - listInstallations(params: { appId: string, queries?: string[], total?: boolean }): Promise; + listInstallations(params: { + appId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List installations of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. * @@ -629,52 +866,61 @@ export class Apps { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listInstallations(appId: string, queries?: string[], total?: boolean): Promise; listInstallations( - paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + appId: string, + queries?: string[], + total?: boolean, + ): Promise; + listInstallations( + paramsOrFirst: + { appId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - let params: { appId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + let params: { appId: string; queries?: string[]; total?: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + queries?: string[]; + total?: boolean; + }; } else { params = { appId: paramsOrFirst as string, queries: rest[0] as string[], - total: rest[1] as boolean + total: rest[1] as boolean, }; } - + const appId = params.appId; const queries = params.queries; const total = params.total; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}/installations'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/installations'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -685,7 +931,10 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - getInstallation(params: { appId: string, installationId: string }): Promise; + getInstallation(params: { + appId: string; + installationId: string; + }): Promise; /** * Get an installation of an application by its unique ID. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. * @@ -695,47 +944,57 @@ export class Apps { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getInstallation(appId: string, installationId: string): Promise; getInstallation( - paramsOrFirst: { appId: string, installationId: string } | string, - ...rest: [(string)?] + appId: string, + installationId: string, + ): Promise; + getInstallation( + paramsOrFirst: { appId: string; installationId: string } | string, + ...rest: [string?] ): Promise { - let params: { appId: string, installationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, installationId: string }; + let params: { appId: string; installationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + installationId: string; + }; } else { params = { appId: paramsOrFirst as string, - installationId: rest[0] as string + installationId: rest[0] as string, }; } - + const appId = params.appId; const installationId = params.installationId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); - } - - const apiPath = '/apps/{appId}/installations/{installationId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); + } + const apiPath = '/apps/{appId}/installations/{installationId}' + .replace('{appId}', encodeURIComponent(String(appId))) + .replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -746,7 +1005,10 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteInstallation(params: { appId: string, installationId: string }): Promise<{}>; + deleteInstallation(params: { + appId: string; + installationId: string; + }): Promise<{}>; /** * Delete an installation of an application by its unique ID. Requires a caller with update access to the app. Previously issued installation access tokens are revoked. * @@ -758,46 +1020,53 @@ export class Apps { */ deleteInstallation(appId: string, installationId: string): Promise<{}>; deleteInstallation( - paramsOrFirst: { appId: string, installationId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { appId: string; installationId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { appId: string, installationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, installationId: string }; + let params: { appId: string; installationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + installationId: string; + }; } else { params = { appId: paramsOrFirst as string, - installationId: rest[0] as string + installationId: rest[0] as string, }; } - + const appId = params.appId; const installationId = params.installationId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); - } - - const apiPath = '/apps/{appId}/installations/{installationId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); + } + const apiPath = '/apps/{appId}/installations/{installationId}' + .replace('{appId}', encodeURIComponent(String(appId))) + .replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -808,7 +1077,10 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - createInstallationToken(params: { appId: string, installationId: string }): Promise; + createInstallationToken(params: { + appId: string; + installationId: string; + }): Promise; /** * Create a token for an installation of an application. Requires an app key sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header, or a caller with update access to the app. The returned token carries the scopes and authorization details granted to the installation, and can be used as an `Authorization: Bearer` header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted. * @@ -818,48 +1090,58 @@ export class Apps { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createInstallationToken(appId: string, installationId: string): Promise; createInstallationToken( - paramsOrFirst: { appId: string, installationId: string } | string, - ...rest: [(string)?] + appId: string, + installationId: string, + ): Promise; + createInstallationToken( + paramsOrFirst: { appId: string; installationId: string } | string, + ...rest: [string?] ): Promise { - let params: { appId: string, installationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, installationId: string }; + let params: { appId: string; installationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + installationId: string; + }; } else { params = { appId: paramsOrFirst as string, - installationId: rest[0] as string + installationId: rest[0] as string, }; } - + const appId = params.appId; const installationId = params.installationId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); - } - - const apiPath = '/apps/{appId}/installations/{installationId}/tokens'.replace('{appId}', encodeURIComponent(String(appId))).replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); + } + const apiPath = '/apps/{appId}/installations/{installationId}/tokens' + .replace('{appId}', encodeURIComponent(String(appId))) + .replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -871,7 +1153,11 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - listKeys(params: { appId: string, queries?: string[], total?: boolean }): Promise; + listKeys(params: { + appId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List app keys for an application. * @@ -882,52 +1168,61 @@ export class Apps { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listKeys(appId: string, queries?: string[], total?: boolean): Promise; listKeys( - paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + appId: string, + queries?: string[], + total?: boolean, + ): Promise; + listKeys( + paramsOrFirst: + { appId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - let params: { appId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + let params: { appId: string; queries?: string[]; total?: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + queries?: string[]; + total?: boolean; + }; } else { params = { appId: paramsOrFirst as string, queries: rest[0] as string[], - total: rest[1] as boolean + total: rest[1] as boolean, }; } - + const appId = params.appId; const queries = params.queries; const total = params.total; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}/keys'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/keys'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -948,40 +1243,40 @@ export class Apps { */ createKey(appId: string): Promise; createKey( - paramsOrFirst: { appId: string } | string + paramsOrFirst: { appId: string } | string, ): Promise { let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { appId: string }; } else { params = { - appId: paramsOrFirst as string + appId: paramsOrFirst as string, }; } - - const appId = params.appId; + const appId = params.appId; if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}/keys'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/keys'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -992,7 +1287,7 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - getKey(params: { appId: string, keyId: string }): Promise; + getKey(params: { appId: string; keyId: string }): Promise; /** * Get an app key by its unique ID. * @@ -1004,45 +1299,44 @@ export class Apps { */ getKey(appId: string, keyId: string): Promise; getKey( - paramsOrFirst: { appId: string, keyId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { appId: string; keyId: string } | string, + ...rest: [string?] ): Promise { - let params: { appId: string, keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, keyId: string }; + let params: { appId: string; keyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { appId: string; keyId: string }; } else { params = { appId: paramsOrFirst as string, - keyId: rest[0] as string + keyId: rest[0] as string, }; } - + const appId = params.appId; const keyId = params.keyId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } - - const apiPath = '/apps/{appId}/keys/{keyId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/keys/{keyId}' + .replace('{appId}', encodeURIComponent(String(appId))) + .replace('{keyId}', encodeURIComponent(String(keyId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1053,7 +1347,7 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteKey(params: { appId: string, keyId: string }): Promise<{}>; + deleteKey(params: { appId: string; keyId: string }): Promise<{}>; /** * Delete an app key by its unique ID. * @@ -1065,46 +1359,45 @@ export class Apps { */ deleteKey(appId: string, keyId: string): Promise<{}>; deleteKey( - paramsOrFirst: { appId: string, keyId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { appId: string; keyId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { appId: string, keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, keyId: string }; + let params: { appId: string; keyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { appId: string; keyId: string }; } else { params = { appId: paramsOrFirst as string, - keyId: rest[0] as string + keyId: rest[0] as string, }; } - + const appId = params.appId; const keyId = params.keyId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } - - const apiPath = '/apps/{appId}/keys/{keyId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/keys/{keyId}' + .replace('{appId}', encodeURIComponent(String(appId))) + .replace('{keyId}', encodeURIComponent(String(keyId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1115,7 +1408,10 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - updateLabels(params: { appId: string, labels: string[] }): Promise; + updateLabels(params: { + appId: string; + labels: string[]; + }): Promise; /** * Update the labels of an application. Labels are read-only for clients; only a server SDK using a project API key can set them. Replaces the previous labels. * @@ -1127,49 +1423,52 @@ export class Apps { */ updateLabels(appId: string, labels: string[]): Promise; updateLabels( - paramsOrFirst: { appId: string, labels: string[] } | string, - ...rest: [(string[])?] + paramsOrFirst: { appId: string; labels: string[] } | string, + ...rest: [string[]?] ): Promise { - let params: { appId: string, labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, labels: string[] }; + let params: { appId: string; labels: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + labels: string[]; + }; } else { params = { appId: paramsOrFirst as string, - labels: rest[0] as string[] + labels: rest[0] as string[], }; } - + const appId = params.appId; const labels = params.labels; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof labels === 'undefined') { throw new AppwriteException('Missing required parameter: "labels"'); } - - const apiPath = '/apps/{appId}/labels'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/labels'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; if (typeof labels !== 'undefined') { - payload['labels'] = labels; + apiPayload['labels'] = labels; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1181,7 +1480,11 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - listSecrets(params: { appId: string, queries?: string[], total?: boolean }): Promise; + listSecrets(params: { + appId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List client secrets for an application. * @@ -1192,52 +1495,61 @@ export class Apps { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listSecrets(appId: string, queries?: string[], total?: boolean): Promise; listSecrets( - paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + appId: string, + queries?: string[], + total?: boolean, + ): Promise; + listSecrets( + paramsOrFirst: + { appId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - let params: { appId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + let params: { appId: string; queries?: string[]; total?: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + queries?: string[]; + total?: boolean; + }; } else { params = { appId: paramsOrFirst as string, queries: rest[0] as string[], - total: rest[1] as boolean + total: rest[1] as boolean, }; } - + const appId = params.appId; const queries = params.queries; const total = params.total; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}/secrets'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/secrets'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1258,40 +1570,40 @@ export class Apps { */ createSecret(appId: string): Promise; createSecret( - paramsOrFirst: { appId: string } | string + paramsOrFirst: { appId: string } | string, ): Promise { let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { appId: string }; } else { params = { - appId: paramsOrFirst as string + appId: paramsOrFirst as string, }; } - - const appId = params.appId; + const appId = params.appId; if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}/secrets'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/secrets'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1302,7 +1614,10 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - getSecret(params: { appId: string, secretId: string }): Promise; + getSecret(params: { + appId: string; + secretId: string; + }): Promise; /** * Get an application client secret by its unique ID. * @@ -1314,45 +1629,49 @@ export class Apps { */ getSecret(appId: string, secretId: string): Promise; getSecret( - paramsOrFirst: { appId: string, secretId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { appId: string; secretId: string } | string, + ...rest: [string?] ): Promise { - let params: { appId: string, secretId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + let params: { appId: string; secretId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + secretId: string; + }; } else { params = { appId: paramsOrFirst as string, - secretId: rest[0] as string + secretId: rest[0] as string, }; } - + const appId = params.appId; const secretId = params.secretId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof secretId === 'undefined') { - throw new AppwriteException('Missing required parameter: "secretId"'); - } - - const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{secretId}', encodeURIComponent(String(secretId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "secretId"', + ); + } + const apiPath = '/apps/{appId}/secrets/{secretId}' + .replace('{appId}', encodeURIComponent(String(appId))) + .replace('{secretId}', encodeURIComponent(String(secretId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1363,7 +1682,7 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSecret(params: { appId: string, secretId: string }): Promise<{}>; + deleteSecret(params: { appId: string; secretId: string }): Promise<{}>; /** * Delete an application client secret by its unique ID. * @@ -1375,46 +1694,50 @@ export class Apps { */ deleteSecret(appId: string, secretId: string): Promise<{}>; deleteSecret( - paramsOrFirst: { appId: string, secretId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { appId: string; secretId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { appId: string, secretId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + let params: { appId: string; secretId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + secretId: string; + }; } else { params = { appId: paramsOrFirst as string, - secretId: rest[0] as string + secretId: rest[0] as string, }; } - + const appId = params.appId; const secretId = params.secretId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof secretId === 'undefined') { - throw new AppwriteException('Missing required parameter: "secretId"'); - } - - const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', encodeURIComponent(String(appId))).replace('{secretId}', encodeURIComponent(String(secretId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "secretId"', + ); + } + const apiPath = '/apps/{appId}/secrets/{secretId}' + .replace('{appId}', encodeURIComponent(String(appId))) + .replace('{secretId}', encodeURIComponent(String(secretId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1425,7 +1748,7 @@ export class Apps { * @throws {AppwriteException} * @returns {Promise} */ - updateTeam(params: { appId: string, teamId: string }): Promise; + updateTeam(params: { appId: string; teamId: string }): Promise; /** * Transfer an application to another team by its unique ID. * @@ -1437,49 +1760,49 @@ export class Apps { */ updateTeam(appId: string, teamId: string): Promise; updateTeam( - paramsOrFirst: { appId: string, teamId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { appId: string; teamId: string } | string, + ...rest: [string?] ): Promise { - let params: { appId: string, teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, teamId: string }; + let params: { appId: string; teamId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { appId: string; teamId: string }; } else { params = { appId: paramsOrFirst as string, - teamId: rest[0] as string + teamId: rest[0] as string, }; } - + const appId = params.appId; const teamId = params.teamId; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - - const apiPath = '/apps/{appId}/team'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/team'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1499,40 +1822,38 @@ export class Apps { * @deprecated Use the object parameter style method for a better developer experience. */ deleteTokens(appId: string): Promise<{}>; - deleteTokens( - paramsOrFirst: { appId: string } | string - ): Promise<{}> { + deleteTokens(paramsOrFirst: { appId: string } | string): Promise<{}> { let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { appId: string }; } else { params = { - appId: paramsOrFirst as string + appId: paramsOrFirst as string, }; } - - const appId = params.appId; + const appId = params.appId; if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/apps/{appId}/tokens'.replace('{appId}', encodeURIComponent(String(appId))); - const payload: Payload = {}; + const apiPath = '/apps/{appId}/tokens'.replace( + '{appId}', + encodeURIComponent(String(appId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/avatars.ts b/src/services/avatars.ts index d6914c0..2ffb0da 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -1,6 +1,4 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - +import { AppwriteException, Client, type Payload } from '../client'; import { Browser } from '../enums/browser'; import { CreditCard } from '../enums/credit-card'; @@ -9,7 +7,6 @@ import { BrowserTheme } from '../enums/browser-theme'; import { Timezone } from '../enums/timezone'; import { BrowserPermission } from '../enums/browser-permission'; import { ImageFormat } from '../enums/image-format'; - export class Avatars { client: Client; @@ -19,7 +16,7 @@ export class Avatars { /** * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. * * @param {Browser} params.code - Browser Code. @@ -29,10 +26,15 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getBrowser(params: { code: Browser, width?: number, height?: number, quality?: number }): Promise; + getBrowser(params: { + code: Browser; + width?: number; + height?: number; + quality?: number; + }): Promise; /** * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. * * @param {Browser} code - Browser Code. @@ -43,65 +45,96 @@ export class Avatars { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise; getBrowser( - paramsOrFirst: { code: Browser, width?: number, height?: number, quality?: number } | Browser, - ...rest: [(number)?, (number)?, (number)?] + code: Browser, + width?: number, + height?: number, + quality?: number, + ): Promise; + getBrowser( + paramsOrFirst: + | { + code: Browser; + width?: number; + height?: number; + quality?: number; + } + | Browser, + ...rest: [number?, number?, number?] ): Promise { - let params: { code: Browser, width?: number, height?: number, quality?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { code: Browser, width?: number, height?: number, quality?: number }; + let params: { + code: Browser; + width?: number; + height?: number; + quality?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('code' in paramsOrFirst || + 'width' in paramsOrFirst || + 'height' in paramsOrFirst || + 'quality' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + code: Browser; + width?: number; + height?: number; + quality?: number; + }; } else { params = { code: paramsOrFirst as Browser, width: rest[0] as number, height: rest[1] as number, - quality: rest[2] as number + quality: rest[2] as number, }; } - + const code = params.code; const width = params.width; const height = params.height; const quality = params.quality; - if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } - - const apiPath = '/avatars/browsers/{code}'.replace('{code}', encodeURIComponent(String(code))); - const payload: Payload = {}; + const apiPath = '/avatars/browsers/{code}'.replace( + '{code}', + encodeURIComponent(String(code)), + ); + const apiPayload: Payload = {}; if (typeof width !== 'undefined') { - payload['width'] = width; + apiPayload['width'] = width; } if (typeof height !== 'undefined') { - payload['height'] = height; + apiPayload['height'] = height; } if (typeof quality !== 'undefined') { - payload['quality'] = quality; + apiPayload['quality'] = quality; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/png', - } + accept: 'image/png', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } /** * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * + * * * @param {CreditCard} params.code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -110,12 +143,17 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getCreditCard(params: { code: CreditCard, width?: number, height?: number, quality?: number }): Promise; + getCreditCard(params: { + code: CreditCard; + width?: number; + height?: number; + quality?: number; + }): Promise; /** * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * + * * * @param {CreditCard} code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -125,63 +163,94 @@ export class Avatars { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise; getCreditCard( - paramsOrFirst: { code: CreditCard, width?: number, height?: number, quality?: number } | CreditCard, - ...rest: [(number)?, (number)?, (number)?] + code: CreditCard, + width?: number, + height?: number, + quality?: number, + ): Promise; + getCreditCard( + paramsOrFirst: + | { + code: CreditCard; + width?: number; + height?: number; + quality?: number; + } + | CreditCard, + ...rest: [number?, number?, number?] ): Promise { - let params: { code: CreditCard, width?: number, height?: number, quality?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { code: CreditCard, width?: number, height?: number, quality?: number }; + let params: { + code: CreditCard; + width?: number; + height?: number; + quality?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('code' in paramsOrFirst || + 'width' in paramsOrFirst || + 'height' in paramsOrFirst || + 'quality' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + code: CreditCard; + width?: number; + height?: number; + quality?: number; + }; } else { params = { code: paramsOrFirst as CreditCard, width: rest[0] as number, height: rest[1] as number, - quality: rest[2] as number + quality: rest[2] as number, }; } - + const code = params.code; const width = params.width; const height = params.height; const quality = params.quality; - if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } - - const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', encodeURIComponent(String(code))); - const payload: Payload = {}; + const apiPath = '/avatars/credit-cards/{code}'.replace( + '{code}', + encodeURIComponent(String(code)), + ); + const apiPayload: Payload = {}; if (typeof width !== 'undefined') { - payload['width'] = width; + apiPayload['width'] = width; } if (typeof height !== 'undefined') { - payload['height'] = height; + apiPayload['height'] = height; } if (typeof quality !== 'undefined') { - payload['quality'] = quality; + apiPayload['quality'] = quality; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/png', - } + accept: 'image/png', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } /** * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. - * + * * This endpoint does not follow HTTP redirects. * * @param {string} params.url - Website URL which you want to fetch the favicon from. @@ -191,7 +260,7 @@ export class Avatars { getFavicon(params: { url: string }): Promise; /** * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. - * + * * This endpoint does not follow HTTP redirects. * * @param {string} url - Website URL which you want to fetch the favicon from. @@ -200,51 +269,51 @@ export class Avatars { * @deprecated Use the object parameter style method for a better developer experience. */ getFavicon(url: string): Promise; - getFavicon( - paramsOrFirst: { url: string } | string - ): Promise { + getFavicon(paramsOrFirst: { url: string } | string): Promise { let params: { url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { url: string }; } else { params = { - url: paramsOrFirst as string + url: paramsOrFirst as string, }; } - - const url = params.url; + const url = params.url; if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } - const apiPath = '/avatars/favicon'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/*', - } + accept: 'image/*', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } /** * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * + * * * @param {Flag} params.code - Country Code. ISO Alpha-2 country code format. * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -253,12 +322,17 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getFlag(params: { code: Flag, width?: number, height?: number, quality?: number }): Promise; + getFlag(params: { + code: Flag; + width?: number; + height?: number; + quality?: number; + }): Promise; /** * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * + * * * @param {Flag} code - Country Code. ISO Alpha-2 country code format. * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -268,65 +342,91 @@ export class Avatars { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise; getFlag( - paramsOrFirst: { code: Flag, width?: number, height?: number, quality?: number } | Flag, - ...rest: [(number)?, (number)?, (number)?] + code: Flag, + width?: number, + height?: number, + quality?: number, + ): Promise; + getFlag( + paramsOrFirst: + | { code: Flag; width?: number; height?: number; quality?: number } + | Flag, + ...rest: [number?, number?, number?] ): Promise { - let params: { code: Flag, width?: number, height?: number, quality?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { code: Flag, width?: number, height?: number, quality?: number }; + let params: { + code: Flag; + width?: number; + height?: number; + quality?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('code' in paramsOrFirst || + 'width' in paramsOrFirst || + 'height' in paramsOrFirst || + 'quality' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + code: Flag; + width?: number; + height?: number; + quality?: number; + }; } else { params = { code: paramsOrFirst as Flag, width: rest[0] as number, height: rest[1] as number, - quality: rest[2] as number + quality: rest[2] as number, }; } - + const code = params.code; const width = params.width; const height = params.height; const quality = params.quality; - if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } - - const apiPath = '/avatars/flags/{code}'.replace('{code}', encodeURIComponent(String(code))); - const payload: Payload = {}; + const apiPath = '/avatars/flags/{code}'.replace( + '{code}', + encodeURIComponent(String(code)), + ); + const apiPayload: Payload = {}; if (typeof width !== 'undefined') { - payload['width'] = width; + apiPayload['width'] = width; } if (typeof height !== 'undefined') { - payload['height'] = height; + apiPayload['height'] = height; } if (typeof quality !== 'undefined') { - payload['quality'] = quality; + apiPayload['quality'] = quality; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/png', - } + accept: 'image/png', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } /** * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. - * + * * This endpoint does not follow HTTP redirects. * * @param {string} params.url - Image URL which you want to crop. @@ -335,12 +435,16 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getImage(params: { url: string, width?: number, height?: number }): Promise; + getImage(params: { + url: string; + width?: number; + height?: number; + }): Promise; /** * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. - * + * * This endpoint does not follow HTTP redirects. * * @param {string} url - Image URL which you want to crop. @@ -350,65 +454,76 @@ export class Avatars { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getImage(url: string, width?: number, height?: number): Promise; getImage( - paramsOrFirst: { url: string, width?: number, height?: number } | string, - ...rest: [(number)?, (number)?] + url: string, + width?: number, + height?: number, + ): Promise; + getImage( + paramsOrFirst: + { url: string; width?: number; height?: number } | string, + ...rest: [number?, number?] ): Promise { - let params: { url: string, width?: number, height?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string, width?: number, height?: number }; + let params: { url: string; width?: number; height?: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + url: string; + width?: number; + height?: number; + }; } else { params = { url: paramsOrFirst as string, width: rest[0] as number, - height: rest[1] as number + height: rest[1] as number, }; } - + const url = params.url; const width = params.width; const height = params.height; - if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } - const apiPath = '/avatars/image'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof width !== 'undefined') { - payload['width'] = width; + apiPayload['width'] = width; } if (typeof height !== 'undefined') { - payload['height'] = height; + apiPayload['height'] = height; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/*', - } + accept: 'image/*', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } /** * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. - * + * * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * + * * * @param {string} params.name - Full Name. When empty, current user name or email will be used. Max length: 128 chars. * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -417,14 +532,19 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getInitials(params?: { name?: string, width?: number, height?: number, background?: string }): Promise; + getInitials(params?: { + name?: string; + width?: number; + height?: number; + background?: string; + }): Promise; /** * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. - * + * * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. - * + * * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * + * * * @param {string} name - Full Name. When empty, current user name or email will be used. Max length: 128 chars. * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. @@ -434,63 +554,246 @@ export class Avatars { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getInitials(name?: string, width?: number, height?: number, background?: string): Promise; getInitials( - paramsOrFirst?: { name?: string, width?: number, height?: number, background?: string } | string, - ...rest: [(number)?, (number)?, (string)?] + name?: string, + width?: number, + height?: number, + background?: string, + ): Promise; + getInitials( + paramsOrFirst?: + | { + name?: string; + width?: number; + height?: number; + background?: string; + } + | string, + ...rest: [number?, number?, string?] ): Promise { - let params: { name?: string, width?: number, height?: number, background?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name?: string, width?: number, height?: number, background?: string }; + let params: { + name?: string; + width?: number; + height?: number; + background?: string; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + name?: string; + width?: number; + height?: number; + background?: string; + }; } else { params = { name: paramsOrFirst as string, width: rest[0] as number, height: rest[1] as number, - background: rest[2] as string + background: rest[2] as string, }; } - + const name = params.name; const width = params.width; const height = params.height; const background = params.background; - - const apiPath = '/avatars/initials'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof width !== 'undefined') { - payload['width'] = width; + apiPayload['width'] = width; } if (typeof height !== 'undefined') { - payload['height'] = height; + apiPayload['height'] = height; } if (typeof background !== 'undefined') { - payload['background'] = background; + apiPayload['background'] = background; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/png', + accept: 'image/png', + }; + + return this.client.call( + 'get', + uri, + apiHeaders, + apiPayload, + 'arrayBuffer', + ); + } + + /** + * Returns the best available profile photo for a user. The endpoint tries each source in priority order and returns the first successful result: OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in static fallback. + * + * The photo resolves for the currently authenticated user unless `userId` points at another user. Passing `emailHash` and/or `name` resolves the avatar from those values alone: the hash is looked up on Gravatar and Libravatar, the name is rendered as initials, and the user's own identity photos, email, and name leave the chain so they never shadow the avatar being asked for. Emails are only ever accepted pre-hashed, so no address ends up in a URL. + * + * @param {number} params.width - Output image width in pixels. Pass an integer between 0 and 2000. Defaults to 256. + * @param {number} params.height - Output image height in pixels. Pass an integer between 0 and 2000. Defaults to 256. + * @param {number} params.quality - Output image quality between 0 and 100. Defaults to 100. + * @param {string} params.output - Output image format. Defaults to 'png'. + * @param {string} params.rating - Maximum image rating to fetch from Gravatar/Libravatar. Defaults to 'g'. + * @param {string} params.userId - User ID to resolve the photo for. Defaults to 'current()' for the currently authenticated user. + * @param {string} params.emailHash - SHA256 hash of the lowercase, trimmed email address to look up on Gravatar and Libravatar instead of the user's own photo sources. Pass the hash, never the address itself. + * @param {string} params.name - Name to render initials from instead of the user's own photo sources. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPhoto(params?: { + width?: number; + height?: number; + quality?: number; + output?: string; + rating?: string; + userId?: string; + emailHash?: string; + name?: string; + }): Promise; + /** + * Returns the best available profile photo for a user. The endpoint tries each source in priority order and returns the first successful result: OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in static fallback. + * + * The photo resolves for the currently authenticated user unless `userId` points at another user. Passing `emailHash` and/or `name` resolves the avatar from those values alone: the hash is looked up on Gravatar and Libravatar, the name is rendered as initials, and the user's own identity photos, email, and name leave the chain so they never shadow the avatar being asked for. Emails are only ever accepted pre-hashed, so no address ends up in a URL. + * + * @param {number} width - Output image width in pixels. Pass an integer between 0 and 2000. Defaults to 256. + * @param {number} height - Output image height in pixels. Pass an integer between 0 and 2000. Defaults to 256. + * @param {number} quality - Output image quality between 0 and 100. Defaults to 100. + * @param {string} output - Output image format. Defaults to 'png'. + * @param {string} rating - Maximum image rating to fetch from Gravatar/Libravatar. Defaults to 'g'. + * @param {string} userId - User ID to resolve the photo for. Defaults to 'current()' for the currently authenticated user. + * @param {string} emailHash - SHA256 hash of the lowercase, trimmed email address to look up on Gravatar and Libravatar instead of the user's own photo sources. Pass the hash, never the address itself. + * @param {string} name - Name to render initials from instead of the user's own photo sources. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPhoto( + width?: number, + height?: number, + quality?: number, + output?: string, + rating?: string, + userId?: string, + emailHash?: string, + name?: string, + ): Promise; + getPhoto( + paramsOrFirst?: + | { + width?: number; + height?: number; + quality?: number; + output?: string; + rating?: string; + userId?: string; + emailHash?: string; + name?: string; + } + | number, + ...rest: [number?, number?, string?, string?, string?, string?, string?] + ): Promise { + let params: { + width?: number; + height?: number; + quality?: number; + output?: string; + rating?: string; + userId?: string; + emailHash?: string; + name?: string; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + width?: number; + height?: number; + quality?: number; + output?: string; + rating?: string; + userId?: string; + emailHash?: string; + name?: string; + }; + } else { + params = { + width: paramsOrFirst as number, + height: rest[0] as number, + quality: rest[1] as number, + output: rest[2] as string, + rating: rest[3] as string, + userId: rest[4] as string, + emailHash: rest[5] as string, + name: rest[6] as string, + }; } + const width = params.width; + const height = params.height; + const quality = params.quality; + const output = params.output; + const rating = params.rating; + const userId = params.userId; + const emailHash = params.emailHash; + const name = params.name; + const apiPath = '/avatars/photo'; + const apiPayload: Payload = {}; + if (typeof width !== 'undefined') { + apiPayload['width'] = width; + } + if (typeof height !== 'undefined') { + apiPayload['height'] = height; + } + if (typeof quality !== 'undefined') { + apiPayload['quality'] = quality; + } + if (typeof output !== 'undefined') { + apiPayload['output'] = output; + } + if (typeof rating !== 'undefined') { + apiPayload['rating'] = rating; + } + if (typeof userId !== 'undefined') { + apiPayload['userId'] = userId; + } + if (typeof emailHash !== 'undefined') { + apiPayload['emailHash'] = emailHash; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'image/*', + }; + return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } /** * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. - * + * * * @param {string} params.text - Plain text to be converted to QR code image. * @param {number} params.size - QR code size. Pass an integer between 1 to 1000. Defaults to 400. @@ -499,10 +802,15 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getQR(params: { text: string, size?: number, margin?: number, download?: boolean }): Promise; + getQR(params: { + text: string; + size?: number; + margin?: number; + download?: boolean; + }): Promise; /** * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. - * + * * * @param {string} text - Plain text to be converted to QR code image. * @param {number} size - QR code size. Pass an integer between 1 to 1000. Defaults to 400. @@ -512,68 +820,92 @@ export class Avatars { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getQR(text: string, size?: number, margin?: number, download?: boolean): Promise; getQR( - paramsOrFirst: { text: string, size?: number, margin?: number, download?: boolean } | string, - ...rest: [(number)?, (number)?, (boolean)?] + text: string, + size?: number, + margin?: number, + download?: boolean, + ): Promise; + getQR( + paramsOrFirst: + | { + text: string; + size?: number; + margin?: number; + download?: boolean; + } + | string, + ...rest: [number?, number?, boolean?] ): Promise { - let params: { text: string, size?: number, margin?: number, download?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { text: string, size?: number, margin?: number, download?: boolean }; + let params: { + text: string; + size?: number; + margin?: number; + download?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + text: string; + size?: number; + margin?: number; + download?: boolean; + }; } else { params = { text: paramsOrFirst as string, size: rest[0] as number, margin: rest[1] as number, - download: rest[2] as boolean + download: rest[2] as boolean, }; } - + const text = params.text; const size = params.size; const margin = params.margin; const download = params.download; - if (typeof text === 'undefined') { throw new AppwriteException('Missing required parameter: "text"'); } - const apiPath = '/avatars/qr'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof text !== 'undefined') { - payload['text'] = text; + apiPayload['text'] = text; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof margin !== 'undefined') { - payload['margin'] = margin; + apiPayload['margin'] = margin; } if (typeof download !== 'undefined') { - payload['download'] = download; + apiPayload['download'] = download; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/png', - } + accept: 'image/png', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } /** * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. - * + * * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll. - * + * * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. * * @param {string} params.url - Website URL which you want to capture. @@ -599,12 +931,33 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise} */ - getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): Promise; + getScreenshot(params: { + url: string; + headers?: object; + viewportWidth?: number; + viewportHeight?: number; + scale?: number; + theme?: BrowserTheme; + userAgent?: string; + fullpage?: boolean; + locale?: string; + timezone?: Timezone; + latitude?: number; + longitude?: number; + accuracy?: number; + touch?: boolean; + permissions?: BrowserPermission[]; + sleep?: number; + width?: number; + height?: number; + quality?: number; + output?: ImageFormat; + }): Promise; /** * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. - * + * * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll. - * + * * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. * * @param {string} url - Website URL which you want to capture. @@ -631,15 +984,125 @@ export class Avatars { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): Promise; getScreenshot( - paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, - ...rest: [(object)?, (number)?, (number)?, (number)?, (BrowserTheme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] + url: string, + headers?: object, + viewportWidth?: number, + viewportHeight?: number, + scale?: number, + theme?: BrowserTheme, + userAgent?: string, + fullpage?: boolean, + locale?: string, + timezone?: Timezone, + latitude?: number, + longitude?: number, + accuracy?: number, + touch?: boolean, + permissions?: BrowserPermission[], + sleep?: number, + width?: number, + height?: number, + quality?: number, + output?: ImageFormat, + ): Promise; + getScreenshot( + paramsOrFirst: + | { + url: string; + headers?: object; + viewportWidth?: number; + viewportHeight?: number; + scale?: number; + theme?: BrowserTheme; + userAgent?: string; + fullpage?: boolean; + locale?: string; + timezone?: Timezone; + latitude?: number; + longitude?: number; + accuracy?: number; + touch?: boolean; + permissions?: BrowserPermission[]; + sleep?: number; + width?: number; + height?: number; + quality?: number; + output?: ImageFormat; + } + | string, + ...rest: [ + object?, + number?, + number?, + number?, + BrowserTheme?, + string?, + boolean?, + string?, + Timezone?, + number?, + number?, + number?, + boolean?, + BrowserPermission[]?, + number?, + number?, + number?, + number?, + ImageFormat?, + ] ): Promise { - let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; + let params: { + url: string; + headers?: object; + viewportWidth?: number; + viewportHeight?: number; + scale?: number; + theme?: BrowserTheme; + userAgent?: string; + fullpage?: boolean; + locale?: string; + timezone?: Timezone; + latitude?: number; + longitude?: number; + accuracy?: number; + touch?: boolean; + permissions?: BrowserPermission[]; + sleep?: number; + width?: number; + height?: number; + quality?: number; + output?: ImageFormat; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + url: string; + headers?: object; + viewportWidth?: number; + viewportHeight?: number; + scale?: number; + theme?: BrowserTheme; + userAgent?: string; + fullpage?: boolean; + locale?: string; + timezone?: Timezone; + latitude?: number; + longitude?: number; + accuracy?: number; + touch?: boolean; + permissions?: BrowserPermission[]; + sleep?: number; + width?: number; + height?: number; + quality?: number; + output?: ImageFormat; + }; } else { params = { url: paramsOrFirst as string, @@ -661,10 +1124,10 @@ export class Avatars { width: rest[15] as number, height: rest[16] as number, quality: rest[17] as number, - output: rest[18] as ImageFormat + output: rest[18] as ImageFormat, }; } - + const url = params.url; const headers = params.headers; const viewportWidth = params.viewportWidth; @@ -685,86 +1148,84 @@ export class Avatars { const height = params.height; const quality = params.quality; const output = params.output; - if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } - const apiPath = '/avatars/screenshots'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof headers !== 'undefined') { - payload['headers'] = headers; + apiPayload['headers'] = headers; } if (typeof viewportWidth !== 'undefined') { - payload['viewportWidth'] = viewportWidth; + apiPayload['viewportWidth'] = viewportWidth; } if (typeof viewportHeight !== 'undefined') { - payload['viewportHeight'] = viewportHeight; + apiPayload['viewportHeight'] = viewportHeight; } if (typeof scale !== 'undefined') { - payload['scale'] = scale; + apiPayload['scale'] = scale; } if (typeof theme !== 'undefined') { - payload['theme'] = theme; + apiPayload['theme'] = theme; } if (typeof userAgent !== 'undefined') { - payload['userAgent'] = userAgent; + apiPayload['userAgent'] = userAgent; } if (typeof fullpage !== 'undefined') { - payload['fullpage'] = fullpage; + apiPayload['fullpage'] = fullpage; } if (typeof locale !== 'undefined') { - payload['locale'] = locale; + apiPayload['locale'] = locale; } if (typeof timezone !== 'undefined') { - payload['timezone'] = timezone; + apiPayload['timezone'] = timezone; } if (typeof latitude !== 'undefined') { - payload['latitude'] = latitude; + apiPayload['latitude'] = latitude; } if (typeof longitude !== 'undefined') { - payload['longitude'] = longitude; + apiPayload['longitude'] = longitude; } if (typeof accuracy !== 'undefined') { - payload['accuracy'] = accuracy; + apiPayload['accuracy'] = accuracy; } if (typeof touch !== 'undefined') { - payload['touch'] = touch; + apiPayload['touch'] = touch; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof sleep !== 'undefined') { - payload['sleep'] = sleep; + apiPayload['sleep'] = sleep; } if (typeof width !== 'undefined') { - payload['width'] = width; + apiPayload['width'] = width; } if (typeof height !== 'undefined') { - payload['height'] = height; + apiPayload['height'] = height; } if (typeof quality !== 'undefined') { - payload['quality'] = quality; + apiPayload['quality'] = quality; } if (typeof output !== 'undefined') { - payload['output'] = output; + apiPayload['output'] = output; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/png', - } + accept: 'image/png', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } } diff --git a/src/services/backups.ts b/src/services/backups.ts index 7902c67..dad80a1 100644 --- a/src/services/backups.ts +++ b/src/services/backups.ts @@ -1,9 +1,7 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - import { BackupServices } from '../enums/backup-services'; - export class Backups { client: Client; @@ -18,7 +16,9 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - listArchives(params?: { queries?: string[] }): Promise; + listArchives(params?: { + queries?: string[]; + }): Promise; /** * List all archives for a project. * @@ -29,39 +29,37 @@ export class Backups { */ listArchives(queries?: string[]): Promise; listArchives( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[] } | string[], ): Promise { let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { queries?: string[] }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], }; } - - const queries = params.queries; - + const queries = params.queries; const apiPath = '/backups/archives'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -72,7 +70,10 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - createArchive(params: { services: BackupServices[], resourceId?: string }): Promise; + createArchive(params: { + services: BackupServices[]; + resourceId?: string; + }): Promise; /** * Create a new archive asynchronously for a project. * @@ -82,51 +83,59 @@ export class Backups { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createArchive(services: BackupServices[], resourceId?: string): Promise; createArchive( - paramsOrFirst: { services: BackupServices[], resourceId?: string } | BackupServices[], - ...rest: [(string)?] + services: BackupServices[], + resourceId?: string, + ): Promise; + createArchive( + paramsOrFirst: + | { services: BackupServices[]; resourceId?: string } + | BackupServices[], + ...rest: [string?] ): Promise { - 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 }; + 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 + resourceId: rest[0] as string, }; } - + const services = params.services; const resourceId = params.resourceId; - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); + throw new AppwriteException( + 'Missing required parameter: "services"', + ); } - const apiPath = '/backups/archives'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof services !== 'undefined') { - payload['services'] = services; + apiPayload['services'] = services; } if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; + apiPayload['resourceId'] = resourceId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -147,39 +156,41 @@ export class Backups { */ getArchive(archiveId: string): Promise; getArchive( - paramsOrFirst: { archiveId: string } | string + paramsOrFirst: { archiveId: string } | string, ): Promise { let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { archiveId: string }; } else { params = { - archiveId: paramsOrFirst as string + archiveId: paramsOrFirst as string, }; } - - const archiveId = params.archiveId; + const archiveId = params.archiveId; if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); + throw new AppwriteException( + 'Missing required parameter: "archiveId"', + ); } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', encodeURIComponent(String(archiveId))); - const payload: Payload = {}; + const apiPath = '/backups/archives/{archiveId}'.replace( + '{archiveId}', + encodeURIComponent(String(archiveId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -199,41 +210,41 @@ export class Backups { * @deprecated Use the object parameter style method for a better developer experience. */ deleteArchive(archiveId: string): Promise<{}>; - deleteArchive( - paramsOrFirst: { archiveId: string } | string - ): Promise<{}> { + deleteArchive(paramsOrFirst: { archiveId: string } | string): Promise<{}> { let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { archiveId: string }; } else { params = { - archiveId: paramsOrFirst as string + archiveId: paramsOrFirst as string, }; } - - const archiveId = params.archiveId; + const archiveId = params.archiveId; if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); + throw new AppwriteException( + 'Missing required parameter: "archiveId"', + ); } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', encodeURIComponent(String(archiveId))); - const payload: Payload = {}; + const apiPath = '/backups/archives/{archiveId}'.replace( + '{archiveId}', + encodeURIComponent(String(archiveId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -243,7 +254,9 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - listPolicies(params?: { queries?: string[] }): Promise; + listPolicies(params?: { + queries?: string[]; + }): Promise; /** * List all policies for a project. * @@ -254,39 +267,37 @@ export class Backups { */ listPolicies(queries?: string[]): Promise; listPolicies( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[] } | string[], ): Promise { let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { queries?: string[] }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], }; } - - const queries = params.queries; - + const queries = params.queries; const apiPath = '/backups/policies'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -302,7 +313,15 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - createPolicy(params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }): Promise; + createPolicy(params: { + policyId: string; + services: BackupServices[]; + retention: number; + schedule: string; + name?: string; + resourceId?: string; + enabled?: boolean; + }): Promise; /** * Create a new backup policy. * @@ -317,15 +336,60 @@ export class Backups { * @returns {Promise} * @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; createPolicy( - paramsOrFirst: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string, - ...rest: [(BackupServices[])?, (number)?, (string)?, (string)?, (string)?, (boolean)?] + policyId: string, + services: BackupServices[], + retention: number, + schedule: string, + name?: string, + resourceId?: string, + enabled?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -334,10 +398,10 @@ export class Backups { schedule: rest[2] as string, name: rest[3] as string, resourceId: rest[4] as string, - enabled: rest[5] as boolean + enabled: rest[5] as boolean, }; } - + const policyId = params.policyId; const services = params.services; const retention = params.retention; @@ -345,57 +409,58 @@ export class Backups { const name = params.name; const resourceId = params.resourceId; const enabled = params.enabled; - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); } if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); + throw new AppwriteException( + 'Missing required parameter: "services"', + ); } if (typeof retention === 'undefined') { - throw new AppwriteException('Missing required parameter: "retention"'); + throw new AppwriteException( + 'Missing required parameter: "retention"', + ); } if (typeof schedule === 'undefined') { - throw new AppwriteException('Missing required parameter: "schedule"'); + throw new AppwriteException( + 'Missing required parameter: "schedule"', + ); } - const apiPath = '/backups/policies'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof policyId !== 'undefined') { - payload['policyId'] = policyId; + apiPayload['policyId'] = policyId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof services !== 'undefined') { - payload['services'] = services; + apiPayload['services'] = services; } if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; + apiPayload['resourceId'] = resourceId; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof retention !== 'undefined') { - payload['retention'] = retention; + apiPayload['retention'] = retention; } if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; + apiPayload['schedule'] = schedule; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -416,39 +481,41 @@ export class Backups { */ getPolicy(policyId: string): Promise; getPolicy( - paramsOrFirst: { policyId: string } | string + paramsOrFirst: { policyId: string } | string, ): Promise { let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { policyId: string }; } else { params = { - policyId: paramsOrFirst as string + policyId: paramsOrFirst as string, }; } - - const policyId = params.policyId; + const policyId = params.policyId; if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); - const payload: Payload = {}; + const apiPath = '/backups/policies/{policyId}'.replace( + '{policyId}', + encodeURIComponent(String(policyId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -462,7 +529,13 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - updatePolicy(params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }): Promise; + updatePolicy(params: { + policyId: string; + name?: string; + retention?: number; + schedule?: string; + enabled?: boolean; + }): Promise; /** * Update an existing policy using it's ID. * @@ -475,63 +548,91 @@ export class Backups { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise; updatePolicy( - paramsOrFirst: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean } | string, - ...rest: [(string)?, (number)?, (string)?, (boolean)?] + policyId: string, + name?: string, + retention?: number, + schedule?: string, + enabled?: boolean, + ): Promise; + updatePolicy( + paramsOrFirst: + | { + policyId: string; + name?: string; + retention?: number; + schedule?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, number?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); - const payload: Payload = {}; + const apiPath = '/backups/policies/{policyId}'.replace( + '{policyId}', + encodeURIComponent(String(policyId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof retention !== 'undefined') { - payload['retention'] = retention; + apiPayload['retention'] = retention; } if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; + apiPayload['schedule'] = schedule; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -551,54 +652,54 @@ export class Backups { * @deprecated Use the object parameter style method for a better developer experience. */ deletePolicy(policyId: string): Promise<{}>; - deletePolicy( - paramsOrFirst: { policyId: string } | string - ): Promise<{}> { + deletePolicy(paramsOrFirst: { policyId: string } | string): Promise<{}> { let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { policyId: string }; } else { params = { - policyId: paramsOrFirst as string + policyId: paramsOrFirst as string, }; } - - const policyId = params.policyId; + const policyId = params.policyId; if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); - const payload: Payload = {}; + const apiPath = '/backups/policies/{policyId}'.replace( + '{policyId}', + encodeURIComponent(String(policyId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** * Create and trigger a new restoration for a backup on a project. - * + * * For a backup of one database, the restoration resolves its destination before it is queued. When `newResourceId` is omitted, the archived database is restored in place and its own ID is returned in `options`. Pass a different `newResourceId` to restore alongside it as a new database instead. - * + * * The restoration migration records the archived database in `resourceId` and `resourceType`, and the resolved database in `destinationResourceId` and `destinationResourceType`. Database types are stored canonically as `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave these fields empty because they do not have a single source or destination database. - * + * * To list every migration related to one database, use its canonical type in a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and destination relation pairs: `(resourceType, resourceId)`, `(parentResourceType, parentResourceId)`, and `(destinationResourceType, destinationResourceId)`. Legacy and TablesDB databases use `database`; the operational `resourceType` of a table migration is not rewritten to `tablesdb`. - * + * * When restoring a DocumentsDB or VectorsDB database from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification and lands the data there. An in-place restore swaps the database onto that backing only once the restore has succeeded, and retires the backing it displaced only once that swap is confirmed, so the source keeps serving its own data until the restored data is in place and any failure leaves it untouched. A serverless source has no dedicated backing to clone and restores onto the archived database instead. - * + * * * @param {string} params.archiveId - Backup archive ID to restore * @param {BackupServices[]} params.services - Array of services to restore @@ -607,18 +708,23 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise; + createRestoration(params: { + archiveId: string; + services: BackupServices[]; + newResourceId?: string; + newResourceName?: string; + }): Promise; /** * Create and trigger a new restoration for a backup on a project. - * + * * For a backup of one database, the restoration resolves its destination before it is queued. When `newResourceId` is omitted, the archived database is restored in place and its own ID is returned in `options`. Pass a different `newResourceId` to restore alongside it as a new database instead. - * + * * The restoration migration records the archived database in `resourceId` and `resourceType`, and the resolved database in `destinationResourceId` and `destinationResourceType`. Database types are stored canonically as `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave these fields empty because they do not have a single source or destination database. - * + * * To list every migration related to one database, use its canonical type in a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and destination relation pairs: `(resourceType, resourceId)`, `(parentResourceType, parentResourceId)`, and `(destinationResourceType, destinationResourceId)`. Legacy and TablesDB databases use `database`; the operational `resourceType` of a table migration is not rewritten to `tablesdb`. - * + * * When restoring a DocumentsDB or VectorsDB database from a dedicated source, the restore provisions a fresh dedicated backing database at the source database's own specification and lands the data there. An in-place restore swaps the database onto that backing only once the restore has succeeded, and retires the backing it displaced only once that swap is confirmed, so the source keeps serving its own data until the restored data is in place and any failure leaves it untouched. A serverless source has no dedicated backing to clone and restores onto the archived database instead. - * + * * * @param {string} archiveId - Backup archive ID to restore * @param {BackupServices[]} services - Array of services to restore @@ -628,64 +734,87 @@ export class Backups { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise; createRestoration( - paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, - ...rest: [(BackupServices[])?, (string)?, (string)?] + archiveId: string, + services: BackupServices[], + newResourceId?: string, + newResourceName?: string, + ): Promise; + createRestoration( + paramsOrFirst: + | { + archiveId: string; + services: BackupServices[]; + newResourceId?: string; + newResourceName?: string; + } + | string, + ...rest: [BackupServices[]?, string?, string?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "archiveId"', + ); } if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); + throw new AppwriteException( + 'Missing required parameter: "services"', + ); } - const apiPath = '/backups/restoration'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof archiveId !== 'undefined') { - payload['archiveId'] = archiveId; + apiPayload['archiveId'] = archiveId; } if (typeof services !== 'undefined') { - payload['services'] = services; + apiPayload['services'] = services; } if (typeof newResourceId !== 'undefined') { - payload['newResourceId'] = newResourceId; + apiPayload['newResourceId'] = newResourceId; } if (typeof newResourceName !== 'undefined') { - payload['newResourceName'] = newResourceName; + apiPayload['newResourceName'] = newResourceName; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -695,7 +824,9 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - listRestorations(params?: { queries?: string[] }): Promise; + listRestorations(params?: { + queries?: string[]; + }): Promise; /** * List all backup restorations for a project. * @@ -706,39 +837,37 @@ export class Backups { */ listRestorations(queries?: string[]): Promise; listRestorations( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[] } | string[], ): Promise { let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { queries?: string[] }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], }; } - - const queries = params.queries; - + const queries = params.queries; const apiPath = '/backups/restorations'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -748,7 +877,9 @@ export class Backups { * @throws {AppwriteException} * @returns {Promise} */ - getRestoration(params: { restorationId: string }): Promise; + getRestoration(params: { + restorationId: string; + }): Promise; /** * Get the current status of a backup restoration. * @@ -759,38 +890,40 @@ export class Backups { */ getRestoration(restorationId: string): Promise; getRestoration( - paramsOrFirst: { restorationId: string } | string + paramsOrFirst: { restorationId: string } | string, ): Promise { let params: { restorationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { restorationId: string }; } else { params = { - restorationId: paramsOrFirst as string + restorationId: paramsOrFirst as string, }; } - - const restorationId = params.restorationId; + const restorationId = params.restorationId; if (typeof restorationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "restorationId"'); + throw new AppwriteException( + 'Missing required parameter: "restorationId"', + ); } - - const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', encodeURIComponent(String(restorationId))); - const payload: Payload = {}; + const apiPath = '/backups/restorations/{restorationId}'.replace( + '{restorationId}', + encodeURIComponent(String(restorationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } } diff --git a/src/services/databases.ts b/src/services/databases.ts index 6a3ee13..5d06492 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1,12 +1,10 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } 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; @@ -24,7 +22,11 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * @@ -35,57 +37,64 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + list( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/databases'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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. @@ -94,10 +103,14 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise; + create(params: { + databaseId: string; + name: string; + enabled?: boolean; + }): Promise; /** * 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. @@ -106,59 +119,67 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(databaseId: string, name: string, enabled?: boolean): Promise; create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + databaseId: string, + name: string, + enabled?: boolean, + ): Promise; + create( + paramsOrFirst: + { databaseId: string; name: string; enabled?: boolean } | string, + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/databases'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof databaseId !== 'undefined') { - payload['databaseId'] = databaseId; + apiPayload['databaseId'] = databaseId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -169,7 +190,9 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTransactions` instead. */ - listTransactions(params?: { queries?: string[] }): Promise; + listTransactions(params?: { + queries?: string[]; + }): Promise; /** * List transactions across all databases. * @@ -180,39 +203,37 @@ export class Databases { */ listTransactions(queries?: string[]): Promise; listTransactions( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[] } | string[], ): Promise { let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { queries?: string[] }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], }; } - - const queries = params.queries; - + const queries = params.queries; const apiPath = '/databases/transactions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -234,40 +255,38 @@ export class Databases { */ createTransaction(ttl?: number): Promise; createTransaction( - paramsOrFirst?: { ttl?: number } | number + paramsOrFirst?: { ttl?: number } | number, ): Promise { let params: { ttl?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { ttl?: number }; } else { params = { - ttl: paramsOrFirst as number + ttl: paramsOrFirst as number, }; } - - const ttl = params.ttl; - + const ttl = params.ttl; const apiPath = '/databases/transactions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; + apiPayload['ttl'] = ttl; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -278,7 +297,9 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTransaction` instead. */ - getTransaction(params: { transactionId: string }): Promise; + getTransaction(params: { + transactionId: string; + }): Promise; /** * Get a transaction by its unique ID. * @@ -289,39 +310,41 @@ export class Databases { */ getTransaction(transactionId: string): Promise; getTransaction( - paramsOrFirst: { transactionId: string } | string + paramsOrFirst: { transactionId: string } | string, ): Promise { let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { transactionId: string }; } else { params = { - transactionId: paramsOrFirst as string + transactionId: paramsOrFirst as string, }; } - - const transactionId = params.transactionId; + const transactionId = params.transactionId; if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); } - - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + const apiPath = '/databases/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -334,7 +357,11 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTransaction` instead. */ - updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise; + updateTransaction(params: { + transactionId: string; + commit?: boolean; + rollback?: boolean; + }): Promise; /** * Update a transaction, to either commit or roll back its operations. * @@ -345,53 +372,69 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise; updateTransaction( - paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, - ...rest: [(boolean)?, (boolean)?] + transactionId: string, + commit?: boolean, + rollback?: boolean, + ): Promise; + updateTransaction( + paramsOrFirst: + | { transactionId: string; commit?: boolean; rollback?: boolean } + | string, + ...rest: [boolean?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); } - - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + const apiPath = '/databases/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; if (typeof commit !== 'undefined') { - payload['commit'] = commit; + apiPayload['commit'] = commit; } if (typeof rollback !== 'undefined') { - payload['rollback'] = rollback; + apiPayload['rollback'] = rollback; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -413,39 +456,41 @@ export class Databases { */ deleteTransaction(transactionId: string): Promise<{}>; deleteTransaction( - paramsOrFirst: { transactionId: string } | string + paramsOrFirst: { transactionId: string } | string, ): Promise<{}> { let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { transactionId: string }; } else { params = { - transactionId: paramsOrFirst as string + transactionId: paramsOrFirst as string, }; } - - const transactionId = params.transactionId; + const transactionId = params.transactionId; if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); } - - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + const apiPath = '/databases/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -457,7 +502,10 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createOperations` instead. */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise; + createOperations(params: { + transactionId: string; + operations?: object[]; + }): Promise; /** * Create multiple operations in a single transaction. * @@ -467,48 +515,58 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createOperations(transactionId: string, operations?: object[]): Promise; createOperations( - paramsOrFirst: { transactionId: string, operations?: object[] } | string, - ...rest: [(object[])?] + transactionId: string, + operations?: object[], + ): Promise; + createOperations( + paramsOrFirst: + { transactionId: string; operations?: object[] } | string, + ...rest: [object[]?] ): Promise { - let params: { transactionId: string, operations?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; + 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[] + 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 = '/databases/transactions/{transactionId}/operations'.replace('{transactionId}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); + } + const apiPath = + '/databases/transactions/{transactionId}/operations'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; if (typeof operations !== 'undefined') { - payload['operations'] = operations; + apiPayload['operations'] = operations; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -530,39 +588,41 @@ export class Databases { */ get(databaseId: string): Promise; get( - paramsOrFirst: { databaseId: string } | string + paramsOrFirst: { databaseId: string } | string, ): Promise { let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string + databaseId: paramsOrFirst as string, }; } - - const databaseId = params.databaseId; + const databaseId = params.databaseId; if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/databases/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -575,7 +635,11 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. */ - update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise; + update(params: { + databaseId: string; + name?: string; + enabled?: boolean; + }): Promise; /** * Update a database by its unique ID. * @@ -586,53 +650,64 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name?: string, enabled?: boolean): Promise; update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + databaseId: string, + name?: string, + enabled?: boolean, + ): Promise; + update( + paramsOrFirst: + { databaseId: string; name?: string; enabled?: boolean } | string, + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/databases/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -653,40 +728,40 @@ export class Databases { * @deprecated Use the object parameter style method for a better developer experience. */ delete(databaseId: string): Promise<{}>; - delete( - paramsOrFirst: { databaseId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { databaseId: string } | string): Promise<{}> { let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string + databaseId: paramsOrFirst as string, }; } - - const databaseId = params.databaseId; + const databaseId = params.databaseId; if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/databases/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -700,7 +775,12 @@ export class Databases { * @returns {Promise} * @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; + listCollections(params: { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -712,57 +792,81 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listCollections(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise; listCollections( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + databaseId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listCollections( + paramsOrFirst: + | { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/databases/{databaseId}/collections'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -780,7 +884,16 @@ export class Databases { * @returns {Promise} * @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; + createCollection(params: { + databaseId: string; + collectionId: string; + name: string; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + attributes?: object[]; + indexes?: object[]; + }): Promise; /** * 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. * @@ -796,15 +909,65 @@ export class Databases { * @returns {Promise} * @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; 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[])?] + databaseId: string, + collectionId: string, + name: string, + permissions?: string[], + documentSecurity?: boolean, + enabled?: boolean, + attributes?: object[], + indexes?: object[], + ): Promise; + 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 { - 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[] }; + 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, @@ -814,10 +977,10 @@ export class Databases { documentSecurity: rest[3] as boolean, enabled: rest[4] as boolean, attributes: rest[5] as object[], - indexes: rest[6] as object[] + indexes: rest[6] as object[], }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const name = params.name; @@ -826,54 +989,54 @@ export class Databases { const enabled = params.enabled; const attributes = params.attributes; const indexes = params.indexes; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/databases/{databaseId}/collections'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof collectionId !== 'undefined') { - payload['collectionId'] = collectionId; + apiPayload['collectionId'] = collectionId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof documentSecurity !== 'undefined') { - payload['documentSecurity'] = documentSecurity; + apiPayload['documentSecurity'] = documentSecurity; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof attributes !== 'undefined') { - payload['attributes'] = attributes; + apiPayload['attributes'] = attributes; } if (typeof indexes !== 'undefined') { - payload['indexes'] = indexes; + apiPayload['indexes'] = indexes; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -885,7 +1048,10 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. */ - getCollection(params: { databaseId: string, collectionId: string }): Promise; + getCollection(params: { + databaseId: string; + collectionId: string; + }): Promise; /** * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. * @@ -895,47 +1061,59 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getCollection(databaseId: string, collectionId: string): Promise; getCollection( - paramsOrFirst: { databaseId: string, collectionId: string } | string, - ...rest: [(string)?] + databaseId: string, + collectionId: string, + ): Promise; + getCollection( + 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 }; + 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 + collectionId: rest[0] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -952,7 +1130,15 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. */ - updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise; + updateCollection(params: { + databaseId: string; + collectionId: string; + name?: string; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + purge?: boolean; + }): Promise; /** * Update a collection by its unique ID. * @@ -967,15 +1153,53 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise; updateCollection( - paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] + databaseId: string, + collectionId: string, + name?: string, + permissions?: string[], + documentSecurity?: boolean, + enabled?: boolean, + purge?: boolean, + ): Promise; + updateCollection( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + name?: string; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + purge?: boolean; + } + | string, + ...rest: [string?, string?, string[]?, boolean?, boolean?, boolean?] ): Promise { - let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, 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 }; + 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, @@ -984,10 +1208,10 @@ export class Databases { permissions: rest[2] as string[], documentSecurity: rest[3] as boolean, enabled: rest[4] as boolean, - purge: rest[5] as boolean + purge: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const name = params.name; @@ -995,45 +1219,47 @@ export class Databases { const documentSecurity = params.documentSecurity; const enabled = params.enabled; const purge = params.purge; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof documentSecurity !== 'undefined') { - payload['documentSecurity'] = documentSecurity; + apiPayload['documentSecurity'] = documentSecurity; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof purge !== 'undefined') { - payload['purge'] = purge; + apiPayload['purge'] = purge; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1045,7 +1271,10 @@ 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(params: { + databaseId: string; + collectionId: string; + }): Promise<{}>; /** * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. * @@ -1057,45 +1286,54 @@ export class Databases { */ deleteCollection(databaseId: string, collectionId: string): Promise<{}>; deleteCollection( - paramsOrFirst: { databaseId: string, collectionId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + collectionId: rest[0] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1109,7 +1347,12 @@ export class Databases { * @returns {Promise} * @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; + listAttributes(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List attributes in the collection. * @@ -1121,62 +1364,91 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listAttributes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise; listAttributes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] + databaseId: string, + collectionId: string, + queries?: string[], + total?: boolean, + ): Promise; + listAttributes( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + } + | string, + ...rest: [string?, string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Create a bigint attribute. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. @@ -1190,10 +1462,19 @@ export class Databases { * @returns {Promise} * @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; + createBigIntAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + min?: number | bigint; + max?: number | bigint; + xdefault?: number | bigint; + array?: boolean; + }): Promise; /** * Create a bigint attribute. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -1207,15 +1488,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + min?: number | bigint, + max?: number | bigint, + xdefault?: number | bigint, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1225,10 +1556,10 @@ export class Databases { min: rest[3] as number | bigint, max: rest[4] as number | bigint, xdefault: rest[5] as number | bigint, - array: rest[6] as boolean + array: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -1237,59 +1568,64 @@ export class Databases { const max = params.max; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -1303,10 +1639,19 @@ export class Databases { * @returns {Promise} * @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; + updateBigIntAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number | bigint; + min?: number | bigint; + max?: number | bigint; + newKey?: string; + }): Promise; /** * Update a bigint attribute. Changing the `default` value will not update already existing documents. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -1320,15 +1665,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: number | bigint, + min?: number | bigint, + max?: number | bigint, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -1338,10 +1733,10 @@ export class Databases { xdefault: rest[3] as number | bigint, min: rest[4] as number | bigint, max: rest[5] as number | bigint, - newKey: rest[6] as string + newKey: rest[6] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -1350,59 +1745,67 @@ export class Databases { const min = params.min; const max = params.max; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -1414,10 +1817,17 @@ export class Databases { * @returns {Promise} * @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; + createBooleanAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: boolean; + array?: boolean; + }): Promise; /** * 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). @@ -1429,15 +1839,49 @@ export class Databases { * @returns {Promise} * @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; createBooleanAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: boolean, + array?: boolean, + ): Promise; + createBooleanAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: boolean; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, boolean?, boolean?] ): Promise { - 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 }; + 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, @@ -1445,58 +1889,63 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as boolean, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1512,7 +1961,14 @@ export class Databases { * @returns {Promise} * @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; + updateBooleanAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: boolean; + newKey?: string; + }): Promise; /** * Update a boolean attribute. Changing the `default` value will not update already existing documents. * @@ -1526,15 +1982,49 @@ export class Databases { * @returns {Promise} * @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; updateBooleanAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: boolean, + newKey?: string, + ): Promise; + updateBooleanAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: boolean; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, boolean?, string?] ): Promise { - 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 }; + 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, @@ -1542,58 +2032,66 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as boolean, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1609,7 +2107,14 @@ export class Databases { * @returns {Promise} * @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; + createDatetimeAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create a date time attribute according to the ISO 8601 standard. * @@ -1623,15 +2128,49 @@ export class Databases { * @returns {Promise} * @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; createDatetimeAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createDatetimeAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -1639,58 +2178,63 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1706,7 +2250,14 @@ export class Databases { * @returns {Promise} * @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; + updateDatetimeAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update a date time attribute. Changing the `default` value will not update already existing documents. * @@ -1720,15 +2271,49 @@ export class Databases { * @returns {Promise} * @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; updateDatetimeAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateDatetimeAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -1736,63 +2321,71 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create an email attribute. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. @@ -1804,10 +2397,17 @@ export class Databases { * @returns {Promise} * @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; + createEmailAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create an email attribute. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -1819,15 +2419,49 @@ export class Databases { * @returns {Promise} * @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; createEmailAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createEmailAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -1835,63 +2469,68 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/email' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -1903,10 +2542,17 @@ export class Databases { * @returns {Promise} * @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; + updateEmailAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an email attribute. Changing the `default` value will not update already existing documents. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -1918,15 +2564,49 @@ export class Databases { * @returns {Promise} * @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; updateEmailAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateEmailAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -1934,63 +2614,71 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. - * + * 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. @@ -2003,10 +2691,18 @@ export class Databases { * @returns {Promise} * @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; + createEnumAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + elements: string[]; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. - * + * 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. @@ -2019,15 +2715,53 @@ export class Databases { * @returns {Promise} * @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; createEnumAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + elements: string[], + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2036,10 +2770,10 @@ export class Databases { elements: rest[2] as string[], required: rest[3] as boolean, xdefault: rest[4] as string, - array: rest[5] as boolean + array: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -2047,59 +2781,66 @@ export class Databases { const required = params.required; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/enum' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof elements !== 'undefined') { - payload['elements'] = elements; + apiPayload['elements'] = elements; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -2112,10 +2853,18 @@ export class Databases { * @returns {Promise} * @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; + updateEnumAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + elements: string[]; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an enum attribute. Changing the `default` value will not update already existing documents. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -2128,15 +2877,53 @@ export class Databases { * @returns {Promise} * @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; updateEnumAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + elements: string[], + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2145,10 +2932,10 @@ export class Databases { elements: rest[2] as string[], required: rest[3] as boolean, xdefault: rest[4] as string, - newKey: rest[5] as string + newKey: rest[5] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -2156,59 +2943,69 @@ export class Databases { const required = params.required; const xdefault = params.xdefault; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "elements"', + ); } if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof elements !== 'undefined') { - payload['elements'] = elements; + apiPayload['elements'] = elements; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create a float attribute. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. @@ -2222,10 +3019,19 @@ export class Databases { * @returns {Promise} * @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; + createFloatAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + min?: number; + max?: number; + xdefault?: number; + array?: boolean; + }): Promise; /** * Create a float attribute. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -2239,15 +3045,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + min?: number, + max?: number, + xdefault?: number, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2257,10 +3113,10 @@ export class Databases { min: rest[3] as number, max: rest[4] as number, xdefault: rest[5] as number, - array: rest[6] as boolean + array: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -2269,59 +3125,64 @@ export class Databases { const max = params.max; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/float' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -2335,10 +3196,19 @@ export class Databases { * @returns {Promise} * @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; + updateFloatAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number; + min?: number; + max?: number; + newKey?: string; + }): Promise; /** * Update a float attribute. Changing the `default` value will not update already existing documents. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -2352,15 +3222,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: number, + min?: number, + max?: number, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2370,10 +3290,10 @@ export class Databases { xdefault: rest[3] as number, min: rest[4] as number, max: rest[5] as number, - newKey: rest[6] as string + newKey: rest[6] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -2382,59 +3302,67 @@ export class Databases { const min = params.min; const max = params.max; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create an integer attribute. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. @@ -2448,10 +3376,19 @@ export class Databases { * @returns {Promise} * @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; + createIntegerAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + min?: number | bigint; + max?: number | bigint; + xdefault?: number | bigint; + array?: boolean; + }): Promise; /** * Create an integer attribute. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -2465,15 +3402,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + min?: number | bigint, + max?: number | bigint, + xdefault?: number | bigint, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2483,10 +3470,10 @@ export class Databases { min: rest[3] as number | bigint, max: rest[4] as number | bigint, xdefault: rest[5] as number | bigint, - array: rest[6] as boolean + array: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -2495,59 +3482,64 @@ export class Databases { const max = params.max; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/integer' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -2561,10 +3553,19 @@ export class Databases { * @returns {Promise} * @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; + updateIntegerAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number | bigint; + min?: number | bigint; + max?: number | bigint; + newKey?: string; + }): Promise; /** * Update an integer attribute. Changing the `default` value will not update already existing documents. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -2578,15 +3579,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: number | bigint, + min?: number | bigint, + max?: number | bigint, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2596,10 +3647,10 @@ export class Databases { xdefault: rest[3] as number | bigint, min: rest[4] as number | bigint, max: rest[5] as number | bigint, - newKey: rest[6] as string + newKey: rest[6] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -2608,59 +3659,67 @@ export class Databases { const min = params.min; const max = params.max; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create IP address attribute. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. @@ -2672,10 +3731,17 @@ export class Databases { * @returns {Promise} * @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; + createIpAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create IP address attribute. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -2687,15 +3753,49 @@ export class Databases { * @returns {Promise} * @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; createIpAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createIpAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -2703,63 +3803,68 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/ip' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -2771,10 +3876,17 @@ export class Databases { * @returns {Promise} * @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; + updateIpAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an ip attribute. Changing the `default` value will not update already existing documents. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -2786,15 +3898,49 @@ export class Databases { * @returns {Promise} * @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; updateIpAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateIpAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -2802,58 +3948,66 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2868,7 +4022,13 @@ export class Databases { * @returns {Promise} * @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; + createLineAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + }): Promise; /** * Create a geometric line attribute. * @@ -2881,69 +4041,104 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: any[][], + ): Promise; + createLineAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?] ): Promise { - 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[][] }; + 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[][] + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/line' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2959,7 +4154,14 @@ export class Databases { * @returns {Promise} * @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; + updateLineAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + }): Promise; /** * Update a line attribute. Changing the `default` value will not update already existing documents. * @@ -2973,15 +4175,49 @@ export class Databases { * @returns {Promise} * @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; updateLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: any[][], + newKey?: string, + ): Promise; + updateLineAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?, string?] ): Promise { - 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 }; + 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, @@ -2989,60 +4225,66 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as any[][], - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -3055,10 +4297,18 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLongtextColumn` instead. */ - createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createLongtextAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -3071,15 +4321,53 @@ export class Databases { * @returns {Promise} * @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; createLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -3088,10 +4376,10 @@ export class Databases { required: rest[2] as boolean, xdefault: rest[3] as string, array: rest[4] as boolean, - encrypt: rest[5] as boolean + encrypt: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -3099,56 +4387,61 @@ export class Databases { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/longtext' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -3160,10 +4453,17 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLongtextColumn` instead. */ - updateLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateLongtextAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * 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). @@ -3175,15 +4475,49 @@ export class Databases { * @returns {Promise} * @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; updateLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateLongtextAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -3191,63 +4525,71 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -3260,10 +4602,18 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createMediumtextColumn` instead. */ - createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createMediumtextAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -3276,15 +4626,53 @@ export class Databases { * @returns {Promise} * @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; createMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -3293,10 +4681,10 @@ export class Databases { required: rest[2] as boolean, xdefault: rest[3] as string, array: rest[4] as boolean, - encrypt: rest[5] as boolean + encrypt: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -3304,56 +4692,61 @@ export class Databases { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -3365,10 +4758,17 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateMediumtextColumn` instead. */ - updateMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateMediumtextAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * 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). @@ -3380,15 +4780,49 @@ export class Databases { * @returns {Promise} * @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; updateMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateMediumtextAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -3396,58 +4830,66 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3462,7 +4904,13 @@ export class Databases { * @returns {Promise} * @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?: number[] }): Promise; + createPointAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + }): Promise; /** * Create a geometric point attribute. * @@ -3475,69 +4923,104 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[]): Promise; createPointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number[])?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: number[], + ): Promise; + createPointAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + } + | string, + ...rest: [string?, string?, boolean?, number[]?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[] }; + let params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + }; } 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[] + xdefault: rest[3] as number[], }; } - + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/point' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3553,7 +5036,14 @@ export class Databases { * @returns {Promise} * @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?: number[], newKey?: string }): Promise; + updatePointAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + }): Promise; /** * Update a point attribute. Changing the `default` value will not update already existing documents. * @@ -3567,15 +5057,49 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], newKey?: string): Promise; updatePointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number[])?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: number[], + newKey?: string, + ): Promise; + updatePointAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, number[]?, string?] ): Promise { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number[], newKey?: string }; + let params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -3583,55 +5107,61 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as number[], - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3646,7 +5176,13 @@ export class Databases { * @returns {Promise} * @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; + createPolygonAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + }): Promise; /** * Create a geometric polygon attribute. * @@ -3659,69 +5195,104 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createPolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: any[][], + ): Promise; + createPolygonAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?] ): Promise { - 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[][] }; + 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[][] + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/polygon' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3737,7 +5308,14 @@ export class Databases { * @returns {Promise} * @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; + updatePolygonAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + }): Promise; /** * Update a polygon attribute. Changing the `default` value will not update already existing documents. * @@ -3751,15 +5329,49 @@ export class Databases { * @returns {Promise} * @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; updatePolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: any[][], + newKey?: string, + ): Promise; + updatePolygonAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?, string?] ): Promise { - 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 }; + 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, @@ -3767,60 +5379,66 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as any[][], - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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. @@ -3834,10 +5452,19 @@ export class Databases { * @returns {Promise} * @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; + createRelationshipAttribute(params: { + databaseId: string; + collectionId: string; + relatedCollectionId: string; + type: RelationshipType; + twoWay?: boolean; + key?: string; + twoWayKey?: string; + onDelete?: RelationMutate; + }): Promise; /** * 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. @@ -3851,15 +5478,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + relatedCollectionId: string, + type: RelationshipType, + twoWay?: boolean, + key?: string, + twoWayKey?: string, + onDelete?: RelationMutate, + ): Promise; + 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 { - 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 }; + 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, @@ -3869,10 +5546,10 @@ export class Databases { twoWay: rest[3] as boolean, key: rest[4] as string, twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate + onDelete: rest[6] as RelationMutate, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const relatedCollectionId = params.relatedCollectionId; @@ -3881,59 +5558,64 @@ export class Databases { const key = params.key; const twoWayKey = params.twoWayKey; const onDelete = params.onDelete; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof relatedCollectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof relatedCollectionId !== 'undefined') { - payload['relatedCollectionId'] = relatedCollectionId; + apiPayload['relatedCollectionId'] = relatedCollectionId; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; + apiPayload['twoWay'] = twoWay; } if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; + apiPayload['twoWayKey'] = twoWayKey; } if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; + apiPayload['onDelete'] = onDelete; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -3944,10 +5626,16 @@ export class Databases { * @returns {Promise} * @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; + updateRelationshipAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + onDelete?: RelationMutate; + newKey?: string; + }): Promise; /** * 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. @@ -3958,68 +5646,102 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; updateRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + onDelete?: RelationMutate, + newKey?: string, + ): Promise; + updateRelationshipAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + onDelete?: RelationMutate; + newKey?: string; + } + | string, + ...rest: [string?, string?, RelationMutate?, string?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; + apiPayload['onDelete'] = onDelete; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -4033,10 +5755,19 @@ export class Databases { * @returns {Promise} * @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; + createStringAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + size: number; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -4050,15 +5781,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + size: number, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -4068,10 +5849,10 @@ export class Databases { required: rest[3] as boolean, xdefault: rest[4] as string, array: rest[5] as boolean, - encrypt: rest[6] as boolean + encrypt: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -4080,12 +5861,15 @@ export class Databases { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -4094,48 +5878,50 @@ export class Databases { 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/string' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -4148,10 +5934,18 @@ export class Databases { * @returns {Promise} * @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; + updateStringAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + size?: number; + newKey?: string; + }): Promise; /** * 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). @@ -4164,15 +5958,53 @@ export class Databases { * @returns {Promise} * @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; updateStringAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + size?: number, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -4181,10 +6013,10 @@ export class Databases { required: rest[2] as boolean, xdefault: rest[3] as string, size: rest[4] as number, - newKey: rest[5] as string + newKey: rest[5] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -4192,56 +6024,64 @@ export class Databases { const xdefault = params.xdefault; const size = params.size; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -4254,10 +6094,18 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTextColumn` instead. */ - createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createTextAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -4270,15 +6118,53 @@ export class Databases { * @returns {Promise} * @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; createTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -4287,10 +6173,10 @@ export class Databases { required: rest[2] as boolean, xdefault: rest[3] as string, array: rest[4] as boolean, - encrypt: rest[5] as boolean + encrypt: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -4298,56 +6184,61 @@ export class Databases { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/text' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -4359,10 +6250,17 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. */ - updateTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateTextAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * 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). @@ -4374,15 +6272,49 @@ export class Databases { * @returns {Promise} * @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; updateTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateTextAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -4390,63 +6322,71 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create a URL attribute. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.collectionId - Collection ID. @@ -4458,10 +6398,17 @@ export class Databases { * @returns {Promise} * @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; + createUrlAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create a URL attribute. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -4473,15 +6420,49 @@ export class Databases { * @returns {Promise} * @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; createUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createUrlAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -4489,63 +6470,68 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/url' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -4557,10 +6543,17 @@ export class Databases { * @returns {Promise} * @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; + updateUrlAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an url attribute. Changing the `default` value will not update already existing documents. - * + * * * @param {string} databaseId - Database ID. * @param {string} collectionId - Collection ID. @@ -4572,15 +6565,49 @@ export class Databases { * @returns {Promise} * @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; updateUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateUrlAttribute( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -4588,63 +6615,71 @@ export class Databases { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -4658,10 +6693,19 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createVarcharColumn` instead. */ - createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createVarcharAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + size: number; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -4675,15 +6719,65 @@ export class Databases { * @returns {Promise} * @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; 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)?] + databaseId: string, + collectionId: string, + key: string, + size: number, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -4693,10 +6787,10 @@ export class Databases { required: rest[3] as boolean, xdefault: rest[4] as string, array: rest[5] as boolean, - encrypt: rest[6] as boolean + encrypt: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -4705,12 +6799,15 @@ export class Databases { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -4719,48 +6816,50 @@ export class Databases { 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/varchar' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -4773,10 +6872,18 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateVarcharColumn` instead. */ - updateVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + updateVarcharAttribute(params: { + databaseId: string; + collectionId: string; + key: string; + required: boolean; + xdefault?: string; + size?: number; + newKey?: string; + }): Promise; /** * 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). @@ -4789,15 +6896,53 @@ export class Databases { * @returns {Promise} * @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; updateVarcharAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + required: boolean, + xdefault?: string, + size?: number, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -4806,10 +6951,10 @@ export class Databases { required: rest[2] as boolean, xdefault: rest[3] as string, size: rest[4] as number, - newKey: rest[5] as string + newKey: rest[5] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -4817,51 +6962,59 @@ export class Databases { const xdefault = params.xdefault; const size = params.size; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4874,7 +7027,22 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. */ - getAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise; + 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. * @@ -4885,52 +7053,91 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getAttribute(databaseId: string, collectionId: string, key: string): Promise; getAttribute( - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -4943,7 +7150,11 @@ 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(params: { + databaseId: string; + collectionId: string; + key: string; + }): Promise<{}>; /** * Deletes an attribute. * @@ -4954,52 +7165,69 @@ 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( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -5015,7 +7243,16 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; + listDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + }): Promise>; /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -5029,15 +7266,49 @@ export class Databases { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] + databaseId: string, + collectionId: string, + queries?: string[], + transactionId?: string, + total?: boolean, + ttl?: number, + ): Promise>; + listDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + } + | string, + ...rest: [string?, string[]?, string?, boolean?, number?] ): Promise> { - 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 }; + 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, @@ -5045,51 +7316,54 @@ export class Databases { queries: rest[1] as string[], transactionId: rest[2] as string, total: rest[3] as boolean, - ttl: rest[4] as number + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; + apiPayload['ttl'] = ttl; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5105,7 +7379,18 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. */ - createDocument(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string }): Promise; + createDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & Omit; + permissions?: string[]; + transactionId?: string; + }): Promise; /** * 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. * @@ -5119,74 +7404,136 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDocument(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string): Promise; createDocument( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit)?, (string[])?, (string)?] + databaseId: string, + collectionId: string, + documentId: string, + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & Omit, + permissions?: string[], + transactionId?: string, + ): Promise; + createDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit)?, + string[]?, + string?, + ] ): Promise { - let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial & Record : Partial & Omit, 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 & Record : Partial & Omit, permissions?: string[], transactionId?: string }; + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + 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 & Record + : Partial & + Omit; + 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 & Record : Partial & Omit, + data: rest[2] as Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit, permissions: rest[3] as string[], - transactionId: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof documentId !== 'undefined') { - payload['documentId'] = documentId; + apiPayload['documentId'] = documentId; } if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -5200,7 +7547,14 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead. */ - createDocuments(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise>; + createDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + }): Promise>; /** * 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. * @@ -5212,66 +7566,97 @@ export class Databases { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createDocuments(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise>; createDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] + databaseId: string, + collectionId: string, + documents: object[], + transactionId?: string, + ): Promise>; + createDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + } + | string, + ...rest: [string?, object[]?, string?] ): Promise> { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "documents"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof documents !== 'undefined') { - payload['documents'] = documents; + apiPayload['documents'] = documents; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -5281,10 +7666,17 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. */ - upsertDocuments(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise>; + upsertDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + }): Promise>; /** * 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. @@ -5294,61 +7686,92 @@ export class Databases { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertDocuments(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise>; upsertDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] + databaseId: string, + collectionId: string, + documents: object[], + transactionId?: string, + ): Promise>; + upsertDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + } + | string, + ...rest: [string?, object[]?, string?] ): Promise> { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "documents"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof documents !== 'undefined') { - payload['documents'] = documents; + apiPayload['documents'] = documents; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -5363,7 +7786,15 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. */ - updateDocuments(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise>; + updateDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + data?: object; + queries?: string[]; + transactionId?: string; + }): Promise>; /** * 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. * @@ -5376,63 +7807,96 @@ export class Databases { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDocuments(databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise>; updateDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (object)?, (string[])?, (string)?] + databaseId: string, + collectionId: string, + data?: object, + queries?: string[], + transactionId?: string, + ): Promise>; + updateDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + data?: object; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, object?, string[]?, string?] ): Promise> { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5446,7 +7910,14 @@ export class Databases { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. */ - deleteDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise>; + deleteDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + }): Promise>; /** * Bulk delete documents using queries, if no queries are passed then all documents are deleted. * @@ -5458,58 +7929,87 @@ export class Databases { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise>; deleteDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] + databaseId: string, + collectionId: string, + queries?: string[], + transactionId?: string, + ): Promise>; + deleteDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string[]?, string?] ): Promise> { - 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, queries?: string[], transactionId?: string }; + 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; + queries?: string[]; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, queries: rest[1] as string[], - transactionId: rest[2] as string + transactionId: rest[2] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const queries = params.queries; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -5524,7 +8024,15 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead. */ - getDocument(params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }): Promise; + getDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }): Promise; /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * @@ -5537,62 +8045,101 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string): Promise; getDocument( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?] + databaseId: string, + collectionId: string, + documentId: string, + queries?: string[], + transactionId?: string, + ): Promise; + getDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string[]?, string?] ): Promise { - let params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }; + let params: { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, documentId: rest[1] as string, queries: rest[2] as string[], - transactionId: rest[3] as string + transactionId: rest[3] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const documentId = params.documentId; const queries = params.queries; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5608,7 +8155,19 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead. */ - upsertDocument(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + upsertDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; /** * Create or update a 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. * @@ -5622,68 +8181,135 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertDocument(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string): Promise; upsertDocument( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>)?, (string[])?, (string)?] + databaseId: string, + collectionId: string, + documentId: string, + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + upsertDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>)?, + string[]?, + string?, + ] ): Promise { - let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, 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 & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record : Partial & Partial>, + data: rest[2] as Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, permissions: rest[3] as string[], - transactionId: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -5699,7 +8325,19 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead. */ - updateDocument(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + updateDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; /** * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -5713,68 +8351,135 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string): Promise; updateDocument( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>)?, (string[])?, (string)?] + databaseId: string, + collectionId: string, + documentId: string, + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + updateDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>)?, + string[]?, + string?, + ] ): Promise { - let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>, 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 & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record : Partial & Partial>, + data: rest[2] as Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, permissions: rest[3] as string[], - transactionId: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5788,7 +8493,12 @@ export class Databases { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead. */ - deleteDocument(params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }): Promise<{}>; + deleteDocument(params: { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }): Promise<{}>; /** * Delete a document by its unique ID. * @@ -5800,57 +8510,92 @@ export class Databases { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteDocument(databaseId: string, collectionId: string, documentId: string, transactionId?: string): Promise<{}>; deleteDocument( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + databaseId: string, + collectionId: string, + documentId: string, + transactionId?: string, + ): Promise<{}>; + deleteDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?] ): Promise<{}> { - let params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, transactionId?: string }; + let params: { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, documentId: rest[1] as string, - transactionId: rest[2] as string + transactionId: rest[2] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const documentId = params.documentId; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -5867,7 +8612,17 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead. */ - decrementDocumentAttribute(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }): Promise; + decrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + }): Promise; /** * Decrement a specific attribute of a document by a given value. * @@ -5882,15 +8637,57 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - decrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string): Promise; - decrementDocumentAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + decrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + databaseId: string, + collectionId: string, + documentId: string, + attribute: string, + value?: number, + min?: number, + transactionId?: string, + ): Promise; + decrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?, number?, number?, string?] ): Promise { - let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }; + let params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -5899,10 +8696,10 @@ export class Databases { attribute: rest[2] as string, value: rest[3] as number, min: rest[4] as number, - transactionId: rest[5] as string + transactionId: rest[5] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const documentId = params.documentId; @@ -5910,45 +8707,54 @@ export class Databases { const value = params.value; const min = params.min; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); } if (typeof attribute === 'undefined') { - throw new AppwriteException('Missing required parameter: "attribute"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))).replace('{attribute}', encodeURIComponent(String(attribute))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "attribute"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{documentId}', encodeURIComponent(String(documentId))) + .replace('{attribute}', encodeURIComponent(String(attribute))); + const apiPayload: Payload = {}; if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5965,7 +8771,17 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead. */ - incrementDocumentAttribute(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }): Promise; + incrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + }): Promise; /** * Increment a specific attribute of a document by a given value. * @@ -5980,15 +8796,57 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - incrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string): Promise; - incrementDocumentAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + incrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + databaseId: string, + collectionId: string, + documentId: string, + attribute: string, + value?: number, + max?: number, + transactionId?: string, + ): Promise; + incrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?, number?, number?, string?] ): Promise { - let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }; + let params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -5997,10 +8855,10 @@ export class Databases { attribute: rest[2] as string, value: rest[3] as number, max: rest[4] as number, - transactionId: rest[5] as string + transactionId: rest[5] as string, }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const documentId = params.documentId; @@ -6008,45 +8866,54 @@ export class Databases { const value = params.value; const max = params.max; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); } if (typeof attribute === 'undefined') { - throw new AppwriteException('Missing required parameter: "attribute"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{documentId}', encodeURIComponent(String(documentId))).replace('{attribute}', encodeURIComponent(String(attribute))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "attribute"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{documentId}', encodeURIComponent(String(documentId))) + .replace('{attribute}', encodeURIComponent(String(attribute))); + const apiPayload: Payload = {}; if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6060,7 +8927,12 @@ export class Databases { * @returns {Promise} * @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; + listIndexes(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List indexes in the collection. * @@ -6072,57 +8944,86 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIndexes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise; listIndexes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] + databaseId: string, + collectionId: string, + queries?: string[], + total?: boolean, + ): Promise; + listIndexes( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + } + | string, + ...rest: [string?, string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -6140,7 +9041,15 @@ export class Databases { * @returns {Promise} * @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; + createIndex(params: { + databaseId: string; + collectionId: string; + key: string; + type: DatabasesIndexType; + attributes: string[]; + orders?: OrderBy[]; + lengths?: number[]; + }): Promise; /** * 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`. @@ -6156,15 +9065,60 @@ export class Databases { * @returns {Promise} * @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; createIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (DatabasesIndexType)?, (string[])?, (OrderBy[])?, (number[])?] + databaseId: string, + collectionId: string, + key: string, + type: DatabasesIndexType, + attributes: string[], + orders?: OrderBy[], + lengths?: number[], + ): Promise; + 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 { - 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[] }; + 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, @@ -6173,10 +9127,10 @@ export class Databases { type: rest[2] as DatabasesIndexType, attributes: rest[3] as string[], orders: rest[4] as OrderBy[], - lengths: rest[5] as number[] + lengths: rest[5] as number[], }; } - + const databaseId = params.databaseId; const collectionId = params.collectionId; const key = params.key; @@ -6184,12 +9138,15 @@ export class Databases { const attributes = params.attributes; const orders = params.orders; const lengths = params.lengths; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + throw new AppwriteException( + 'Missing required parameter: "collectionId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -6198,40 +9155,42 @@ export class Databases { 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "attributes"', + ); + } + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof attributes !== 'undefined') { - payload['attributes'] = attributes; + apiPayload['attributes'] = attributes; } if (typeof orders !== 'undefined') { - payload['orders'] = orders; + apiPayload['orders'] = orders; } if (typeof lengths !== 'undefined') { - payload['lengths'] = lengths; + apiPayload['lengths'] = lengths; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -6244,7 +9203,11 @@ export class Databases { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. */ - getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise; + getIndex(params: { + databaseId: string; + collectionId: string; + key: string; + }): Promise; /** * Get an index by its unique ID. * @@ -6255,52 +9218,69 @@ export class Databases { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getIndex(databaseId: string, collectionId: string, key: string): Promise; getIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] + databaseId: string, + collectionId: string, + key: string, + ): Promise; + getIndex( + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -6313,7 +9293,11 @@ 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(params: { + databaseId: string; + collectionId: string; + key: string; + }): Promise<{}>; /** * Delete an index. * @@ -6324,51 +9308,68 @@ 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( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{collectionId}', encodeURIComponent(String(collectionId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/documents-db.ts b/src/services/documents-db.ts new file mode 100644 index 0000000..3e5525b --- /dev/null +++ b/src/services/documents-db.ts @@ -0,0 +1,3809 @@ +import { AppwriteException, Client, type Payload } from '../client'; +import type { Models } from '../models'; + +import { DocumentsDBIndexType } from '../enums/documents-db-index-type'; +import { OrderBy } from '../enums/order-by'; +export class DocumentsDB { + client: Client; + + 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 {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { + queries?: string[]; + total?: boolean; + }): Promise; + /** + * 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 {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise; + list( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] + ): Promise { + let params: { queries?: string[]; total?: boolean }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + queries?: string[]; + total?: boolean; + }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean, + }; + } + + const queries = params.queries; + const total = params.total; + const apiPath = '/documentsdb'; + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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. + * @param {string} params.specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }): Promise; + /** + * 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. + * @param {string} specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create( + databaseId: string, + name: string, + enabled?: boolean, + specification?: string, + replicas?: number, + syncMode?: string, + ): Promise; + create( + paramsOrFirst: + | { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + } + | string, + ...rest: [string?, boolean?, string?, number?, string?] + ): Promise { + let params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/documentsdb'; + const apiPayload: Payload = {}; + if (typeof databaseId !== 'undefined') { + apiPayload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listSpecifications(): Promise { + const apiPath = '/documentsdb/specifications'; + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * List transactions across all databases. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @throws {AppwriteException} + * @returns {Promise} + */ + listTransactions(params?: { + queries?: string[]; + }): Promise; + /** + * List transactions across all databases. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTransactions(queries?: string[]): Promise; + listTransactions( + paramsOrFirst?: { queries?: string[] } | string[], + ): Promise { + let params: { queries?: string[] }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[], + }; + } + + const queries = params.queries; + const apiPath = '/documentsdb/transactions'; + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a new transaction. + * + * @param {number} params.ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise} + */ + createTransaction(params?: { ttl?: number }): Promise; + /** + * Create a new transaction. + * + * @param {number} ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTransaction(ttl?: number): Promise; + createTransaction( + paramsOrFirst?: { ttl?: number } | number, + ): Promise { + let params: { ttl?: number }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { ttl?: number }; + } else { + params = { + ttl: paramsOrFirst as number, + }; + } + + const ttl = params.ttl; + const apiPath = '/documentsdb/transactions'; + const apiPayload: Payload = {}; + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get a transaction by its unique ID. + * + * @param {string} params.transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getTransaction(params: { + transactionId: string; + }): Promise; + /** + * Get 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. + */ + getTransaction(transactionId: string): Promise; + getTransaction( + 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 = '/documentsdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} params.transactionId - Transaction ID. + * @param {boolean} params.commit - Commit transaction? + * @param {boolean} params.rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise} + */ + updateTransaction(params: { + transactionId: string; + commit?: boolean; + rollback?: boolean; + }): Promise; + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} transactionId - Transaction ID. + * @param {boolean} commit - Commit transaction? + * @param {boolean} rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTransaction( + transactionId: string, + commit?: boolean, + rollback?: boolean, + ): Promise; + updateTransaction( + paramsOrFirst: + | { transactionId: string; commit?: boolean; rollback?: boolean } + | string, + ...rest: [boolean?, boolean?] + ): Promise { + 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 = '/documentsdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + if (typeof commit !== 'undefined') { + apiPayload['commit'] = commit; + } + if (typeof rollback !== 'undefined') { + apiPayload['rollback'] = rollback; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * 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 = '/documentsdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + createOperations(params: { + transactionId: string; + operations?: object[]; + }): Promise; + /** + * Create multiple operations in a single transaction. + * + * @param {string} transactionId - Transaction ID. + * @param {object[]} operations - Array of staged operations. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createOperations( + transactionId: string, + operations?: object[], + ): Promise; + createOperations( + paramsOrFirst: + { transactionId: string; operations?: object[] } | string, + ...rest: [object[]?] + ): Promise { + 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 = + '/documentsdb/transactions/{transactionId}/operations'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + if (typeof operations !== 'undefined') { + apiPayload['operations'] = operations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + get(params: { databaseId: string }): Promise; + /** + * 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise; + get( + 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 = '/documentsdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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. + * @param {string} params.specification - Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. + * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }): Promise; + /** + * 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. + * @param {string} specification - Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. + * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update( + databaseId: string, + name: string, + enabled?: boolean, + specification?: string, + replicas?: number, + syncMode?: string, + ): Promise; + update( + paramsOrFirst: + | { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + } + | string, + ...rest: [string?, boolean?, string?, number?, string?] + ): Promise { + let params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/documentsdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * 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 = '/documentsdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * 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. + * @throws {AppwriteException} + * @returns {Promise} + */ + listCollections(params: { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; + /** + * 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[]} 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. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listCollections( + databaseId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listCollections( + paramsOrFirst: + | { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] + ): Promise { + 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 = '/documentsdb/{databaseId}/collections'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof search !== 'undefined') { + apiPayload['search'] = search; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), 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} + */ + createCollection(params: { + databaseId: string; + collectionId: string; + name: string; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + attributes?: object[]; + indexes?: object[]; + }): Promise; + /** + * 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#documentsDBCreateCollection) 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, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), 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} + * @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; + 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 { + 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 = '/documentsdb/{databaseId}/collections'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof collectionId !== 'undefined') { + apiPayload['collectionId'] = collectionId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + apiPayload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + if (typeof attributes !== 'undefined') { + apiPayload['attributes'] = attributes; + } + if (typeof indexes !== 'undefined') { + apiPayload['indexes'] = indexes; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + getCollection(params: { + databaseId: string; + collectionId: string; + }): Promise; + /** + * 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getCollection( + databaseId: string, + collectionId: string, + ): Promise; + getCollection( + 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 = '/documentsdb/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + updateCollection(params: { + databaseId: string; + collectionId: string; + name: string; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + purge?: boolean; + }): Promise; + /** + * 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} + * @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; + 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 { + 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"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/documentsdb/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + apiPayload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + if (typeof purge !== 'undefined') { + apiPayload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * 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<{}>} + */ + 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 = '/documentsdb/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * 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 cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + */ + listDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + }): Promise>; + /** + * 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 cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDocuments( + databaseId: string, + collectionId: string, + queries?: string[], + transactionId?: string, + total?: boolean, + ttl?: number, + ): Promise>; + listDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + } + | string, + ...rest: [string?, string[]?, string?, boolean?, number?] + ): Promise> { + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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 & Record : Partial & Omit} 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). + * @throws {AppwriteException} + * @returns {Promise} + */ + createDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & Omit; + permissions?: string[]; + }): Promise; + /** + * 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#documentsDBCreateCollection) 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 & Record : Partial & Omit} 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). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocument( + databaseId: string, + collectionId: string, + documentId: string, + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & Omit, + permissions?: string[], + ): Promise; + createDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + permissions?: string[]; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit)?, + string[]?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + permissions?: string[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + permissions?: 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 & Record + : Partial & + Omit, + permissions: rest[3] as string[], + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof documentId !== 'undefined') { + apiPayload['documentId'] = documentId; + } + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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. + * @throws {AppwriteException} + * @returns {Promise>} + */ + createDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documents: object[]; + }): Promise>; + /** + * 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#documentsDBCreateCollection) 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. + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocuments( + databaseId: string, + collectionId: string, + documents: object[], + ): Promise>; + createDocuments( + paramsOrFirst: + | { databaseId: string; collectionId: string; documents: object[] } + | string, + ...rest: [string?, object[]?] + ): Promise> { + let params: { + databaseId: string; + collectionId: string; + documents: object[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documents: object[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documents: rest[1] as object[], + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documents = params.documents; + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof documents !== 'undefined') { + apiPayload['documents'] = documents; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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>} + */ + upsertDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + }): Promise>; + /** + * 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#documentsDBCreateCollection) 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>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertDocuments( + databaseId: string, + collectionId: string, + documents: object[], + transactionId?: string, + ): Promise>; + upsertDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + } + | string, + ...rest: [string?, object[]?, string?] + ): Promise> { + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof documents !== 'undefined') { + apiPayload['documents'] = documents; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * 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>} + */ + updateDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + data?: object; + queries?: string[]; + transactionId?: string; + }): Promise>; + /** + * 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>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDocuments( + databaseId: string, + collectionId: string, + data?: object, + queries?: string[], + transactionId?: string, + ): Promise>; + updateDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + data?: object; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, object?, string[]?, string?] + ): Promise> { + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * 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>} + */ + deleteDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + }): Promise>; + /** + * 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). + * @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>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDocuments( + databaseId: string, + collectionId: string, + queries?: string[], + transactionId?: string, + ): Promise>; + deleteDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string[]?, string?] + ): Promise> { + 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; + queries?: string[]; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + * + * @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.documentId - Document ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }): Promise; + /** + * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + * + * @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} documentId - Document ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDocument( + databaseId: string, + collectionId: string, + documentId: string, + queries?: string[], + transactionId?: string, + ): Promise; + getDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string[]?, string?] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + queries: rest[2] as string[], + transactionId: rest[3] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + 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"', + ); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); + } + const apiPath = + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} params.data - Document data as JSON object. Include all required fields of the document to be created or updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + */ + upsertDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; + /** + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} data - Document data as JSON object. Include all required fields of the document to be created or updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertDocument( + databaseId: string, + collectionId: string, + documentId: string, + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + upsertDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>)?, + string[]?, + string?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>, + 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"', + ); + } + const apiPath = + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} params.data - Document data as JSON object. Include only fields and value pairs to be updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} data - Document data as JSON object. Include only fields and value pairs to be updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDocument( + databaseId: string, + collectionId: string, + documentId: string, + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + updateDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>)?, + string[]?, + string?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>, + 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"', + ); + } + const apiPath = + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a document 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.documentId - Document ID. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDocument(params: { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }): Promise<{}>; + /** + * Delete a document 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} documentId - Document ID. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDocument( + databaseId: string, + collectionId: string, + documentId: string, + transactionId?: string, + ): Promise<{}>; + deleteDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?] + ): Promise<{}> { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + transactionId: rest[2] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + 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"', + ); + } + const apiPath = + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Decrement a specific column of a row by a given value. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {string} params.attribute - Attribute key. + * @param {number} params.value - Value to decrement the attribute by. The value must be a number. + * @param {number} params.min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + */ + decrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + }): Promise; + /** + * Decrement a specific column of a row by a given value. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {string} attribute - Attribute key. + * @param {number} value - Value to decrement the attribute by. The value must be a number. + * @param {number} min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + decrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + databaseId: string, + collectionId: string, + documentId: string, + attribute: string, + value?: number, + min?: number, + transactionId?: string, + ): Promise; + decrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?, number?, number?, string?] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + min?: number; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + attribute: rest[2] as string, + value: rest[3] as number, + min: rest[4] as number, + transactionId: rest[5] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const attribute = params.attribute; + const value = params.value; + const min = params.min; + 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 attribute === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "attribute"', + ); + } + const apiPath = + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{documentId}', encodeURIComponent(String(documentId))) + .replace('{attribute}', encodeURIComponent(String(attribute))); + const apiPayload: Payload = {}; + if (typeof value !== 'undefined') { + apiPayload['value'] = value; + } + if (typeof min !== 'undefined') { + apiPayload['min'] = min; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Increment a specific column of a row by a given value. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {string} params.attribute - Attribute key. + * @param {number} params.value - Value to increment the attribute by. The value must be a number. + * @param {number} params.max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + */ + incrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + }): Promise; + /** + * Increment a specific column of a row by a given value. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {string} attribute - Attribute key. + * @param {number} value - Value to increment the attribute by. The value must be a number. + * @param {number} max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + incrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + databaseId: string, + collectionId: string, + documentId: string, + attribute: string, + value?: number, + max?: number, + transactionId?: string, + ): Promise; + incrementDocumentAttribute< + Document extends Models.Document = Models.DefaultDocument, + >( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?, number?, number?, string?] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + attribute: string; + value?: number; + max?: number; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + attribute: rest[2] as string, + value: rest[3] as number, + max: rest[4] as number, + transactionId: rest[5] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const attribute = params.attribute; + const value = params.value; + const max = params.max; + 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 attribute === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "attribute"', + ); + } + const apiPath = + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{documentId}', encodeURIComponent(String(documentId))) + .replace('{attribute}', encodeURIComponent(String(attribute))); + const apiPayload: Payload = {}; + if (typeof value !== 'undefined') { + apiPayload['value'] = value; + } + if (typeof max !== 'undefined') { + apiPayload['max'] = max; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + listIndexes(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + }): Promise; + /** + * 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIndexes( + databaseId: string, + collectionId: string, + queries?: string[], + total?: boolean, + ): Promise; + listIndexes( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + } + | string, + ...rest: [string?, string[]?, boolean?] + ): Promise { + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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 {DocumentsDBIndexType} 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} + */ + createIndex(params: { + databaseId: string; + collectionId: string; + key: string; + type: DocumentsDBIndexType; + attributes: string[]; + orders?: OrderBy[]; + lengths?: number[]; + }): Promise; + /** + * 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 {DocumentsDBIndexType} 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIndex( + databaseId: string, + collectionId: string, + key: string, + type: DocumentsDBIndexType, + attributes: string[], + orders?: OrderBy[], + lengths?: number[], + ): Promise; + createIndex( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + type: DocumentsDBIndexType; + attributes: string[]; + orders?: OrderBy[]; + lengths?: number[]; + } + | string, + ...rest: [ + string?, + string?, + DocumentsDBIndexType?, + string[]?, + OrderBy[]?, + number[]?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + key: string; + type: DocumentsDBIndexType; + attributes: string[]; + orders?: OrderBy[]; + lengths?: number[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + key: string; + type: DocumentsDBIndexType; + 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 DocumentsDBIndexType, + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof key !== 'undefined') { + apiPayload['key'] = key; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof attributes !== 'undefined') { + apiPayload['attributes'] = attributes; + } + if (typeof orders !== 'undefined') { + apiPayload['orders'] = orders; + } + if (typeof lengths !== 'undefined') { + apiPayload['lengths'] = lengths; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get index by 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} + */ + getIndex(params: { + databaseId: string; + collectionId: string; + key: string; + }): Promise; + /** + * Get index by 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getIndex( + databaseId: string, + collectionId: string, + key: string, + ): Promise; + getIndex( + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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<{}>} + */ + 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 = + '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + */ + createFailover(params: { + databaseId: string; + targetReplicaId?: string; + }): Promise; + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} databaseId - Database ID. + * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFailover( + databaseId: string, + targetReplicaId?: string, + ): Promise; + createFailover( + paramsOrFirst: + { databaseId: string; targetReplicaId?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetReplicaId?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetReplicaId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetReplicaId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetReplicaId = params.targetReplicaId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/documentsdb/{databaseId}/failovers'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetReplicaId !== 'undefined') { + apiPayload['targetReplicaId'] = targetReplicaId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by operation status. + * @param {number} params.limit - Maximum number of operations to return. + * @param {number} params.offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listOperations(params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by operation status. + * @param {number} limit - Maximum number of operations to return. + * @param {number} offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOperations( + databaseId: string, + status?: string, + limit?: number, + offset?: number, + ): Promise; + listOperations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + limit: rest[1] as number, + offset: rest[2] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/documentsdb/{databaseId}/operations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReplicas(params: { + databaseId: string; + }): Promise; + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReplicas(databaseId: string): Promise; + getReplicas( + 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 = '/documentsdb/{databaseId}/replicas'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getStatus(params: { databaseId: string }): Promise; + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getStatus(databaseId: string): Promise; + getStatus( + 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 = '/documentsdb/{databaseId}/status'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } +} diff --git a/src/services/embeddings.ts b/src/services/embeddings.ts index 0a38c3a..ff08ad9 100644 --- a/src/services/embeddings.ts +++ b/src/services/embeddings.ts @@ -1,9 +1,7 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - import { EmbeddingModel } from '../enums/embedding-model'; - export class Embeddings { client: Client; @@ -13,17 +11,20 @@ export class Embeddings { /** * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. - * + * * * @param {string[]} params.texts - Array of text to generate embeddings. * @param {EmbeddingModel} params.model - The embedding model to use for generating vector embeddings. * @throws {AppwriteException} * @returns {Promise} */ - createTextEmbeddings(params: { texts: string[], model?: EmbeddingModel }): Promise; + createTextEmbeddings(params: { + texts: string[]; + model?: EmbeddingModel; + }): Promise; /** * Generate vector embeddings for an array of text using the selected embedding model. Use the returned vectors to power semantic search and similarity queries against your vector collections. - * + * * * @param {string[]} texts - Array of text to generate embeddings. * @param {EmbeddingModel} model - The embedding model to use for generating vector embeddings. @@ -31,50 +32,53 @@ export class Embeddings { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createTextEmbeddings(texts: string[], model?: EmbeddingModel): Promise; createTextEmbeddings( - paramsOrFirst: { texts: string[], model?: EmbeddingModel } | string[], - ...rest: [(EmbeddingModel)?] + texts: string[], + model?: EmbeddingModel, + ): Promise; + createTextEmbeddings( + paramsOrFirst: { texts: string[]; model?: EmbeddingModel } | string[], + ...rest: [EmbeddingModel?] ): Promise { - let params: { texts: string[], model?: EmbeddingModel }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { texts: string[], model?: EmbeddingModel }; + let params: { texts: string[]; model?: EmbeddingModel }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + texts: string[]; + model?: EmbeddingModel; + }; } else { params = { texts: paramsOrFirst as string[], - model: rest[0] as EmbeddingModel + model: rest[0] as EmbeddingModel, }; } - + const texts = params.texts; const model = params.model; - if (typeof texts === 'undefined') { throw new AppwriteException('Missing required parameter: "texts"'); } - const apiPath = '/embeddings/text'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof texts !== 'undefined') { - payload['texts'] = texts; + apiPayload['texts'] = texts; } if (typeof model !== 'undefined') { - payload['model'] = model; + apiPayload['model'] = model; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } } diff --git a/src/services/functions.ts b/src/services/functions.ts index 66c218f..612fd14 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1,6 +1,10 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { + AppwriteException, + Client, + type Payload, + UploadProgress, +} from '../client'; import type { Models } from '../models'; - import { InputFile } from '../inputFile'; import { Runtime } from '../enums/runtime'; @@ -9,7 +13,6 @@ 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 { client: Client; @@ -26,7 +29,11 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all the project's functions. You can use the query params to filter your results. * @@ -37,52 +44,59 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + list( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/functions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -113,7 +127,30 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + create(params: { + functionId: string; + name: string; + runtime: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + }): Promise; /** * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * @@ -143,15 +180,135 @@ export class Functions { * @returns {Promise} * @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?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; create( - paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + functionId: string, + name: string, + runtime: Runtime, + execute?: string[], + events?: string[], + schedule?: string, + timeout?: number, + enabled?: boolean, + logging?: boolean, + entrypoint?: string, + commands?: string, + scopes?: ProjectKeyScopes[], + installationId?: string, + providerRepositoryId?: string, + providerBranch?: string, + providerSilentMode?: boolean, + providerRootDirectory?: string, + providerBranches?: string[], + providerPaths?: string[], + buildSpecification?: string, + runtimeSpecification?: string, + deploymentRetention?: number, + ): Promise; + create( + paramsOrFirst: + | { + functionId: string; + name: string; + runtime: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + } + | string, + ...rest: [ + string?, + Runtime?, + string[]?, + string[]?, + string?, + number?, + boolean?, + boolean?, + string?, + string?, + ProjectKeyScopes[]?, + string?, + string?, + string?, + boolean?, + string?, + string[]?, + string[]?, + string?, + string?, + number?, + ] ): Promise { - let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { + functionId: string; + name: string; + runtime: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + functionId: string; + name: string; + runtime: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + }; } else { params = { functionId: paramsOrFirst as string, @@ -175,10 +332,10 @@ export class Functions { providerPaths: rest[17] as string[], buildSpecification: rest[18] as string, runtimeSpecification: rest[19] as string, - deploymentRetention: rest[20] as number + deploymentRetention: rest[20] as number, }; } - + const functionId = params.functionId; const name = params.name; const runtime = params.runtime; @@ -201,99 +358,96 @@ export class Functions { const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "runtime"', + ); } - const apiPath = '/functions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof functionId !== 'undefined') { - payload['functionId'] = functionId; + apiPayload['functionId'] = functionId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof runtime !== 'undefined') { - payload['runtime'] = runtime; + apiPayload['runtime'] = runtime; } if (typeof execute !== 'undefined') { - payload['execute'] = execute; + apiPayload['execute'] = execute; } if (typeof events !== 'undefined') { - payload['events'] = events; + apiPayload['events'] = events; } if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; + apiPayload['schedule'] = schedule; } if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; + apiPayload['timeout'] = timeout; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof logging !== 'undefined') { - payload['logging'] = logging; + apiPayload['logging'] = logging; } if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; + apiPayload['entrypoint'] = entrypoint; } if (typeof commands !== 'undefined') { - payload['commands'] = commands; + apiPayload['commands'] = commands; } if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; + apiPayload['installationId'] = installationId; } if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; + apiPayload['providerRepositoryId'] = providerRepositoryId; } if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; + apiPayload['providerBranch'] = providerBranch; } if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; + apiPayload['providerSilentMode'] = providerSilentMode; } if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; + apiPayload['providerRootDirectory'] = providerRootDirectory; } if (typeof providerBranches !== 'undefined') { - payload['providerBranches'] = providerBranches; + apiPayload['providerBranches'] = providerBranches; } if (typeof providerPaths !== 'undefined') { - payload['providerPaths'] = providerPaths; + apiPayload['providerPaths'] = providerPaths; } if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; + apiPayload['buildSpecification'] = buildSpecification; } if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; + apiPayload['runtimeSpecification'] = runtimeSpecification; } if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; + apiPayload['deploymentRetention'] = deploymentRetention; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -303,22 +457,16 @@ export class Functions { * @returns {Promise} */ listRuntimes(): Promise { - const apiPath = '/functions/runtimes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -328,7 +476,9 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listSpecifications(params?: { type?: string }): Promise; + listSpecifications(params?: { + type?: string; + }): Promise; /** * List allowed function specifications for this instance. * @@ -339,39 +489,37 @@ export class Functions { */ listSpecifications(type?: string): Promise; listSpecifications( - paramsOrFirst?: { type?: string } | string + paramsOrFirst?: { type?: string } | string, ): Promise { let params: { type?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { type?: string }; } else { params = { - type: paramsOrFirst as string + type: paramsOrFirst as string, }; } - - const type = params.type; - + const type = params.type; const apiPath = '/functions/specifications'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -392,39 +540,41 @@ export class Functions { */ get(functionId: string): Promise; get( - paramsOrFirst: { functionId: string } | string + paramsOrFirst: { functionId: string } | string, ): Promise { let params: { functionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { functionId: string }; } else { params = { - functionId: paramsOrFirst as string + functionId: paramsOrFirst as string, }; } - - const functionId = params.functionId; + const functionId = params.functionId; if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -455,7 +605,30 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + update(params: { + functionId: string; + name: string; + runtime?: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + }): Promise; /** * Update function by its unique ID. * @@ -485,15 +658,135 @@ export class Functions { * @returns {Promise} * @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?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; update( - paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + functionId: string, + name: string, + runtime?: Runtime, + execute?: string[], + events?: string[], + schedule?: string, + timeout?: number, + enabled?: boolean, + logging?: boolean, + entrypoint?: string, + commands?: string, + scopes?: ProjectKeyScopes[], + installationId?: string, + providerRepositoryId?: string, + providerBranch?: string, + providerSilentMode?: boolean, + providerRootDirectory?: string, + providerBranches?: string[], + providerPaths?: string[], + buildSpecification?: string, + runtimeSpecification?: string, + deploymentRetention?: number, + ): Promise; + update( + paramsOrFirst: + | { + functionId: string; + name: string; + runtime?: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + } + | string, + ...rest: [ + string?, + Runtime?, + string[]?, + string[]?, + string?, + number?, + boolean?, + boolean?, + string?, + string?, + ProjectKeyScopes[]?, + string?, + string?, + string?, + boolean?, + string?, + string[]?, + string[]?, + string?, + string?, + number?, + ] ): Promise { - let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { + functionId: string; + name: string; + runtime?: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + functionId: string; + name: string; + runtime?: Runtime; + execute?: string[]; + events?: string[]; + schedule?: string; + timeout?: number; + enabled?: boolean; + logging?: boolean; + entrypoint?: string; + commands?: string; + scopes?: ProjectKeyScopes[]; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + }; } else { params = { functionId: paramsOrFirst as string, @@ -517,10 +810,10 @@ export class Functions { providerPaths: rest[17] as string[], buildSpecification: rest[18] as string, runtimeSpecification: rest[19] as string, - deploymentRetention: rest[20] as number + deploymentRetention: rest[20] as number, }; } - + const functionId = params.functionId; const name = params.name; const runtime = params.runtime; @@ -543,93 +836,91 @@ export class Functions { const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof runtime !== 'undefined') { - payload['runtime'] = runtime; + apiPayload['runtime'] = runtime; } if (typeof execute !== 'undefined') { - payload['execute'] = execute; + apiPayload['execute'] = execute; } if (typeof events !== 'undefined') { - payload['events'] = events; + apiPayload['events'] = events; } if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; + apiPayload['schedule'] = schedule; } if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; + apiPayload['timeout'] = timeout; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof logging !== 'undefined') { - payload['logging'] = logging; + apiPayload['logging'] = logging; } if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; + apiPayload['entrypoint'] = entrypoint; } if (typeof commands !== 'undefined') { - payload['commands'] = commands; + apiPayload['commands'] = commands; } if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; + apiPayload['installationId'] = installationId; } if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; + apiPayload['providerRepositoryId'] = providerRepositoryId; } if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; + apiPayload['providerBranch'] = providerBranch; } if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; + apiPayload['providerSilentMode'] = providerSilentMode; } if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; + apiPayload['providerRootDirectory'] = providerRootDirectory; } if (typeof providerBranches !== 'undefined') { - payload['providerBranches'] = providerBranches; + apiPayload['providerBranches'] = providerBranches; } if (typeof providerPaths !== 'undefined') { - payload['providerPaths'] = providerPaths; + apiPayload['providerPaths'] = providerPaths; } if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; + apiPayload['buildSpecification'] = buildSpecification; } if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; + apiPayload['runtimeSpecification'] = runtimeSpecification; } if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; + apiPayload['deploymentRetention'] = deploymentRetention; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -649,40 +940,40 @@ export class Functions { * @deprecated Use the object parameter style method for a better developer experience. */ delete(functionId: string): Promise<{}>; - delete( - paramsOrFirst: { functionId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { functionId: string } | string): Promise<{}> { let params: { functionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { functionId: string }; } else { params = { - functionId: paramsOrFirst as string + functionId: paramsOrFirst as string, }; } - - const functionId = params.functionId; + const functionId = params.functionId; if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -693,7 +984,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - updateFunctionDeployment(params: { functionId: string, deploymentId: string }): Promise; + updateFunctionDeployment(params: { + functionId: string; + deploymentId: string; + }): Promise; /** * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. * @@ -703,51 +997,61 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFunctionDeployment(functionId: string, deploymentId: string): Promise; updateFunctionDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] + functionId: string, + deploymentId: string, + ): Promise; + updateFunctionDeployment( + 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 }; + 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 + deploymentId: rest[0] as string, }; } - + const functionId = params.functionId; const deploymentId = params.deploymentId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); } - - const apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/deployment'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; + apiPayload['deploymentId'] = deploymentId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -760,7 +1064,12 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listDeployments(params: { + functionId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all the function's code deployments. You can use the query params to filter your results. * @@ -772,64 +1081,88 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise; listDeployments( - paramsOrFirst: { functionId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + functionId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listDeployments( + paramsOrFirst: + | { + functionId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } - - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/deployments'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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. @@ -840,12 +1173,19 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(params: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise; + createDeployment(params: { + functionId: string; + code: File | InputFile; + activate: boolean; + entrypoint?: string; + commands?: string; + onProgress?: (progress: UploadProgress) => void; + }): Promise; /** * 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. @@ -857,72 +1197,117 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDeployment(functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise; createDeployment( - paramsOrFirst: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File | InputFile)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] + functionId: string, + code: File | InputFile, + activate: boolean, + entrypoint?: string, + commands?: string, + onProgress?: (progress: UploadProgress) => void, + ): Promise; + createDeployment( + paramsOrFirst: + | { + functionId: string; + code: File | InputFile; + activate: boolean; + entrypoint?: string; + commands?: string; + onProgress?: (progress: UploadProgress) => void; + } + | string, + ...rest: [ + (File | InputFile)?, + boolean?, + string?, + string?, + ((progress: UploadProgress) => void)?, + ] ): Promise { - let params: { functionId: string, code: File | InputFile, 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 | InputFile, activate: boolean, entrypoint?: string, commands?: string }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + let params: { + functionId: string; + code: File | InputFile; + 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 | InputFile; + activate: boolean; + entrypoint?: string; + commands?: string; + }; + onProgress = paramsOrFirst?.onProgress as ( + progress: UploadProgress, + ) => void; } else { params = { functionId: paramsOrFirst as string, code: rest[0] as File | InputFile, activate: rest[1] as boolean, entrypoint: rest[2] as string, - commands: rest[3] as string + commands: rest[3] as string, }; - onProgress = rest[4] as ((progress: UploadProgress) => void); + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "activate"', + ); } - - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/deployments'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; + apiPayload['entrypoint'] = entrypoint; } if (typeof commands !== 'undefined') { - payload['commands'] = commands; + apiPayload['commands'] = commands; } if (typeof code !== 'undefined') { - payload['code'] = code; + apiPayload['code'] = code; } if (typeof activate !== 'undefined') { - payload['activate'] = activate; + apiPayload['activate'] = activate; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', - 'accept': 'application/json', - } + accept: 'application/json', + }; return this.client.chunkedUpload( 'post', uri, apiHeaders, - payload, - onProgress + apiPayload, + onProgress, ); } @@ -935,7 +1320,11 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createDuplicateDeployment(params: { functionId: string, deploymentId: string, buildId?: string }): Promise; + createDuplicateDeployment(params: { + functionId: string; + deploymentId: string; + buildId?: string; + }): Promise; /** * 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. * @@ -946,61 +1335,79 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise; createDuplicateDeployment( - paramsOrFirst: { functionId: string, deploymentId: string, buildId?: string } | string, - ...rest: [(string)?, (string)?] + functionId: string, + deploymentId: string, + buildId?: string, + ): Promise; + createDuplicateDeployment( + paramsOrFirst: + | { functionId: string; deploymentId: string; buildId?: string } + | string, + ...rest: [string?, string?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); } - - const apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/deployments/duplicate'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; + apiPayload['deploymentId'] = deploymentId; } if (typeof buildId !== 'undefined') { - payload['buildId'] = buildId; + apiPayload['buildId'] = buildId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -1013,10 +1420,18 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createTemplateDeployment(params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise; + createTemplateDeployment(params: { + functionId: string; + repository: string; + owner: string; + rootDirectory: string; + type: TemplateReferenceType; + reference: string; + activate?: boolean; + }): Promise; /** * 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. @@ -1030,15 +1445,60 @@ export class Functions { * @returns {Promise} * @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; createTemplateDeployment( - paramsOrFirst: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] + functionId: string, + repository: string, + owner: string, + rootDirectory: string, + type: TemplateReferenceType, + reference: string, + activate?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1047,10 +1507,10 @@ export class Functions { rootDirectory: rest[2] as string, type: rest[3] as TemplateReferenceType, reference: rest[4] as string, - activate: rest[5] as boolean + activate: rest[5] as boolean, }; } - + const functionId = params.functionId; const repository = params.repository; const owner = params.owner; @@ -1058,65 +1518,69 @@ export class Functions { const type = params.type; const reference = params.reference; const activate = params.activate; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } if (typeof repository === 'undefined') { - throw new AppwriteException('Missing required parameter: "repository"'); + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "reference"', + ); } - - const apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/deployments/template'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof repository !== 'undefined') { - payload['repository'] = repository; + apiPayload['repository'] = repository; } if (typeof owner !== 'undefined') { - payload['owner'] = owner; + apiPayload['owner'] = owner; } if (typeof rootDirectory !== 'undefined') { - payload['rootDirectory'] = rootDirectory; + apiPayload['rootDirectory'] = rootDirectory; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof reference !== 'undefined') { - payload['reference'] = reference; + apiPayload['reference'] = reference; } if (typeof activate !== 'undefined') { - payload['activate'] = activate; + apiPayload['activate'] = activate; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -1126,10 +1590,15 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createVcsDeployment(params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise; + createVcsDeployment(params: { + functionId: string; + type: VCSReferenceType; + reference: string; + activate?: boolean; + }): Promise; /** * 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. @@ -1140,64 +1609,90 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createVcsDeployment(functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise; createVcsDeployment( - paramsOrFirst: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] + functionId: string, + type: VCSReferenceType, + reference: string, + activate?: boolean, + ): Promise; + createVcsDeployment( + paramsOrFirst: + | { + functionId: string; + type: VCSReferenceType; + reference: string; + activate?: boolean; + } + | string, + ...rest: [VCSReferenceType?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "reference"', + ); } - - const apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/deployments/vcs'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof reference !== 'undefined') { - payload['reference'] = reference; + apiPayload['reference'] = reference; } if (typeof activate !== 'undefined') { - payload['activate'] = activate; + apiPayload['activate'] = activate; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1208,7 +1703,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getDeployment(params: { functionId: string, deploymentId: string }): Promise; + getDeployment(params: { + functionId: string; + deploymentId: string; + }): Promise; /** * Get a function deployment by its unique ID. * @@ -1218,47 +1716,59 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeployment(functionId: string, deploymentId: string): Promise; getDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] + functionId: string, + deploymentId: string, + ): Promise; + getDeployment( + 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 }; + 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 + deploymentId: rest[0] as string, }; } - + const functionId = params.functionId; const deploymentId = params.deploymentId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1269,7 +1779,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteDeployment(params: { functionId: string, deploymentId: string }): Promise<{}>; + deleteDeployment(params: { + functionId: string; + deploymentId: string; + }): Promise<{}>; /** * Delete a code deployment by its unique ID. * @@ -1281,45 +1794,54 @@ export class Functions { */ deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; deleteDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + deploymentId: rest[0] as string, }; } - + const functionId = params.functionId; const deploymentId = params.deploymentId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1332,7 +1854,12 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }): Promise; + getDeploymentDownload(params: { + functionId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + }): Promise; /** * 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. * @@ -1344,57 +1871,91 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string): Promise; getDeploymentDownload( - paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string } | string, - ...rest: [(string)?, (DeploymentDownloadType)?, (string)?] + functionId: string, + deploymentId: string, + type?: DeploymentDownloadType, + token?: string, + ): Promise; + getDeploymentDownload( + paramsOrFirst: + | { + functionId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + } + | string, + ...rest: [string?, DeploymentDownloadType?, string?] ): Promise { - let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; + let params: { + functionId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + functionId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + }; } else { params = { functionId: paramsOrFirst as string, deploymentId: rest[0] as string, type: rest[1] as DeploymentDownloadType, - token: rest[2] as string + token: rest[2] as string, }; } - + const functionId = params.functionId; const deploymentId = params.deploymentId; const type = params.type; const token = params.token; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = + '/functions/{functionId}/deployments/{deploymentId}/download' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof token !== 'undefined') { - payload['token'] = token; + apiPayload['token'] = token; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': '*/*', - } + accept: '*/*', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } @@ -1406,7 +1967,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - updateDeploymentStatus(params: { functionId: string, deploymentId: string }): Promise; + updateDeploymentStatus(params: { + functionId: string; + deploymentId: string; + }): Promise; /** * 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. * @@ -1416,48 +1980,61 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDeploymentStatus(functionId: string, deploymentId: string): Promise; updateDeploymentStatus( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] + functionId: string, + deploymentId: string, + ): Promise; + updateDeploymentStatus( + 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 }; + 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 + deploymentId: rest[0] as string, }; } - + const functionId = params.functionId; const deploymentId = params.deploymentId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = + '/functions/{functionId}/deployments/{deploymentId}/status' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1469,7 +2046,11 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise; + listExecutions(params: { + functionId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all the current user function execution logs. You can use the query params to filter your results. * @@ -1480,52 +2061,64 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listExecutions(functionId: string, queries?: string[], total?: boolean): Promise; listExecutions( - paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + functionId: string, + queries?: string[], + total?: boolean, + ): Promise; + listExecutions( + paramsOrFirst: + | { functionId: string; queries?: string[]; total?: boolean } + | string, + ...rest: [string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/executions'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1541,7 +2134,15 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise; + createExecution(params: { + functionId: string; + body?: string; + async?: boolean; + xpath?: string; + method?: ExecutionMethod; + headers?: object; + scheduledAt?: string; + }): Promise; /** * 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. * @@ -1556,15 +2157,60 @@ export class Functions { * @returns {Promise} * @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; createExecution( - paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?] + functionId: string, + body?: string, + async?: boolean, + xpath?: string, + method?: ExecutionMethod, + headers?: object, + scheduledAt?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -1573,10 +2219,10 @@ export class Functions { xpath: rest[2] as string, method: rest[3] as ExecutionMethod, headers: rest[4] as object, - scheduledAt: rest[5] as string + scheduledAt: rest[5] as string, }; } - + const functionId = params.functionId; const body = params.body; const async = params.async; @@ -1584,45 +2230,43 @@ export class Functions { const method = params.method; const headers = params.headers; const scheduledAt = params.scheduledAt; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/executions'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof body !== 'undefined') { - payload['body'] = body; + apiPayload['body'] = body; } if (typeof async !== 'undefined') { - payload['async'] = async; + apiPayload['async'] = async; } if (typeof xpath !== 'undefined') { - payload['path'] = xpath; + apiPayload['path'] = xpath; } if (typeof method !== 'undefined') { - payload['method'] = method; + apiPayload['method'] = method; } if (typeof headers !== 'undefined') { - payload['headers'] = headers; + apiPayload['headers'] = headers; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1633,7 +2277,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getExecution(params: { functionId: string, executionId: string }): Promise; + getExecution(params: { + functionId: string; + executionId: string; + }): Promise; /** * Get a function execution log by its unique ID. * @@ -1643,47 +2290,56 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getExecution(functionId: string, executionId: string): Promise; getExecution( - paramsOrFirst: { functionId: string, executionId: string } | string, - ...rest: [(string)?] + functionId: string, + executionId: string, + ): Promise; + getExecution( + 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 }; + 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 + executionId: rest[0] as string, }; } - + const functionId = params.functionId; const executionId = params.executionId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{executionId}', encodeURIComponent(String(executionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "executionId"', + ); + } + const apiPath = '/functions/{functionId}/executions/{executionId}' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace('{executionId}', encodeURIComponent(String(executionId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1694,7 +2350,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteExecution(params: { functionId: string, executionId: string }): Promise<{}>; + deleteExecution(params: { + functionId: string; + executionId: string; + }): Promise<{}>; /** * Delete a function execution by its unique ID. * @@ -1706,45 +2365,51 @@ export class Functions { */ deleteExecution(functionId: string, executionId: string): Promise<{}>; deleteExecution( - paramsOrFirst: { functionId: string, executionId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + executionId: rest[0] as string, }; } - + const functionId = params.functionId; const executionId = params.executionId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{executionId}', encodeURIComponent(String(executionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "executionId"', + ); + } + const apiPath = '/functions/{functionId}/executions/{executionId}' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace('{executionId}', encodeURIComponent(String(executionId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1756,7 +2421,11 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - listVariables(params: { functionId: string, queries?: string[], total?: boolean }): Promise; + listVariables(params: { + functionId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all variables of a specific function. * @@ -1767,52 +2436,64 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(functionId: string, queries?: string[], total?: boolean): Promise; listVariables( - paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + functionId: string, + queries?: string[], + total?: boolean, + ): Promise; + listVariables( + paramsOrFirst: + | { functionId: string; queries?: string[]; total?: boolean } + | string, + ...rest: [string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } - - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/variables'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1820,55 +2501,94 @@ export class Functions { * * @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.key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} */ - createVariable(params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise; + createVariable(params: { + functionId: string; + variableId: string; + key: string; + value: string; + secret?: boolean; + }): Promise; /** * 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} key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} * @deprecated Use the object parameter style method for a better developer experience. */ - createVariable(functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise; createVariable( - paramsOrFirst: { functionId: string, variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] + functionId: string, + variableId: string, + key: string, + value: string, + secret?: boolean, + ): Promise; + createVariable( + paramsOrFirst: + | { + functionId: string; + variableId: string; + key: string; + value: string; + secret?: boolean; + } + | string, + ...rest: [string?, string?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -1876,35 +2596,32 @@ export class Functions { if (typeof value === 'undefined') { throw new AppwriteException('Missing required parameter: "value"'); } - - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', encodeURIComponent(String(functionId))); - const payload: Payload = {}; + const apiPath = '/functions/{functionId}/variables'.replace( + '{functionId}', + encodeURIComponent(String(functionId)), + ); + const apiPayload: Payload = {}; if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; + apiPayload['variableId'] = variableId; } if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1915,7 +2632,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - getVariable(params: { functionId: string, variableId: string }): Promise; + getVariable(params: { + functionId: string; + variableId: string; + }): Promise; /** * Get a variable by its unique ID. * @@ -1925,47 +2645,56 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getVariable(functionId: string, variableId: string): Promise; getVariable( - paramsOrFirst: { functionId: string, variableId: string } | string, - ...rest: [(string)?] + functionId: string, + variableId: string, + ): Promise; + getVariable( + 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 }; + 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 + variableId: rest[0] as string, }; } - + const functionId = params.functionId; const variableId = params.variableId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); + } + const apiPath = '/functions/{functionId}/variables/{variableId}' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace('{variableId}', encodeURIComponent(String(variableId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1973,82 +2702,117 @@ export class Functions { * * @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.key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} */ - updateVariable(params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise; + updateVariable(params: { + functionId: string; + variableId: string; + key?: string; + value?: string; + secret?: boolean; + }): Promise; /** * 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} key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} * @deprecated Use the object parameter style method for a better developer experience. */ - updateVariable(functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise; updateVariable( - paramsOrFirst: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] + functionId: string, + variableId: string, + key?: string, + value?: string, + secret?: boolean, + ): Promise; + updateVariable( + paramsOrFirst: + | { + functionId: string; + variableId: string; + key?: string; + value?: string; + secret?: boolean; + } + | string, + ...rest: [string?, string?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(functionId))).replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); + } + const apiPath = '/functions/{functionId}/variables/{variableId}' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace('{variableId}', encodeURIComponent(String(variableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -2059,7 +2823,10 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteVariable(params: { functionId: string, variableId: string }): Promise<{}>; + deleteVariable(params: { + functionId: string; + variableId: string; + }): Promise<{}>; /** * Delete a variable by its unique ID. * @@ -2071,44 +2838,50 @@ export class Functions { */ deleteVariable(functionId: string, variableId: string): Promise<{}>; deleteVariable( - paramsOrFirst: { functionId: string, variableId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + variableId: rest[0] as string, }; } - + const functionId = params.functionId; const variableId = params.variableId; - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); + 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}', encodeURIComponent(String(functionId))).replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); + } + const apiPath = '/functions/{functionId}/variables/{variableId}' + .replace('{functionId}', encodeURIComponent(String(functionId))) + .replace('{variableId}', encodeURIComponent(String(variableId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/graphql.ts b/src/services/graphql.ts index 741f45f..cc42f53 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -1,7 +1,4 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - +import { AppwriteException, Client, type Payload } from '../client'; export class Graphql { client: Client; @@ -27,29 +24,30 @@ export class Graphql { * @deprecated Use the object parameter style method for a better developer experience. */ query(query: object): Promise<{}>; - query( - paramsOrFirst: { query: object } | object - ): Promise<{}> { + query(paramsOrFirst: { query: object } | object): Promise<{}> { let params: { query: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'query' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { query: object }; } else { params = { - query: paramsOrFirst as object + query: paramsOrFirst as object, }; } - - const query = params.query; + const query = params.query; if (typeof query === 'undefined') { throw new AppwriteException('Missing required parameter: "query"'); } - const apiPath = '/graphql'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof query !== 'undefined') { - payload['query'] = query; + apiPayload['query'] = query; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -57,15 +55,10 @@ export class Graphql { 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -85,29 +78,30 @@ export class Graphql { * @deprecated Use the object parameter style method for a better developer experience. */ mutation(query: object): Promise<{}>; - mutation( - paramsOrFirst: { query: object } | object - ): Promise<{}> { + mutation(paramsOrFirst: { query: object } | object): Promise<{}> { let params: { query: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'query' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { query: object }; } else { params = { - query: paramsOrFirst as object + query: paramsOrFirst as object, }; } - - const query = params.query; + const query = params.query; if (typeof query === 'undefined') { throw new AppwriteException('Missing required parameter: "query"'); } - const apiPath = '/graphql/mutation'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof query !== 'undefined') { - payload['query'] = query; + apiPayload['query'] = query; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -115,14 +109,9 @@ export class Graphql { 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } } diff --git a/src/services/locale.ts b/src/services/locale.ts index 56b45d2..85b8039 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Locale { client: Client; @@ -12,29 +10,23 @@ export class Locale { /** * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. - * + * * ([IP Geolocation by DB-IP](https://db-ip.com)) * * @throws {AppwriteException} * @returns {Promise} */ get(): Promise { - const apiPath = '/locale'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -44,22 +36,16 @@ export class Locale { * @returns {Promise} */ listCodes(): Promise { - const apiPath = '/locale/codes'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -69,22 +55,16 @@ export class Locale { * @returns {Promise} */ listContinents(): Promise { - const apiPath = '/locale/continents'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -94,22 +74,16 @@ export class Locale { * @returns {Promise} */ listCountries(): Promise { - const apiPath = '/locale/countries'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -119,22 +93,16 @@ export class Locale { * @returns {Promise} */ listCountriesEU(): Promise { - const apiPath = '/locale/countries/eu'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -144,22 +112,16 @@ export class Locale { * @returns {Promise} */ listCountriesPhones(): Promise { - const apiPath = '/locale/countries/phones'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -169,22 +131,16 @@ export class Locale { * @returns {Promise} */ listCurrencies(): Promise { - const apiPath = '/locale/currencies'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -194,21 +150,15 @@ export class Locale { * @returns {Promise} */ listLanguages(): Promise { - const apiPath = '/locale/languages'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); } } diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 95646cc..0f81231 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -1,10 +1,8 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, 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; @@ -21,7 +19,11 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listMessages(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all messages from the current Appwrite project. * @@ -32,52 +34,59 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMessages(queries?: string[], search?: string, total?: boolean): Promise; listMessages( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listMessages( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/messaging/messages'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -98,7 +107,20 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * Create a new email message. * @@ -118,15 +140,85 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + 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; + 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 { - 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 }; + 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, @@ -140,10 +232,10 @@ export class Messaging { attachments: rest[7] as string[], draft: rest[8] as boolean, html: rest[9] as boolean, - scheduledAt: rest[10] as string + scheduledAt: rest[10] as string, }; } - + const messageId = params.messageId; const subject = params.subject; const content = params.content; @@ -156,74 +248,73 @@ export class Messaging { const draft = params.draft; const html = params.html; const scheduledAt = params.scheduledAt; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } if (typeof subject === 'undefined') { - throw new AppwriteException('Missing required parameter: "subject"'); + throw new AppwriteException( + 'Missing required parameter: "subject"', + ); } if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); + throw new AppwriteException( + 'Missing required parameter: "content"', + ); } - const apiPath = '/messaging/messages/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; + apiPayload['messageId'] = messageId; } if (typeof subject !== 'undefined') { - payload['subject'] = subject; + apiPayload['subject'] = subject; } if (typeof content !== 'undefined') { - payload['content'] = content; + apiPayload['content'] = content; } if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof cc !== 'undefined') { - payload['cc'] = cc; + apiPayload['cc'] = cc; } if (typeof bcc !== 'undefined') { - payload['bcc'] = bcc; + apiPayload['bcc'] = bcc; } if (typeof attachments !== 'undefined') { - payload['attachments'] = attachments; + apiPayload['attachments'] = attachments; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof html !== 'undefined') { - payload['html'] = html; + apiPayload['html'] = html; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -240,10 +331,23 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * 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. @@ -261,15 +365,85 @@ export class Messaging { * @returns {Promise} * @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; 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[])?] + 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; + 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 { - 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[] }; + 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, @@ -283,10 +457,10 @@ export class Messaging { cc: rest[7] as string[], bcc: rest[8] as string[], scheduledAt: rest[9] as string, - attachments: rest[10] as string[] + attachments: rest[10] as string[], }; } - + const messageId = params.messageId; const topics = params.topics; const users = params.users; @@ -299,60 +473,58 @@ export class Messaging { const bcc = params.bcc; const scheduledAt = params.scheduledAt; const attachments = params.attachments; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - - const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); - const payload: Payload = {}; + const apiPath = '/messaging/messages/email/{messageId}'.replace( + '{messageId}', + encodeURIComponent(String(messageId)), + ); + const apiPayload: Payload = {}; if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof subject !== 'undefined') { - payload['subject'] = subject; + apiPayload['subject'] = subject; } if (typeof content !== 'undefined') { - payload['content'] = content; + apiPayload['content'] = content; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof html !== 'undefined') { - payload['html'] = html; + apiPayload['html'] = html; } if (typeof cc !== 'undefined') { - payload['cc'] = cc; + apiPayload['cc'] = cc; } if (typeof bcc !== 'undefined') { - payload['bcc'] = bcc; + apiPayload['bcc'] = bcc; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } if (typeof attachments !== 'undefined') { - payload['attachments'] = attachments; + apiPayload['attachments'] = attachments; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -380,7 +552,27 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * Create a new push notification. * @@ -407,15 +599,120 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + 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; + 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 { - 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 }; + 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, @@ -436,10 +733,10 @@ export class Messaging { scheduledAt: rest[14] as string, contentAvailable: rest[15] as boolean, critical: rest[16] as boolean, - priority: rest[17] as MessagePriority + priority: rest[17] as MessagePriority, }; } - + const messageId = params.messageId; const title = params.title; const body = params.body; @@ -459,89 +756,84 @@ export class Messaging { const contentAvailable = params.contentAvailable; const critical = params.critical; const priority = params.priority; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - const apiPath = '/messaging/messages/push'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; + apiPayload['messageId'] = messageId; } if (typeof title !== 'undefined') { - payload['title'] = title; + apiPayload['title'] = title; } if (typeof body !== 'undefined') { - payload['body'] = body; + apiPayload['body'] = body; } if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof action !== 'undefined') { - payload['action'] = action; + apiPayload['action'] = action; } if (typeof image !== 'undefined') { - payload['image'] = image; + apiPayload['image'] = image; } if (typeof icon !== 'undefined') { - payload['icon'] = icon; + apiPayload['icon'] = icon; } if (typeof sound !== 'undefined') { - payload['sound'] = sound; + apiPayload['sound'] = sound; } if (typeof color !== 'undefined') { - payload['color'] = color; + apiPayload['color'] = color; } if (typeof tag !== 'undefined') { - payload['tag'] = tag; + apiPayload['tag'] = tag; } if (typeof badge !== 'undefined') { - payload['badge'] = badge; + apiPayload['badge'] = badge; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } if (typeof contentAvailable !== 'undefined') { - payload['contentAvailable'] = contentAvailable; + apiPayload['contentAvailable'] = contentAvailable; } if (typeof critical !== 'undefined') { - payload['critical'] = critical; + apiPayload['critical'] = critical; } if (typeof priority !== 'undefined') { - payload['priority'] = priority; + apiPayload['priority'] = priority; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -565,10 +857,30 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * 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. @@ -593,15 +905,120 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + 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; + 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 { - 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 }; + 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, @@ -622,10 +1039,10 @@ export class Messaging { scheduledAt: rest[14] as string, contentAvailable: rest[15] as boolean, critical: rest[16] as boolean, - priority: rest[17] as MessagePriority + priority: rest[17] as MessagePriority, }; } - + const messageId = params.messageId; const topics = params.topics; const users = params.users; @@ -645,81 +1062,79 @@ export class Messaging { const contentAvailable = params.contentAvailable; const critical = params.critical; const priority = params.priority; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - - const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); - const payload: Payload = {}; + const apiPath = '/messaging/messages/push/{messageId}'.replace( + '{messageId}', + encodeURIComponent(String(messageId)), + ); + const apiPayload: Payload = {}; if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof title !== 'undefined') { - payload['title'] = title; + apiPayload['title'] = title; } if (typeof body !== 'undefined') { - payload['body'] = body; + apiPayload['body'] = body; } if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof action !== 'undefined') { - payload['action'] = action; + apiPayload['action'] = action; } if (typeof image !== 'undefined') { - payload['image'] = image; + apiPayload['image'] = image; } if (typeof icon !== 'undefined') { - payload['icon'] = icon; + apiPayload['icon'] = icon; } if (typeof sound !== 'undefined') { - payload['sound'] = sound; + apiPayload['sound'] = sound; } if (typeof color !== 'undefined') { - payload['color'] = color; + apiPayload['color'] = color; } if (typeof tag !== 'undefined') { - payload['tag'] = tag; + apiPayload['tag'] = tag; } if (typeof badge !== 'undefined') { - payload['badge'] = badge; + apiPayload['badge'] = badge; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } if (typeof contentAvailable !== 'undefined') { - payload['contentAvailable'] = contentAvailable; + apiPayload['contentAvailable'] = contentAvailable; } if (typeof critical !== 'undefined') { - payload['critical'] = critical; + apiPayload['critical'] = critical; } if (typeof priority !== 'undefined') { - payload['priority'] = priority; + apiPayload['priority'] = priority; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -736,7 +1151,15 @@ export class Messaging { * @returns {Promise} * @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; + createSms(params: { + messageId: string; + content: string; + topics?: string[]; + users?: string[]; + targets?: string[]; + draft?: boolean; + scheduledAt?: string; + }): Promise; /** * Create a new SMS message. * @@ -751,15 +1174,53 @@ export class Messaging { * @returns {Promise} * @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; createSms( - paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] + messageId: string, + content: string, + topics?: string[], + users?: string[], + targets?: string[], + draft?: boolean, + scheduledAt?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -768,10 +1229,10 @@ export class Messaging { users: rest[2] as string[], targets: rest[3] as string[], draft: rest[4] as boolean, - scheduledAt: rest[5] as string + scheduledAt: rest[5] as string, }; } - + const messageId = params.messageId; const content = params.content; const topics = params.topics; @@ -779,51 +1240,48 @@ export class Messaging { const targets = params.targets; const draft = params.draft; const scheduledAt = params.scheduledAt; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); + throw new AppwriteException( + 'Missing required parameter: "content"', + ); } - const apiPath = '/messaging/messages/sms'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; + apiPayload['messageId'] = messageId; } if (typeof content !== 'undefined') { - payload['content'] = content; + apiPayload['content'] = content; } if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -839,7 +1297,15 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSMS(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise; + createSMS(params: { + messageId: string; + content: string; + topics?: string[]; + users?: string[]; + targets?: string[]; + draft?: boolean; + scheduledAt?: string; + }): Promise; /** * Create a new SMS message. * @@ -854,15 +1320,53 @@ export class Messaging { * @returns {Promise} * @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; createSMS( - paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] + messageId: string, + content: string, + topics?: string[], + users?: string[], + targets?: string[], + draft?: boolean, + scheduledAt?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -871,10 +1375,10 @@ export class Messaging { users: rest[2] as string[], targets: rest[3] as string[], draft: rest[4] as boolean, - scheduledAt: rest[5] as string + scheduledAt: rest[5] as string, }; } - + const messageId = params.messageId; const content = params.content; const topics = params.topics; @@ -882,56 +1386,53 @@ export class Messaging { const targets = params.targets; const draft = params.draft; const scheduledAt = params.scheduledAt; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); + throw new AppwriteException( + 'Missing required parameter: "content"', + ); } - const apiPath = '/messaging/messages/sms'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; + apiPayload['messageId'] = messageId; } if (typeof content !== 'undefined') { - payload['content'] = content; + apiPayload['content'] = content; } if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -944,10 +1445,18 @@ export class Messaging { * @returns {Promise} * @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; + updateSms(params: { + messageId: string; + topics?: string[]; + users?: string[]; + targets?: string[]; + content?: string; + draft?: boolean; + scheduledAt?: string; + }): Promise; /** * 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. @@ -960,15 +1469,53 @@ export class Messaging { * @returns {Promise} * @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; updateSms( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] + messageId: string, + topics?: string[], + users?: string[], + targets?: string[], + content?: string, + draft?: boolean, + scheduledAt?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -977,10 +1524,10 @@ export class Messaging { targets: rest[2] as string[], content: rest[3] as string, draft: rest[4] as boolean, - scheduledAt: rest[5] as string + scheduledAt: rest[5] as string, }; } - + const messageId = params.messageId; const topics = params.topics; const users = params.users; @@ -988,50 +1535,48 @@ export class Messaging { const content = params.content; const draft = params.draft; const scheduledAt = params.scheduledAt; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); - const payload: Payload = {}; + const apiPath = '/messaging/messages/sms/{messageId}'.replace( + '{messageId}', + encodeURIComponent(String(messageId)), + ); + const apiPayload: Payload = {}; if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof content !== 'undefined') { - payload['content'] = content; + apiPayload['content'] = content; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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. @@ -1043,10 +1588,18 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateSMS(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise; + updateSMS(params: { + messageId: string; + topics?: string[]; + users?: string[]; + targets?: string[]; + content?: string; + draft?: boolean; + scheduledAt?: string; + }): Promise; /** * 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. @@ -1059,15 +1612,53 @@ export class Messaging { * @returns {Promise} * @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; updateSMS( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] + messageId: string, + topics?: string[], + users?: string[], + targets?: string[], + content?: string, + draft?: boolean, + scheduledAt?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -1076,10 +1667,10 @@ export class Messaging { targets: rest[2] as string[], content: rest[3] as string, draft: rest[4] as boolean, - scheduledAt: rest[5] as string + scheduledAt: rest[5] as string, }; } - + const messageId = params.messageId; const topics = params.topics; const users = params.users; @@ -1087,50 +1678,48 @@ export class Messaging { const content = params.content; const draft = params.draft; const scheduledAt = params.scheduledAt; - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); - const payload: Payload = {}; + const apiPath = '/messaging/messages/sms/{messageId}'.replace( + '{messageId}', + encodeURIComponent(String(messageId)), + ); + const apiPayload: Payload = {}; if (typeof topics !== 'undefined') { - payload['topics'] = topics; + apiPayload['topics'] = topics; } if (typeof users !== 'undefined') { - payload['users'] = users; + apiPayload['users'] = users; } if (typeof targets !== 'undefined') { - payload['targets'] = targets; + apiPayload['targets'] = targets; } if (typeof content !== 'undefined') { - payload['content'] = content; + apiPayload['content'] = content; } if (typeof draft !== 'undefined') { - payload['draft'] = draft; + apiPayload['draft'] = draft; } if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + apiPayload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Get a message by its unique ID. - * + * * * @param {string} params.messageId - Message ID. * @throws {AppwriteException} @@ -1139,7 +1728,7 @@ export class Messaging { getMessage(params: { messageId: string }): Promise; /** * Get a message by its unique ID. - * + * * * @param {string} messageId - Message ID. * @throws {AppwriteException} @@ -1148,39 +1737,41 @@ export class Messaging { */ getMessage(messageId: string): Promise; getMessage( - paramsOrFirst: { messageId: string } | string + paramsOrFirst: { messageId: string } | string, ): Promise { let params: { messageId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { messageId: string }; } else { params = { - messageId: paramsOrFirst as string + messageId: paramsOrFirst as string, }; } - - const messageId = params.messageId; + const messageId = params.messageId; if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); - const payload: Payload = {}; + const apiPath = '/messaging/messages/{messageId}'.replace( + '{messageId}', + encodeURIComponent(String(messageId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1200,40 +1791,40 @@ export class Messaging { * @deprecated Use the object parameter style method for a better developer experience. */ delete(messageId: string): Promise<{}>; - delete( - paramsOrFirst: { messageId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { messageId: string } | string): Promise<{}> { let params: { messageId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { messageId: string }; } else { params = { - messageId: paramsOrFirst as string + messageId: paramsOrFirst as string, }; } - - const messageId = params.messageId; + const messageId = params.messageId; if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', encodeURIComponent(String(messageId))); - const payload: Payload = {}; + const apiPath = '/messaging/messages/{messageId}'.replace( + '{messageId}', + encodeURIComponent(String(messageId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1245,7 +1836,11 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise; + listTargets(params: { + messageId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of the targets associated with a message. * @@ -1256,52 +1851,63 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTargets(messageId: string, queries?: string[], total?: boolean): Promise; listTargets( - paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + messageId: string, + queries?: string[], + total?: boolean, + ): Promise; + listTargets( + paramsOrFirst: + { messageId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "messageId"', + ); } - - const apiPath = '/messaging/messages/{messageId}/targets'.replace('{messageId}', encodeURIComponent(String(messageId))); - const payload: Payload = {}; + const apiPath = '/messaging/messages/{messageId}/targets'.replace( + '{messageId}', + encodeURIComponent(String(messageId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1313,7 +1919,11 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listProviders(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all providers from the current Appwrite project. * @@ -1324,52 +1934,59 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listProviders(queries?: string[], search?: string, total?: boolean): Promise; listProviders( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listProviders( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/messaging/providers'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1387,7 +2004,16 @@ export class Messaging { * @returns {Promise} * @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; + createApnsProvider(params: { + providerId: string; + name: string; + authKey?: string; + authKeyId?: string; + teamId?: string; + bundleId?: string; + sandbox?: boolean; + enabled?: boolean; + }): Promise; /** * Create a new Apple Push Notification service provider. * @@ -1403,15 +2029,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name: string, + authKey?: string, + authKeyId?: string, + teamId?: string, + bundleId?: string, + sandbox?: boolean, + enabled?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1421,10 +2097,10 @@ export class Messaging { teamId: rest[3] as string, bundleId: rest[4] as string, sandbox: rest[5] as boolean, - enabled: rest[6] as boolean + enabled: rest[6] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const authKey = params.authKey; @@ -1433,54 +2109,49 @@ export class Messaging { const bundleId = params.bundleId; const sandbox = params.sandbox; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; + apiPayload['authKey'] = authKey; } if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; + apiPayload['authKeyId'] = authKeyId; } if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; + apiPayload['bundleId'] = bundleId; } if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; + apiPayload['sandbox'] = sandbox; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1497,7 +2168,16 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createAPNSProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise; + createAPNSProvider(params: { + providerId: string; + name: string; + authKey?: string; + authKeyId?: string; + teamId?: string; + bundleId?: string; + sandbox?: boolean; + enabled?: boolean; + }): Promise; /** * Create a new Apple Push Notification service provider. * @@ -1513,15 +2193,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name: string, + authKey?: string, + authKeyId?: string, + teamId?: string, + bundleId?: string, + sandbox?: boolean, + enabled?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1531,10 +2261,10 @@ export class Messaging { teamId: rest[3] as string, bundleId: rest[4] as string, sandbox: rest[5] as boolean, - enabled: rest[6] as boolean + enabled: rest[6] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const authKey = params.authKey; @@ -1543,54 +2273,49 @@ export class Messaging { const bundleId = params.bundleId; const sandbox = params.sandbox; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; + apiPayload['authKey'] = authKey; } if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; + apiPayload['authKeyId'] = authKeyId; } if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; + apiPayload['bundleId'] = bundleId; } if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; + apiPayload['sandbox'] = sandbox; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1608,7 +2333,16 @@ export class Messaging { * @returns {Promise} * @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; + updateApnsProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + authKey?: string; + authKeyId?: string; + teamId?: string; + bundleId?: string; + sandbox?: boolean; + }): Promise; /** * Update a Apple Push Notification service provider by its unique ID. * @@ -1624,15 +2358,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name?: string, + enabled?: boolean, + authKey?: string, + authKeyId?: string, + teamId?: string, + bundleId?: string, + sandbox?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1642,10 +2426,10 @@ export class Messaging { authKeyId: rest[3] as string, teamId: rest[4] as string, bundleId: rest[5] as string, - sandbox: rest[6] as boolean + sandbox: rest[6] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const enabled = params.enabled; @@ -1654,48 +2438,46 @@ export class Messaging { const teamId = params.teamId; const bundleId = params.bundleId; const sandbox = params.sandbox; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/apns/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; + apiPayload['authKey'] = authKey; } if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; + apiPayload['authKeyId'] = authKeyId; } if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; + apiPayload['bundleId'] = bundleId; } if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; + apiPayload['sandbox'] = sandbox; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1712,7 +2494,16 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateAPNSProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise; + updateAPNSProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + authKey?: string; + authKeyId?: string; + teamId?: string; + bundleId?: string; + sandbox?: boolean; + }): Promise; /** * Update a Apple Push Notification service provider by its unique ID. * @@ -1728,15 +2519,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name?: string, + enabled?: boolean, + authKey?: string, + authKeyId?: string, + teamId?: string, + bundleId?: string, + sandbox?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1746,10 +2587,10 @@ export class Messaging { authKeyId: rest[3] as string, teamId: rest[4] as string, bundleId: rest[5] as string, - sandbox: rest[6] as boolean + sandbox: rest[6] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const enabled = params.enabled; @@ -1758,48 +2599,46 @@ export class Messaging { const teamId = params.teamId; const bundleId = params.bundleId; const sandbox = params.sandbox; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/apns/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; + apiPayload['authKey'] = authKey; } if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; + apiPayload['authKeyId'] = authKeyId; } if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; + apiPayload['bundleId'] = bundleId; } if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; + apiPayload['sandbox'] = sandbox; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1813,7 +2652,12 @@ export class Messaging { * @returns {Promise} * @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; + createFcmProvider(params: { + providerId: string; + name: string; + serviceAccountJSON?: object; + enabled?: boolean; + }): Promise; /** * Create a new Firebase Cloud Messaging provider. * @@ -1825,64 +2669,85 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise; createFcmProvider( - paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, - ...rest: [(string)?, (object)?, (boolean)?] + providerId: string, + name: string, + serviceAccountJSON?: object, + enabled?: boolean, + ): Promise; + createFcmProvider( + paramsOrFirst: + | { + providerId: string; + name: string; + serviceAccountJSON?: object; + enabled?: boolean; + } + | string, + ...rest: [string?, object?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; + apiPayload['serviceAccountJSON'] = serviceAccountJSON; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1895,7 +2760,12 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createFCMProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise; + createFCMProvider(params: { + providerId: string; + name: string; + serviceAccountJSON?: object; + enabled?: boolean; + }): Promise; /** * Create a new Firebase Cloud Messaging provider. * @@ -1907,64 +2777,85 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFCMProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise; createFCMProvider( - paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, - ...rest: [(string)?, (object)?, (boolean)?] + providerId: string, + name: string, + serviceAccountJSON?: object, + enabled?: boolean, + ): Promise; + createFCMProvider( + paramsOrFirst: + | { + providerId: string; + name: string; + serviceAccountJSON?: object; + enabled?: boolean; + } + | string, + ...rest: [string?, object?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; + apiPayload['serviceAccountJSON'] = serviceAccountJSON; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1978,7 +2869,12 @@ export class Messaging { * @returns {Promise} * @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; + updateFcmProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + serviceAccountJSON?: object; + }): Promise; /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -1990,58 +2886,82 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFcmProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise; updateFcmProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, - ...rest: [(string)?, (boolean)?, (object)?] + providerId: string, + name?: string, + enabled?: boolean, + serviceAccountJSON?: object, + ): Promise; + updateFcmProvider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + serviceAccountJSON?: object; + } + | string, + ...rest: [string?, boolean?, object?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/fcm/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; + apiPayload['serviceAccountJSON'] = serviceAccountJSON; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2054,7 +2974,12 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateFCMProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise; + updateFCMProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + serviceAccountJSON?: object; + }): Promise; /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -2066,58 +2991,82 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFCMProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise; updateFCMProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, - ...rest: [(string)?, (boolean)?, (object)?] + providerId: string, + name?: string, + enabled?: boolean, + serviceAccountJSON?: object, + ): Promise; + updateFCMProvider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + serviceAccountJSON?: object; + } + | string, + ...rest: [string?, boolean?, object?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/fcm/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; + apiPayload['serviceAccountJSON'] = serviceAccountJSON; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2136,7 +3085,18 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createMailgunProvider(params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createMailgunProvider(params: { + providerId: string; + name: string; + apiKey?: string; + domain?: string; + isEuRegion?: boolean; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + enabled?: boolean; + }): Promise; /** * Create a new Mailgun provider. * @@ -2154,15 +3114,75 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name: string, + apiKey?: string, + domain?: string, + isEuRegion?: boolean, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + enabled?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2174,10 +3194,10 @@ export class Messaging { fromEmail: rest[5] as string, replyToName: rest[6] as string, replyToEmail: rest[7] as string, - enabled: rest[8] as boolean + enabled: rest[8] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const apiKey = params.apiKey; @@ -2188,60 +3208,55 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } if (typeof isEuRegion !== 'undefined') { - payload['isEuRegion'] = isEuRegion; + apiPayload['isEuRegion'] = isEuRegion; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2260,7 +3275,18 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateMailgunProvider(params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + updateMailgunProvider(params: { + providerId: string; + name?: string; + apiKey?: string; + domain?: string; + isEuRegion?: boolean; + enabled?: boolean; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + }): Promise; /** * Update a Mailgun provider by its unique ID. * @@ -2278,15 +3304,75 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name?: string, + apiKey?: string, + domain?: string, + isEuRegion?: boolean, + enabled?: boolean, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2298,10 +3384,10 @@ export class Messaging { fromName: rest[5] as string, fromEmail: rest[6] as string, replyToName: rest[7] as string, - replyToEmail: rest[8] as string + replyToEmail: rest[8] as string, }; } - + const providerId = params.providerId; const name = params.name; const apiKey = params.apiKey; @@ -2312,54 +3398,52 @@ export class Messaging { const fromEmail = params.fromEmail; const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/mailgun/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/mailgun/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } if (typeof isEuRegion !== 'undefined') { - payload['isEuRegion'] = isEuRegion; + apiPayload['isEuRegion'] = isEuRegion; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2374,7 +3458,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createMsg91Provider(params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise; + createMsg91Provider(params: { + providerId: string; + name: string; + templateId?: string; + senderId?: string; + authKey?: string; + enabled?: boolean; + }): Promise; /** * Create a new MSG91 provider. * @@ -2388,15 +3479,49 @@ export class Messaging { * @returns {Promise} * @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; createMsg91Provider( - paramsOrFirst: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + providerId: string, + name: string, + templateId?: string, + senderId?: string, + authKey?: string, + enabled?: boolean, + ): Promise; + createMsg91Provider( + paramsOrFirst: + | { + providerId: string; + name: string; + templateId?: string; + senderId?: string; + authKey?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -2404,58 +3529,53 @@ export class Messaging { templateId: rest[1] as string, senderId: rest[2] as string, authKey: rest[3] as string, - enabled: rest[4] as boolean + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; + apiPayload['templateId'] = templateId; } if (typeof senderId !== 'undefined') { - payload['senderId'] = senderId; + apiPayload['senderId'] = senderId; } if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; + apiPayload['authKey'] = authKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2470,7 +3590,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateMsg91Provider(params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise; + updateMsg91Provider(params: { + providerId: string; + name?: string; + enabled?: boolean; + templateId?: string; + senderId?: string; + authKey?: string; + }): Promise; /** * Update a MSG91 provider by its unique ID. * @@ -2484,15 +3611,49 @@ export class Messaging { * @returns {Promise} * @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; updateMsg91Provider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + providerId: string, + name?: string, + enabled?: boolean, + templateId?: string, + senderId?: string, + authKey?: string, + ): Promise; + updateMsg91Provider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + templateId?: string; + senderId?: string; + authKey?: string; + } + | string, + ...rest: [string?, boolean?, string?, string?, string?] ): Promise { - 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 }; + 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, @@ -2500,52 +3661,50 @@ export class Messaging { enabled: rest[1] as boolean, templateId: rest[2] as string, senderId: rest[3] as string, - authKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/msg91/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; + apiPayload['templateId'] = templateId; } if (typeof senderId !== 'undefined') { - payload['senderId'] = senderId; + apiPayload['senderId'] = senderId; } if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; + apiPayload['authKey'] = authKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2562,7 +3721,16 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createResendProvider(params: { + providerId: string; + name: string; + apiKey?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + enabled?: boolean; + }): Promise; /** * Create a new Resend provider. * @@ -2578,15 +3746,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name: string, + apiKey?: string, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + enabled?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2596,10 +3814,10 @@ export class Messaging { fromEmail: rest[3] as string, replyToName: rest[4] as string, replyToEmail: rest[5] as string, - enabled: rest[6] as boolean + enabled: rest[6] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const apiKey = params.apiKey; @@ -2608,54 +3826,49 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2672,7 +3885,16 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + updateResendProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + apiKey?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + }): Promise; /** * Update a Resend provider by its unique ID. * @@ -2688,15 +3910,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name?: string, + enabled?: boolean, + apiKey?: string, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2706,10 +3978,10 @@ export class Messaging { fromName: rest[3] as string, fromEmail: rest[4] as string, replyToName: rest[5] as string, - replyToEmail: rest[6] as string + replyToEmail: rest[6] as string, }; } - + const providerId = params.providerId; const name = params.name; const enabled = params.enabled; @@ -2718,48 +3990,46 @@ export class Messaging { const fromEmail = params.fromEmail; const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/resend/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2776,7 +4046,16 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSendgridProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createSendgridProvider(params: { + providerId: string; + name: string; + apiKey?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + enabled?: boolean; + }): Promise; /** * Create a new Sendgrid provider. * @@ -2792,15 +4071,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name: string, + apiKey?: string, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + enabled?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2810,10 +4139,10 @@ export class Messaging { fromEmail: rest[3] as string, replyToName: rest[4] as string, replyToEmail: rest[5] as string, - enabled: rest[6] as boolean + enabled: rest[6] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const apiKey = params.apiKey; @@ -2822,54 +4151,49 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2886,7 +4210,16 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateSendgridProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + updateSendgridProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + apiKey?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + }): Promise; /** * Update a Sendgrid provider by its unique ID. * @@ -2902,15 +4235,65 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + providerId: string, + name?: string, + enabled?: boolean, + apiKey?: string, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2920,10 +4303,10 @@ export class Messaging { fromName: rest[3] as string, fromEmail: rest[4] as string, replyToName: rest[5] as string, - replyToEmail: rest[6] as string + replyToEmail: rest[6] as string, }; } - + const providerId = params.providerId; const name = params.name; const enabled = params.enabled; @@ -2932,48 +4315,46 @@ export class Messaging { const fromEmail = params.fromEmail; const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2992,7 +4373,18 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSesProvider(params: { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise; + createSesProvider(params: { + providerId: string; + name: string; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + enabled?: boolean; + }): Promise; /** * Create a new Amazon SES provider. * @@ -3010,15 +4402,75 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createSesProvider(providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise; createSesProvider( - paramsOrFirst: { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + providerId: string, + name: string, + accessKey?: string, + secretKey?: string, + region?: string, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + enabled?: boolean, + ): Promise; + createSesProvider( + paramsOrFirst: + | { + providerId: string; + name: string; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + enabled?: boolean; + } + | string, + ...rest: [ + string?, + string?, + string?, + string?, + string?, + string?, + string?, + string?, + boolean?, + ] ): Promise { - let params: { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + let params: { + providerId: string; + name: string; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + providerId: string; + name: string; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + enabled?: boolean; + }; } else { params = { providerId: paramsOrFirst as string, @@ -3030,10 +4482,10 @@ export class Messaging { fromEmail: rest[5] as string, replyToName: rest[6] as string, replyToEmail: rest[7] as string, - enabled: rest[8] as boolean + enabled: rest[8] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const accessKey = params.accessKey; @@ -3044,60 +4496,55 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/messaging/providers/ses'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof accessKey !== 'undefined') { - payload['accessKey'] = accessKey; + apiPayload['accessKey'] = accessKey; } if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; + apiPayload['secretKey'] = secretKey; } if (typeof region !== 'undefined') { - payload['region'] = region; + apiPayload['region'] = region; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3116,7 +4563,18 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateSesProvider(params: { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise; + updateSesProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + }): Promise; /** * Update an Amazon SES provider by its unique ID. * @@ -3134,15 +4592,75 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSesProvider(providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise; updateSesProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + providerId: string, + name?: string, + enabled?: boolean, + accessKey?: string, + secretKey?: string, + region?: string, + fromName?: string, + fromEmail?: string, + replyToName?: string, + replyToEmail?: string, + ): Promise; + updateSesProvider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + } + | string, + ...rest: [ + string?, + boolean?, + string?, + string?, + string?, + string?, + string?, + string?, + string?, + ] ): Promise { - let params: { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, accessKey?: string, secretKey?: string, region?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + let params: { + providerId: string; + name?: string; + enabled?: boolean; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + providerId: string; + name?: string; + enabled?: boolean; + accessKey?: string; + secretKey?: string; + region?: string; + fromName?: string; + fromEmail?: string; + replyToName?: string; + replyToEmail?: string; + }; } else { params = { providerId: paramsOrFirst as string, @@ -3154,10 +4672,10 @@ export class Messaging { fromName: rest[5] as string, fromEmail: rest[6] as string, replyToName: rest[7] as string, - replyToEmail: rest[8] as string + replyToEmail: rest[8] as string, }; } - + const providerId = params.providerId; const name = params.name; const enabled = params.enabled; @@ -3168,54 +4686,52 @@ export class Messaging { const fromEmail = params.fromEmail; const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/ses/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/ses/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof accessKey !== 'undefined') { - payload['accessKey'] = accessKey; + apiPayload['accessKey'] = accessKey; } if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; + apiPayload['secretKey'] = secretKey; } if (typeof region !== 'undefined') { - payload['region'] = region; + apiPayload['region'] = region; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3239,7 +4755,22 @@ export class Messaging { * @returns {Promise} * @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; + 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; /** * Create a new SMTP provider. * @@ -3261,15 +4792,95 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + 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; + 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 { - 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 }; + 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, @@ -3285,10 +4896,10 @@ export class Messaging { fromEmail: rest[9] as string, replyToName: rest[10] as string, replyToEmail: rest[11] as string, - enabled: rest[12] as boolean + enabled: rest[12] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const host = params.host; @@ -3303,9 +4914,10 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); @@ -3313,65 +4925,59 @@ export class Messaging { if (typeof host === 'undefined') { throw new AppwriteException('Missing required parameter: "host"'); } - const apiPath = '/messaging/providers/smtp'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof host !== 'undefined') { - payload['host'] = host; + apiPayload['host'] = host; } if (typeof port !== 'undefined') { - payload['port'] = port; + apiPayload['port'] = port; } if (typeof username !== 'undefined') { - payload['username'] = username; + apiPayload['username'] = username; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; + apiPayload['encryption'] = encryption; } if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; + apiPayload['autoTLS'] = autoTLS; } if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; + apiPayload['mailer'] = mailer; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3394,7 +5000,22 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * Create a new SMTP provider. * @@ -3416,15 +5037,95 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + 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; + 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 { - 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 }; + 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, @@ -3440,10 +5141,10 @@ export class Messaging { fromEmail: rest[9] as string, replyToName: rest[10] as string, replyToEmail: rest[11] as string, - enabled: rest[12] as boolean + enabled: rest[12] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const host = params.host; @@ -3458,9 +5159,10 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); @@ -3468,65 +5170,59 @@ export class Messaging { if (typeof host === 'undefined') { throw new AppwriteException('Missing required parameter: "host"'); } - const apiPath = '/messaging/providers/smtp'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof host !== 'undefined') { - payload['host'] = host; + apiPayload['host'] = host; } if (typeof port !== 'undefined') { - payload['port'] = port; + apiPayload['port'] = port; } if (typeof username !== 'undefined') { - payload['username'] = username; + apiPayload['username'] = username; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; + apiPayload['encryption'] = encryption; } if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; + apiPayload['autoTLS'] = autoTLS; } if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; + apiPayload['mailer'] = mailer; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3550,7 +5246,22 @@ export class Messaging { * @returns {Promise} * @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; + 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; /** * Update a SMTP provider by its unique ID. * @@ -3572,15 +5283,95 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + 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; + 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 { - 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 }; + 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, @@ -3596,10 +5387,10 @@ export class Messaging { fromEmail: rest[9] as string, replyToName: rest[10] as string, replyToEmail: rest[11] as string, - enabled: rest[12] as boolean + enabled: rest[12] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const host = params.host; @@ -3614,66 +5405,64 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/smtp/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof host !== 'undefined') { - payload['host'] = host; + apiPayload['host'] = host; } if (typeof port !== 'undefined') { - payload['port'] = port; + apiPayload['port'] = port; } if (typeof username !== 'undefined') { - payload['username'] = username; + apiPayload['username'] = username; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; + apiPayload['encryption'] = encryption; } if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; + apiPayload['autoTLS'] = autoTLS; } if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; + apiPayload['mailer'] = mailer; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3696,7 +5485,22 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * Update a SMTP provider by its unique ID. * @@ -3718,15 +5522,95 @@ export class Messaging { * @returns {Promise} * @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; 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)?] + 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; + 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 { - 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 }; + 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, @@ -3742,10 +5626,10 @@ export class Messaging { fromEmail: rest[9] as string, replyToName: rest[10] as string, replyToEmail: rest[11] as string, - enabled: rest[12] as boolean + enabled: rest[12] as boolean, }; } - + const providerId = params.providerId; const name = params.name; const host = params.host; @@ -3760,66 +5644,64 @@ export class Messaging { const replyToName = params.replyToName; const replyToEmail = params.replyToEmail; const enabled = params.enabled; - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/smtp/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof host !== 'undefined') { - payload['host'] = host; + apiPayload['host'] = host; } if (typeof port !== 'undefined') { - payload['port'] = port; + apiPayload['port'] = port; } if (typeof username !== 'undefined') { - payload['username'] = username; + apiPayload['username'] = username; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; + apiPayload['encryption'] = encryption; } if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; + apiPayload['autoTLS'] = autoTLS; } if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; + apiPayload['mailer'] = mailer; } if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; + apiPayload['fromName'] = fromName; } if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; + apiPayload['fromEmail'] = fromEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3834,7 +5716,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTelesignProvider(params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise; + createTelesignProvider(params: { + providerId: string; + name: string; + from?: string; + customerId?: string; + apiKey?: string; + enabled?: boolean; + }): Promise; /** * Create a new Telesign provider. * @@ -3848,15 +5737,49 @@ export class Messaging { * @returns {Promise} * @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; createTelesignProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + providerId: string, + name: string, + from?: string, + customerId?: string, + apiKey?: string, + enabled?: boolean, + ): Promise; + createTelesignProvider( + paramsOrFirst: + | { + providerId: string; + name: string; + from?: string; + customerId?: string; + apiKey?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -3864,58 +5787,53 @@ export class Messaging { from: rest[1] as string, customerId: rest[2] as string, apiKey: rest[3] as string, - enabled: rest[4] as boolean + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } if (typeof customerId !== 'undefined') { - payload['customerId'] = customerId; + apiPayload['customerId'] = customerId; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3930,7 +5848,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTelesignProvider(params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise; + updateTelesignProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + customerId?: string; + apiKey?: string; + from?: string; + }): Promise; /** * Update a Telesign provider by its unique ID. * @@ -3944,15 +5869,49 @@ export class Messaging { * @returns {Promise} * @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; updateTelesignProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + providerId: string, + name?: string, + enabled?: boolean, + customerId?: string, + apiKey?: string, + from?: string, + ): Promise; + updateTelesignProvider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + customerId?: string; + apiKey?: string; + from?: string; + } + | string, + ...rest: [string?, boolean?, string?, string?, string?] ): Promise { - 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 }; + 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, @@ -3960,52 +5919,50 @@ export class Messaging { enabled: rest[1] as boolean, customerId: rest[2] as string, apiKey: rest[3] as string, - from: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/telesign/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/telesign/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof customerId !== 'undefined') { - payload['customerId'] = customerId; + apiPayload['customerId'] = customerId; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4020,7 +5977,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTextmagicProvider(params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise; + createTextmagicProvider(params: { + providerId: string; + name: string; + from?: string; + username?: string; + apiKey?: string; + enabled?: boolean; + }): Promise; /** * Create a new Textmagic provider. * @@ -4034,15 +5998,49 @@ export class Messaging { * @returns {Promise} * @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; createTextmagicProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + providerId: string, + name: string, + from?: string, + username?: string, + apiKey?: string, + enabled?: boolean, + ): Promise; + createTextmagicProvider( + paramsOrFirst: + | { + providerId: string; + name: string; + from?: string; + username?: string; + apiKey?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -4050,58 +6048,53 @@ export class Messaging { from: rest[1] as string, username: rest[2] as string, apiKey: rest[3] as string, - enabled: rest[4] as boolean + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } if (typeof username !== 'undefined') { - payload['username'] = username; + apiPayload['username'] = username; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4116,7 +6109,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTextmagicProvider(params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise; + updateTextmagicProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + username?: string; + apiKey?: string; + from?: string; + }): Promise; /** * Update a Textmagic provider by its unique ID. * @@ -4130,15 +6130,49 @@ export class Messaging { * @returns {Promise} * @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; updateTextmagicProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + providerId: string, + name?: string, + enabled?: boolean, + username?: string, + apiKey?: string, + from?: string, + ): Promise; + updateTextmagicProvider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + username?: string; + apiKey?: string; + from?: string; + } + | string, + ...rest: [string?, boolean?, string?, string?, string?] ): Promise { - 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 }; + 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, @@ -4146,52 +6180,50 @@ export class Messaging { enabled: rest[1] as boolean, username: rest[2] as string, apiKey: rest[3] as string, - from: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/textmagic/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/textmagic/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof username !== 'undefined') { - payload['username'] = username; + apiPayload['username'] = username; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4206,7 +6238,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTwilioProvider(params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise; + createTwilioProvider(params: { + providerId: string; + name: string; + from?: string; + accountSid?: string; + authToken?: string; + enabled?: boolean; + }): Promise; /** * Create a new Twilio provider. * @@ -4220,15 +6259,49 @@ export class Messaging { * @returns {Promise} * @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; createTwilioProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + providerId: string, + name: string, + from?: string, + accountSid?: string, + authToken?: string, + enabled?: boolean, + ): Promise; + createTwilioProvider( + paramsOrFirst: + | { + providerId: string; + name: string; + from?: string; + accountSid?: string; + authToken?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -4236,58 +6309,53 @@ export class Messaging { from: rest[1] as string, accountSid: rest[2] as string, authToken: rest[3] as string, - enabled: rest[4] as boolean + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } if (typeof accountSid !== 'undefined') { - payload['accountSid'] = accountSid; + apiPayload['accountSid'] = accountSid; } if (typeof authToken !== 'undefined') { - payload['authToken'] = authToken; + apiPayload['authToken'] = authToken; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4302,7 +6370,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTwilioProvider(params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise; + updateTwilioProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + accountSid?: string; + authToken?: string; + from?: string; + }): Promise; /** * Update a Twilio provider by its unique ID. * @@ -4316,15 +6391,49 @@ export class Messaging { * @returns {Promise} * @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; updateTwilioProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + providerId: string, + name?: string, + enabled?: boolean, + accountSid?: string, + authToken?: string, + from?: string, + ): Promise; + updateTwilioProvider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + accountSid?: string; + authToken?: string; + from?: string; + } + | string, + ...rest: [string?, boolean?, string?, string?, string?] ): Promise { - 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 }; + 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, @@ -4332,52 +6441,50 @@ export class Messaging { enabled: rest[1] as boolean, accountSid: rest[2] as string, authToken: rest[3] as string, - from: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/twilio/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/twilio/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof accountSid !== 'undefined') { - payload['accountSid'] = accountSid; + apiPayload['accountSid'] = accountSid; } if (typeof authToken !== 'undefined') { - payload['authToken'] = authToken; + apiPayload['authToken'] = authToken; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4392,7 +6499,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createVonageProvider(params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise; + createVonageProvider(params: { + providerId: string; + name: string; + from?: string; + apiKey?: string; + apiSecret?: string; + enabled?: boolean; + }): Promise; /** * Create a new Vonage provider. * @@ -4406,15 +6520,49 @@ export class Messaging { * @returns {Promise} * @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; createVonageProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + providerId: string, + name: string, + from?: string, + apiKey?: string, + apiSecret?: string, + enabled?: boolean, + ): Promise; + createVonageProvider( + paramsOrFirst: + | { + providerId: string; + name: string; + from?: string; + apiKey?: string; + apiSecret?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -4422,58 +6570,53 @@ export class Messaging { from: rest[1] as string, apiKey: rest[2] as string, apiSecret: rest[3] as string, - enabled: rest[4] as boolean + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; + apiPayload['apiSecret'] = apiSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4488,7 +6631,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateVonageProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise; + updateVonageProvider(params: { + providerId: string; + name?: string; + enabled?: boolean; + apiKey?: string; + apiSecret?: string; + from?: string; + }): Promise; /** * Update a Vonage provider by its unique ID. * @@ -4502,15 +6652,49 @@ export class Messaging { * @returns {Promise} * @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; updateVonageProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + providerId: string, + name?: string, + enabled?: boolean, + apiKey?: string, + apiSecret?: string, + from?: string, + ): Promise; + updateVonageProvider( + paramsOrFirst: + | { + providerId: string; + name?: string; + enabled?: boolean; + apiKey?: string; + apiSecret?: string; + from?: string; + } + | string, + ...rest: [string?, boolean?, string?, string?, string?] ): Promise { - 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 }; + 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, @@ -4518,57 +6702,55 @@ export class Messaging { enabled: rest[1] as boolean, apiKey: rest[2] as string, apiSecret: rest[3] as string, - from: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/vonage/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/vonage/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; + apiPayload['apiSecret'] = apiSecret; } if (typeof from !== 'undefined') { - payload['from'] = from; + apiPayload['from'] = from; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Get a provider by its unique ID. - * + * * * @param {string} params.providerId - Provider ID. * @throws {AppwriteException} @@ -4577,7 +6759,7 @@ export class Messaging { getProvider(params: { providerId: string }): Promise; /** * Get a provider by its unique ID. - * + * * * @param {string} providerId - Provider ID. * @throws {AppwriteException} @@ -4586,39 +6768,41 @@ export class Messaging { */ getProvider(providerId: string): Promise; getProvider( - paramsOrFirst: { providerId: string } | string + paramsOrFirst: { providerId: string } | string, ): Promise { let params: { providerId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { providerId: string }; } else { params = { - providerId: paramsOrFirst as string + providerId: paramsOrFirst as string, }; } - - const providerId = params.providerId; + const providerId = params.providerId; if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -4639,39 +6823,41 @@ export class Messaging { */ deleteProvider(providerId: string): Promise<{}>; deleteProvider( - paramsOrFirst: { providerId: string } | string + paramsOrFirst: { providerId: string } | string, ): Promise<{}> { let params: { providerId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { providerId: string }; } else { params = { - providerId: paramsOrFirst as string + providerId: paramsOrFirst as string, }; } - - const providerId = params.providerId; + const providerId = params.providerId; if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/messaging/providers/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -4683,7 +6869,11 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listTopics(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all topics from the current Appwrite project. * @@ -4694,52 +6884,59 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTopics(queries?: string[], search?: string, total?: boolean): Promise; listTopics( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listTopics( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/messaging/topics'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -4751,7 +6948,11 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createTopic(params: { topicId: string, name: string, subscribe?: string[] }): Promise; + createTopic(params: { + topicId: string; + name: string; + subscribe?: string[]; + }): Promise; /** * Create a new topic. * @@ -4762,64 +6963,72 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createTopic(topicId: string, name: string, subscribe?: string[]): Promise; createTopic( - paramsOrFirst: { topicId: string, name: string, subscribe?: string[] } | string, - ...rest: [(string)?, (string[])?] + topicId: string, + name: string, + subscribe?: string[], + ): Promise; + createTopic( + paramsOrFirst: + { topicId: string; name: string; subscribe?: string[] } | string, + ...rest: [string?, string[]?] ): Promise { - 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[] }; + 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[] + 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"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof topicId !== 'undefined') { - payload['topicId'] = topicId; + apiPayload['topicId'] = topicId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof subscribe !== 'undefined') { - payload['subscribe'] = subscribe; + apiPayload['subscribe'] = subscribe; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * Get a topic by its unique ID. - * + * * * @param {string} params.topicId - Topic ID. * @throws {AppwriteException} @@ -4828,7 +7037,7 @@ export class Messaging { getTopic(params: { topicId: string }): Promise; /** * Get a topic by its unique ID. - * + * * * @param {string} topicId - Topic ID. * @throws {AppwriteException} @@ -4837,44 +7046,46 @@ export class Messaging { */ getTopic(topicId: string): Promise; getTopic( - paramsOrFirst: { topicId: string } | string + paramsOrFirst: { topicId: string } | string, ): Promise { let params: { topicId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { topicId: string }; } else { params = { - topicId: paramsOrFirst as string + topicId: paramsOrFirst as string, }; } - - const topicId = params.topicId; + const topicId = params.topicId; if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); + throw new AppwriteException( + 'Missing required parameter: "topicId"', + ); } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', encodeURIComponent(String(topicId))); - const payload: Payload = {}; + const apiPath = '/messaging/topics/{topicId}'.replace( + '{topicId}', + encodeURIComponent(String(topicId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Update a topic by its unique ID. - * + * * * @param {string} params.topicId - Topic ID. * @param {string} params.name - Topic Name. @@ -4882,10 +7093,14 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - updateTopic(params: { topicId: string, name?: string, subscribe?: string[] }): Promise; + updateTopic(params: { + topicId: string; + name?: string; + subscribe?: string[]; + }): Promise; /** * Update a topic by its unique ID. - * + * * * @param {string} topicId - Topic ID. * @param {string} name - Topic Name. @@ -4894,53 +7109,64 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTopic(topicId: string, name?: string, subscribe?: string[]): Promise; updateTopic( - paramsOrFirst: { topicId: string, name?: string, subscribe?: string[] } | string, - ...rest: [(string)?, (string[])?] + topicId: string, + name?: string, + subscribe?: string[], + ): Promise; + updateTopic( + paramsOrFirst: + { topicId: string; name?: string; subscribe?: string[] } | string, + ...rest: [string?, string[]?] ): Promise { - 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[] }; + 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[] + 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"'); + throw new AppwriteException( + 'Missing required parameter: "topicId"', + ); } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', encodeURIComponent(String(topicId))); - const payload: Payload = {}; + const apiPath = '/messaging/topics/{topicId}'.replace( + '{topicId}', + encodeURIComponent(String(topicId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof subscribe !== 'undefined') { - payload['subscribe'] = subscribe; + apiPayload['subscribe'] = subscribe; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4960,40 +7186,40 @@ export class Messaging { * @deprecated Use the object parameter style method for a better developer experience. */ deleteTopic(topicId: string): Promise<{}>; - deleteTopic( - paramsOrFirst: { topicId: string } | string - ): Promise<{}> { + deleteTopic(paramsOrFirst: { topicId: string } | string): Promise<{}> { let params: { topicId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { topicId: string }; } else { params = { - topicId: paramsOrFirst as string + topicId: paramsOrFirst as string, }; } - - const topicId = params.topicId; + const topicId = params.topicId; if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); + throw new AppwriteException( + 'Missing required parameter: "topicId"', + ); } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', encodeURIComponent(String(topicId))); - const payload: Payload = {}; + const apiPath = '/messaging/topics/{topicId}'.replace( + '{topicId}', + encodeURIComponent(String(topicId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -5006,7 +7232,12 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listSubscribers(params: { + topicId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all subscribers from the current Appwrite project. * @@ -5018,57 +7249,81 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listSubscribers(topicId: string, queries?: string[], search?: string, total?: boolean): Promise; listSubscribers( - paramsOrFirst: { topicId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + topicId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listSubscribers( + paramsOrFirst: + | { + topicId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "topicId"', + ); } - - const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', encodeURIComponent(String(topicId))); - const payload: Payload = {}; + const apiPath = '/messaging/topics/{topicId}/subscribers'.replace( + '{topicId}', + encodeURIComponent(String(topicId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5080,7 +7335,11 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise; + createSubscriber(params: { + topicId: string; + subscriberId: string; + targetId: string; + }): Promise; /** * Create a new subscriber. * @@ -5091,74 +7350,93 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise; createSubscriber( - paramsOrFirst: { topicId: string, subscriberId: string, targetId: string } | string, - ...rest: [(string)?, (string)?] + topicId: string, + subscriberId: string, + targetId: string, + ): Promise; + createSubscriber( + paramsOrFirst: + | { topicId: string; subscriberId: string; targetId: string } + | string, + ...rest: [string?, string?] ): Promise { - let params: { topicId: string, subscriberId: string, targetId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string, targetId: string }; + let params: { topicId: string; subscriberId: string; targetId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + topicId: string; + subscriberId: string; + targetId: string; + }; } else { params = { topicId: paramsOrFirst as string, subscriberId: rest[0] as string, - targetId: rest[1] as string + targetId: rest[1] as string, }; } - + const topicId = params.topicId; const subscriberId = params.subscriberId; const targetId = params.targetId; - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); + throw new AppwriteException( + 'Missing required parameter: "topicId"', + ); } if (typeof subscriberId === 'undefined') { - throw new AppwriteException('Missing required parameter: "subscriberId"'); + throw new AppwriteException( + 'Missing required parameter: "subscriberId"', + ); } if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); + throw new AppwriteException( + 'Missing required parameter: "targetId"', + ); } - - const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', encodeURIComponent(String(topicId))); - const payload: Payload = {}; + const apiPath = '/messaging/topics/{topicId}/subscribers'.replace( + '{topicId}', + encodeURIComponent(String(topicId)), + ); + const apiPayload: Payload = {}; if (typeof subscriberId !== 'undefined') { - payload['subscriberId'] = subscriberId; + apiPayload['subscriberId'] = subscriberId; } if (typeof targetId !== 'undefined') { - payload['targetId'] = targetId; + apiPayload['targetId'] = targetId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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} */ - getSubscriber(params: { topicId: string, subscriberId: string }): Promise; + getSubscriber(params: { + topicId: string; + subscriberId: string; + }): Promise; /** * Get a subscriber by its unique ID. - * + * * * @param {string} topicId - Topic ID. The topic ID subscribed to. * @param {string} subscriberId - Subscriber ID. @@ -5166,47 +7444,59 @@ export class Messaging { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getSubscriber(topicId: string, subscriberId: string): Promise; getSubscriber( - paramsOrFirst: { topicId: string, subscriberId: string } | string, - ...rest: [(string)?] + topicId: string, + subscriberId: string, + ): Promise; + getSubscriber( + paramsOrFirst: { topicId: string; subscriberId: string } | string, + ...rest: [string?] ): Promise { - let params: { topicId: string, subscriberId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; + 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 + subscriberId: rest[0] as string, }; } - + const topicId = params.topicId; const subscriberId = params.subscriberId; - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); + 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}', encodeURIComponent(String(topicId))).replace('{subscriberId}', encodeURIComponent(String(subscriberId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "subscriberId"', + ); + } + const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}' + .replace('{topicId}', encodeURIComponent(String(topicId))) + .replace( + '{subscriberId}', + encodeURIComponent(String(subscriberId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5217,7 +7507,10 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>; + deleteSubscriber(params: { + topicId: string; + subscriberId: string; + }): Promise<{}>; /** * Delete a subscriber by its unique ID. * @@ -5229,44 +7522,53 @@ export class Messaging { */ deleteSubscriber(topicId: string, subscriberId: string): Promise<{}>; deleteSubscriber( - paramsOrFirst: { topicId: string, subscriberId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { topicId: string; subscriberId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { topicId: string, subscriberId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; + 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 + subscriberId: rest[0] as string, }; } - + const topicId = params.topicId; const subscriberId = params.subscriberId; - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); + 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}', encodeURIComponent(String(topicId))).replace('{subscriberId}', encodeURIComponent(String(subscriberId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "subscriberId"', + ); + } + const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}' + .replace('{topicId}', encodeURIComponent(String(topicId))) + .replace( + '{subscriberId}', + encodeURIComponent(String(subscriberId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/mongo.ts b/src/services/mongo.ts new file mode 100644 index 0000000..ad151b2 --- /dev/null +++ b/src/services/mongo.ts @@ -0,0 +1,2926 @@ +import { AppwriteException, Client, type Payload } from '../client'; +import type { Models } from '../models'; + +export class Mongo { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} params.queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { + queries?: string[]; + }): Promise; + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[]): Promise; + list( + paramsOrFirst?: { queries?: string[] } | string[], + ): Promise { + let params: { queries?: string[] }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[], + }; + } + + const queries = params.queries; + const apiPath = '/mongo'; + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} params.databaseId - Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Database display name. Max length: 128 chars. + * @param {string} params.version - Database engine version. Defaults to latest for selected engine. + * @param {string} params.specification - Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + * @param {number} params.replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} params.pitr - Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + * @param {number} params.pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }): Promise; + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} databaseId - Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Database display name. Max length: 128 chars. + * @param {string} version - Database engine version. Defaults to latest for selected engine. + * @param {string} specification - Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + * @param {number} replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} pitr - Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + * @param {number} pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create( + databaseId: string, + name: string, + version?: string, + specification?: string, + replicas?: number, + syncMode?: string, + networkIdleTimeoutSeconds?: number, + networkIPAllowlist?: string[], + idleTimeoutMinutes?: number, + pitr?: boolean, + pitrRetentionDays?: number, + storageAutoscaling?: boolean, + storageAutoscalingThresholdPercent?: number, + storageAutoscalingMaxGb?: number, + ): Promise; + create( + paramsOrFirst: + | { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + } + | string, + ...rest: [ + string?, + string?, + string?, + number?, + string?, + number?, + string[]?, + number?, + boolean?, + number?, + boolean?, + number?, + number?, + ] + ): Promise { + let params: { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + version: rest[1] as string, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + networkIdleTimeoutSeconds: rest[5] as number, + networkIPAllowlist: rest[6] as string[], + idleTimeoutMinutes: rest[7] as number, + pitr: rest[8] as boolean, + pitrRetentionDays: rest[9] as number, + storageAutoscaling: rest[10] as boolean, + storageAutoscalingThresholdPercent: rest[11] as number, + storageAutoscalingMaxGb: rest[12] as number, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const version = params.version; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const pitr = params.pitr; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = + params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/mongo'; + const apiPayload: Payload = {}; + if (typeof databaseId !== 'undefined') { + apiPayload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof version !== 'undefined') { + apiPayload['version'] = version; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + apiPayload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + apiPayload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + apiPayload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof pitr !== 'undefined') { + apiPayload['pitr'] = pitr; + } + if (typeof pitrRetentionDays !== 'undefined') { + apiPayload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + apiPayload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + apiPayload['storageAutoscalingThresholdPercent'] = + storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + apiPayload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listSpecifications(): Promise { + const apiPath = '/mongo/specifications'; + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { databaseId: string }): Promise; + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise; + get( + 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 = '/mongo/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Database display name. + * @param {string} params.status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + * @param {string} params.specification - Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + * @param {number} params.replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} params.pitr - Enable or disable point-in-time recovery (PITR). + * @param {number} params.pitrRetentionDays - Days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {number} params.metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} params.metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} params.sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} params.sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + * @param {number} params.sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} params.sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} params.sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }): Promise; + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Database display name. + * @param {string} status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + * @param {string} specification - Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + * @param {number} replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} pitr - Enable or disable point-in-time recovery (PITR). + * @param {number} pitrRetentionDays - Days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {number} metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + * @param {number} sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update( + databaseId: string, + name?: string, + status?: string, + specification?: string, + replicas?: number, + syncMode?: string, + networkIdleTimeoutSeconds?: number, + networkIPAllowlist?: string[], + idleTimeoutMinutes?: number, + pitr?: boolean, + pitrRetentionDays?: number, + storageAutoscaling?: boolean, + storageAutoscalingThresholdPercent?: number, + storageAutoscalingMaxGb?: number, + metricsTraceSampleRate?: number, + metricsSlowQueryLogThresholdMs?: number, + sqlApiEnabled?: boolean, + sqlApiAllowedStatements?: string[], + sqlApiMaxRows?: number, + sqlApiMaxBytes?: number, + sqlApiTimeoutSeconds?: number, + ): Promise; + update( + paramsOrFirst: + | { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + } + | string, + ...rest: [ + string?, + string?, + string?, + number?, + string?, + number?, + string[]?, + number?, + boolean?, + number?, + boolean?, + number?, + number?, + number?, + number?, + boolean?, + string[]?, + number?, + number?, + number?, + ] + ): Promise { + let params: { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + status: rest[1] as string, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + networkIdleTimeoutSeconds: rest[5] as number, + networkIPAllowlist: rest[6] as string[], + idleTimeoutMinutes: rest[7] as number, + pitr: rest[8] as boolean, + pitrRetentionDays: rest[9] as number, + storageAutoscaling: rest[10] as boolean, + storageAutoscalingThresholdPercent: rest[11] as number, + storageAutoscalingMaxGb: rest[12] as number, + metricsTraceSampleRate: rest[13] as number, + metricsSlowQueryLogThresholdMs: rest[14] as number, + sqlApiEnabled: rest[15] as boolean, + sqlApiAllowedStatements: rest[16] as string[], + sqlApiMaxRows: rest[17] as number, + sqlApiMaxBytes: rest[18] as number, + sqlApiTimeoutSeconds: rest[19] as number, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const status = params.status; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const pitr = params.pitr; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = + params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + const metricsTraceSampleRate = params.metricsTraceSampleRate; + const metricsSlowQueryLogThresholdMs = + params.metricsSlowQueryLogThresholdMs; + const sqlApiEnabled = params.sqlApiEnabled; + const sqlApiAllowedStatements = params.sqlApiAllowedStatements; + const sqlApiMaxRows = params.sqlApiMaxRows; + const sqlApiMaxBytes = params.sqlApiMaxBytes; + const sqlApiTimeoutSeconds = params.sqlApiTimeoutSeconds; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + apiPayload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + apiPayload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + apiPayload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof pitr !== 'undefined') { + apiPayload['pitr'] = pitr; + } + if (typeof pitrRetentionDays !== 'undefined') { + apiPayload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + apiPayload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + apiPayload['storageAutoscalingThresholdPercent'] = + storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + apiPayload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + if (typeof metricsTraceSampleRate !== 'undefined') { + apiPayload['metricsTraceSampleRate'] = metricsTraceSampleRate; + } + if (typeof metricsSlowQueryLogThresholdMs !== 'undefined') { + apiPayload['metricsSlowQueryLogThresholdMs'] = + metricsSlowQueryLogThresholdMs; + } + if (typeof sqlApiEnabled !== 'undefined') { + apiPayload['sqlApiEnabled'] = sqlApiEnabled; + } + if (typeof sqlApiAllowedStatements !== 'undefined') { + apiPayload['sqlApiAllowedStatements'] = sqlApiAllowedStatements; + } + if (typeof sqlApiMaxRows !== 'undefined') { + apiPayload['sqlApiMaxRows'] = sqlApiMaxRows; + } + if (typeof sqlApiMaxBytes !== 'undefined') { + apiPayload['sqlApiMaxBytes'] = sqlApiMaxBytes; + } + if (typeof sqlApiTimeoutSeconds !== 'undefined') { + apiPayload['sqlApiTimeoutSeconds'] = sqlApiTimeoutSeconds; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { databaseId: string }): Promise<{}>; + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. + * + * @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 = '/mongo/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + */ + listBackups(params: { + databaseId: string; + queries?: string[]; + }): Promise; + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBackups( + databaseId: string, + queries?: string[], + ): Promise; + listBackups( + paramsOrFirst: { databaseId: string; queries?: string[] } | string, + ...rest: [string[]?] + ): Promise { + let params: { databaseId: string; queries?: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + queries?: string[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + */ + createBackup(params: { + databaseId: string; + type?: string; + }): Promise; + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBackup( + databaseId: string, + type?: string, + ): Promise; + createBackup( + paramsOrFirst: { databaseId: string; type?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; type?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + type?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const type = params.type; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + */ + listBackupPolicies(params: { + databaseId: string; + queries?: string[]; + }): Promise; + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBackupPolicies( + databaseId: string, + queries?: string[], + ): Promise; + listBackupPolicies( + paramsOrFirst: { databaseId: string; queries?: string[] } | string, + ...rest: [string[]?] + ): Promise { + let params: { databaseId: string; queries?: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + queries?: string[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/policies'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.retention - Days to keep backups before deletion. + * @param {string} params.type - Backup type: full or incremental. + * @param {boolean} params.enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + */ + createBackupPolicy(params: { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }): Promise; + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} retention - Days to keep backups before deletion. + * @param {string} type - Backup type: full or incremental. + * @param {boolean} enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBackupPolicy( + databaseId: string, + policyId: string, + name: string, + schedule: string, + retention: number, + type?: string, + enabled?: boolean, + ): Promise; + createBackupPolicy( + paramsOrFirst: + | { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, number?, string?, boolean?] + ): Promise { + let params: { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + name: rest[1] as string, + schedule: rest[2] as string, + retention: rest[3] as number, + type: rest[4] as string, + enabled: rest[5] as boolean, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + const name = params.name; + const schedule = params.schedule; + const retention = params.retention; + const type = params.type; + const enabled = params.enabled; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof schedule === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "schedule"', + ); + } + if (typeof retention === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "retention"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/policies'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof policyId !== 'undefined') { + apiPayload['policyId'] = policyId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof schedule !== 'undefined') { + apiPayload['schedule'] = schedule; + } + if (typeof retention !== 'undefined') { + apiPayload['retention'] = retention; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getBackupPolicy(params: { + databaseId: string; + policyId: string; + }): Promise; + /** + * Get a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBackupPolicy( + databaseId: string, + policyId: string, + ): Promise; + getBackupPolicy( + paramsOrFirst: { databaseId: string; policyId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; policyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.retention - Days to keep backups before deletion. + * @param {boolean} params.enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBackupPolicy(params: { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }): Promise; + /** + * Update a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} retention - Days to keep backups before deletion. + * @param {boolean} enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBackupPolicy( + databaseId: string, + policyId: string, + name?: string, + schedule?: string, + retention?: number, + enabled?: boolean, + ): Promise; + updateBackupPolicy( + paramsOrFirst: + | { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, number?, boolean?] + ): Promise { + let params: { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + name: rest[1] as string, + schedule: rest[2] as string, + retention: rest[3] as number, + enabled: rest[4] as boolean, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + const name = params.name; + const schedule = params.schedule; + const retention = params.retention; + const enabled = params.enabled; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof schedule !== 'undefined') { + apiPayload['schedule'] = schedule; + } + if (typeof retention !== 'undefined') { + apiPayload['retention'] = retention; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBackupPolicy(params: { + databaseId: string; + policyId: string; + }): Promise<{}>; + /** + * Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBackupPolicy(databaseId: string, policyId: string): Promise<{}>; + deleteBackupPolicy( + paramsOrFirst: { databaseId: string; policyId: string } | string, + ...rest: [string?] + ): Promise<{}> { + let params: { databaseId: string; policyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} params.bucket - Storage bucket or container name. + * @param {string} params.accessKey - Access key or client ID for authentication. + * @param {string} params.secretKey - Secret key or service account JSON for authentication. + * @param {string} params.region - Storage region. + * @param {string} params.prefix - Object key prefix for backups. + * @param {string} params.endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBackupStorage(params: { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }): Promise; + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} databaseId - Database ID. + * @param {string} provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} bucket - Storage bucket or container name. + * @param {string} accessKey - Access key or client ID for authentication. + * @param {string} secretKey - Secret key or service account JSON for authentication. + * @param {string} region - Storage region. + * @param {string} prefix - Object key prefix for backups. + * @param {string} endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBackupStorage( + databaseId: string, + provider: string, + bucket: string, + accessKey: string, + secretKey: string, + region?: string, + prefix?: string, + endpoint?: string, + ): Promise; + updateBackupStorage( + paramsOrFirst: + | { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + } + | string, + ...rest: [string?, string?, string?, string?, string?, string?, string?] + ): Promise { + let params: { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + provider: rest[0] as string, + bucket: rest[1] as string, + accessKey: rest[2] as string, + secretKey: rest[3] as string, + region: rest[4] as string, + prefix: rest[5] as string, + endpoint: rest[6] as string, + }; + } + + const databaseId = params.databaseId; + const provider = params.provider; + const bucket = params.bucket; + const accessKey = params.accessKey; + const secretKey = params.secretKey; + const region = params.region; + const prefix = params.prefix; + const endpoint = params.endpoint; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof provider === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "provider"', + ); + } + if (typeof bucket === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucket"'); + } + if (typeof accessKey === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "accessKey"', + ); + } + if (typeof secretKey === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "secretKey"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/storage'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof provider !== 'undefined') { + apiPayload['provider'] = provider; + } + if (typeof bucket !== 'undefined') { + apiPayload['bucket'] = bucket; + } + if (typeof region !== 'undefined') { + apiPayload['region'] = region; + } + if (typeof prefix !== 'undefined') { + apiPayload['prefix'] = prefix; + } + if (typeof endpoint !== 'undefined') { + apiPayload['endpoint'] = endpoint; + } + if (typeof accessKey !== 'undefined') { + apiPayload['accessKey'] = accessKey; + } + if (typeof secretKey !== 'undefined') { + apiPayload['secretKey'] = secretKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getBackup(params: { + databaseId: string; + backupId: string; + }): Promise; + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBackup( + databaseId: string, + backupId: string, + ): Promise; + getBackup( + paramsOrFirst: { databaseId: string; backupId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; backupId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + backupId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "backupId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/{backupId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{backupId}', encodeURIComponent(String(backupId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBackup(params: { databaseId: string; backupId: string }): Promise<{}>; + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBackup(databaseId: string, backupId: string): Promise<{}>; + deleteBackup( + paramsOrFirst: { databaseId: string; backupId: string } | string, + ...rest: [string?] + ): Promise<{}> { + let params: { databaseId: string; backupId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + backupId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "backupId"', + ); + } + const apiPath = '/mongo/{databaseId}/backups/{backupId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{backupId}', encodeURIComponent(String(backupId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listBranches(params: { + databaseId: string; + }): Promise; + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBranches( + databaseId: string, + ): Promise; + listBranches( + 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 = '/mongo/{databaseId}/branches'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {number} params.ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + */ + createBranch(params: { + databaseId: string; + branchId?: string; + ttl?: number; + }): Promise; + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {number} ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBranch( + databaseId: string, + branchId?: string, + ttl?: number, + ): Promise; + createBranch( + paramsOrFirst: + { databaseId: string; branchId?: string; ttl?: number } | string, + ...rest: [string?, number?] + ): Promise { + let params: { databaseId: string; branchId?: string; ttl?: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + branchId?: string; + ttl?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string, + ttl: rest[1] as number, + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + const ttl = params.ttl; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/branches'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof branchId !== 'undefined') { + apiPayload['branchId'] = branchId; + } + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteBranch(params: { + databaseId: string; + branchId: string; + }): Promise; + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBranch( + databaseId: string, + branchId: string, + ): Promise; + deleteBranch( + paramsOrFirst: { databaseId: string; branchId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; branchId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + branchId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof branchId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "branchId"', + ); + } + const apiPath = '/mongo/{databaseId}/branches/{branchId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{branchId}', encodeURIComponent(String(branchId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateCredentials(params: { + databaseId: string; + }): Promise; + /** + * Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateCredentials(databaseId: string): Promise; + updateCredentials( + 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 = '/mongo/{databaseId}/credentials'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + */ + createFailover(params: { + databaseId: string; + targetReplicaId?: string; + }): Promise; + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} databaseId - Database ID. + * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFailover( + databaseId: string, + targetReplicaId?: string, + ): Promise; + createFailover( + paramsOrFirst: + { databaseId: string; targetReplicaId?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetReplicaId?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetReplicaId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetReplicaId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetReplicaId = params.targetReplicaId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/failovers'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetReplicaId !== 'undefined') { + apiPayload['targetReplicaId'] = targetReplicaId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} params.hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMaintenance(params: { + databaseId: string; + day: string; + hourUtc: number; + }): Promise; + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} databaseId - Database ID. + * @param {string} day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMaintenance( + databaseId: string, + day: string, + hourUtc: number, + ): Promise; + updateMaintenance( + paramsOrFirst: + { databaseId: string; day: string; hourUtc: number } | string, + ...rest: [string?, number?] + ): Promise { + let params: { databaseId: string; day: string; hourUtc: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + day: string; + hourUtc: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + day: rest[0] as string, + hourUtc: rest[1] as number, + }; + } + + const databaseId = params.databaseId; + const day = params.day; + const hourUtc = params.hourUtc; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof day === 'undefined') { + throw new AppwriteException('Missing required parameter: "day"'); + } + if (typeof hourUtc === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "hourUtc"', + ); + } + const apiPath = '/mongo/{databaseId}/maintenance'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof day !== 'undefined') { + apiPayload['day'] = day; + } + if (typeof hourUtc !== 'undefined') { + apiPayload['hourUtc'] = hourUtc; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} params.specification - Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + */ + createMigration(params: { + databaseId: string; + targetType: string; + specification?: string; + }): Promise; + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} specification - Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMigration( + databaseId: string, + targetType: string, + specification?: string, + ): Promise; + createMigration( + paramsOrFirst: + | { databaseId: string; targetType: string; specification?: string } + | string, + ...rest: [string?, string?] + ): Promise { + let params: { + databaseId: string; + targetType: string; + specification?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetType: string; + specification?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetType: rest[0] as string, + specification: rest[1] as string, + }; + } + + const databaseId = params.databaseId; + const targetType = params.targetType; + const specification = params.specification; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof targetType === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "targetType"', + ); + } + const apiPath = '/mongo/{databaseId}/migrations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetType !== 'undefined') { + apiPayload['targetType'] = targetType; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by operation status. + * @param {number} params.limit - Maximum number of operations to return. + * @param {number} params.offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listOperations(params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by operation status. + * @param {number} limit - Maximum number of operations to return. + * @param {number} offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOperations( + databaseId: string, + status?: string, + limit?: number, + offset?: number, + ): Promise; + listOperations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + limit: rest[1] as number, + offset: rest[2] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/operations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPitr(params: { + databaseId: string; + }): Promise; + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPitr(databaseId: string): Promise; + getPitr( + 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 = '/mongo/{databaseId}/pitr'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReplicas(params: { + databaseId: string; + }): Promise; + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReplicas(databaseId: string): Promise; + getReplicas( + 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 = '/mongo/{databaseId}/replicas'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by restoration status. + * @param {string} params.type - Filter by restoration type. + * @param {number} params.limit - Maximum number of restorations to return. + * @param {number} params.offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listRestorations(params: { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by restoration status. + * @param {string} type - Filter by restoration type. + * @param {number} limit - Maximum number of restorations to return. + * @param {number} offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRestorations( + databaseId: string, + status?: string, + type?: string, + limit?: number, + offset?: number, + ): Promise; + listRestorations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + type: rest[1] as string, + limit: rest[2] as number, + offset: rest[3] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const type = params.type; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/restorations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} params.backupId - Backup ID to restore from (required for backup type). + * @param {string} params.targetDatabaseId - Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + * @param {string} params.targetTime - Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + * @throws {AppwriteException} + * @returns {Promise} + */ + createRestoration(params: { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }): Promise; + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} backupId - Backup ID to restore from (required for backup type). + * @param {string} targetDatabaseId - Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + * @param {string} targetTime - Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRestoration( + databaseId: string, + type?: string, + backupId?: string, + targetDatabaseId?: string, + targetTime?: string, + ): Promise; + createRestoration( + paramsOrFirst: + | { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + } + | string, + ...rest: [string?, string?, string?, string?] + ): Promise { + let params: { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string, + backupId: rest[1] as string, + targetDatabaseId: rest[2] as string, + targetTime: rest[3] as string, + }; + } + + const databaseId = params.databaseId; + const type = params.type; + const backupId = params.backupId; + const targetDatabaseId = params.targetDatabaseId; + const targetTime = params.targetTime; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mongo/{databaseId}/restorations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof backupId !== 'undefined') { + apiPayload['backupId'] = backupId; + } + if (typeof targetDatabaseId !== 'undefined') { + apiPayload['targetDatabaseId'] = targetDatabaseId; + } + if (typeof targetTime !== 'undefined') { + apiPayload['targetTime'] = targetTime; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getRestoration(params: { + databaseId: string; + restorationId: string; + }): Promise; + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRestoration( + databaseId: string, + restorationId: string, + ): Promise; + getRestoration( + paramsOrFirst: { databaseId: string; restorationId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; restorationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + restorationId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + restorationId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const restorationId = params.restorationId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof restorationId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "restorationId"', + ); + } + const apiPath = '/mongo/{databaseId}/restorations/{restorationId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{restorationId}', + encodeURIComponent(String(restorationId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getStatus(params: { databaseId: string }): Promise; + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getStatus(databaseId: string): Promise; + getStatus( + 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 = '/mongo/{databaseId}/status'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + */ + createUpgrade(params: { + databaseId: string; + targetVersion: string; + }): Promise; + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createUpgrade( + databaseId: string, + targetVersion: string, + ): Promise; + createUpgrade( + paramsOrFirst: { databaseId: string; targetVersion: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetVersion: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetVersion: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetVersion: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetVersion = params.targetVersion; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof targetVersion === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "targetVersion"', + ); + } + const apiPath = '/mongo/{databaseId}/upgrades'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetVersion !== 'undefined') { + apiPayload['targetVersion'] = targetVersion; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } +} diff --git a/src/services/mysql.ts b/src/services/mysql.ts new file mode 100644 index 0000000..95b850e --- /dev/null +++ b/src/services/mysql.ts @@ -0,0 +1,3265 @@ +import { AppwriteException, Client, type Payload } from '../client'; +import type { Models } from '../models'; + +export class Mysql { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} params.queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { + queries?: string[]; + }): Promise; + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[]): Promise; + list( + paramsOrFirst?: { queries?: string[] } | string[], + ): Promise { + let params: { queries?: string[] }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[], + }; + } + + const queries = params.queries; + const apiPath = '/mysql'; + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} params.databaseId - Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Database display name. Max length: 128 chars. + * @param {string} params.version - Database engine version. Defaults to latest for selected engine. + * @param {string} params.specification - Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + * @param {number} params.replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} params.pitr - Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + * @param {number} params.pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }): Promise; + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} databaseId - Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Database display name. Max length: 128 chars. + * @param {string} version - Database engine version. Defaults to latest for selected engine. + * @param {string} specification - Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + * @param {number} replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} pitr - Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + * @param {number} pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create( + databaseId: string, + name: string, + version?: string, + specification?: string, + replicas?: number, + syncMode?: string, + networkIdleTimeoutSeconds?: number, + networkIPAllowlist?: string[], + idleTimeoutMinutes?: number, + pitr?: boolean, + pitrRetentionDays?: number, + storageAutoscaling?: boolean, + storageAutoscalingThresholdPercent?: number, + storageAutoscalingMaxGb?: number, + ): Promise; + create( + paramsOrFirst: + | { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + } + | string, + ...rest: [ + string?, + string?, + string?, + number?, + string?, + number?, + string[]?, + number?, + boolean?, + number?, + boolean?, + number?, + number?, + ] + ): Promise { + let params: { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + version: rest[1] as string, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + networkIdleTimeoutSeconds: rest[5] as number, + networkIPAllowlist: rest[6] as string[], + idleTimeoutMinutes: rest[7] as number, + pitr: rest[8] as boolean, + pitrRetentionDays: rest[9] as number, + storageAutoscaling: rest[10] as boolean, + storageAutoscalingThresholdPercent: rest[11] as number, + storageAutoscalingMaxGb: rest[12] as number, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const version = params.version; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const pitr = params.pitr; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = + params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/mysql'; + const apiPayload: Payload = {}; + if (typeof databaseId !== 'undefined') { + apiPayload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof version !== 'undefined') { + apiPayload['version'] = version; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + apiPayload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + apiPayload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + apiPayload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof pitr !== 'undefined') { + apiPayload['pitr'] = pitr; + } + if (typeof pitrRetentionDays !== 'undefined') { + apiPayload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + apiPayload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + apiPayload['storageAutoscalingThresholdPercent'] = + storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + apiPayload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listSpecifications(): Promise { + const apiPath = '/mysql/specifications'; + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { databaseId: string }): Promise; + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise; + get( + 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 = '/mysql/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Database display name. + * @param {string} params.status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + * @param {string} params.specification - Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + * @param {number} params.replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} params.pitr - Enable or disable point-in-time recovery (PITR). + * @param {number} params.pitrRetentionDays - Days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {number} params.metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} params.metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} params.sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} params.sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + * @param {number} params.sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} params.sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} params.sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }): Promise; + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Database display name. + * @param {string} status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + * @param {string} specification - Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + * @param {number} replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} pitr - Enable or disable point-in-time recovery (PITR). + * @param {number} pitrRetentionDays - Days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {number} metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + * @param {number} sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update( + databaseId: string, + name?: string, + status?: string, + specification?: string, + replicas?: number, + syncMode?: string, + networkIdleTimeoutSeconds?: number, + networkIPAllowlist?: string[], + idleTimeoutMinutes?: number, + pitr?: boolean, + pitrRetentionDays?: number, + storageAutoscaling?: boolean, + storageAutoscalingThresholdPercent?: number, + storageAutoscalingMaxGb?: number, + metricsTraceSampleRate?: number, + metricsSlowQueryLogThresholdMs?: number, + sqlApiEnabled?: boolean, + sqlApiAllowedStatements?: string[], + sqlApiMaxRows?: number, + sqlApiMaxBytes?: number, + sqlApiTimeoutSeconds?: number, + ): Promise; + update( + paramsOrFirst: + | { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + } + | string, + ...rest: [ + string?, + string?, + string?, + number?, + string?, + number?, + string[]?, + number?, + boolean?, + number?, + boolean?, + number?, + number?, + number?, + number?, + boolean?, + string[]?, + number?, + number?, + number?, + ] + ): Promise { + let params: { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + status: rest[1] as string, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + networkIdleTimeoutSeconds: rest[5] as number, + networkIPAllowlist: rest[6] as string[], + idleTimeoutMinutes: rest[7] as number, + pitr: rest[8] as boolean, + pitrRetentionDays: rest[9] as number, + storageAutoscaling: rest[10] as boolean, + storageAutoscalingThresholdPercent: rest[11] as number, + storageAutoscalingMaxGb: rest[12] as number, + metricsTraceSampleRate: rest[13] as number, + metricsSlowQueryLogThresholdMs: rest[14] as number, + sqlApiEnabled: rest[15] as boolean, + sqlApiAllowedStatements: rest[16] as string[], + sqlApiMaxRows: rest[17] as number, + sqlApiMaxBytes: rest[18] as number, + sqlApiTimeoutSeconds: rest[19] as number, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const status = params.status; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const pitr = params.pitr; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = + params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + const metricsTraceSampleRate = params.metricsTraceSampleRate; + const metricsSlowQueryLogThresholdMs = + params.metricsSlowQueryLogThresholdMs; + const sqlApiEnabled = params.sqlApiEnabled; + const sqlApiAllowedStatements = params.sqlApiAllowedStatements; + const sqlApiMaxRows = params.sqlApiMaxRows; + const sqlApiMaxBytes = params.sqlApiMaxBytes; + const sqlApiTimeoutSeconds = params.sqlApiTimeoutSeconds; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + apiPayload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + apiPayload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + apiPayload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof pitr !== 'undefined') { + apiPayload['pitr'] = pitr; + } + if (typeof pitrRetentionDays !== 'undefined') { + apiPayload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + apiPayload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + apiPayload['storageAutoscalingThresholdPercent'] = + storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + apiPayload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + if (typeof metricsTraceSampleRate !== 'undefined') { + apiPayload['metricsTraceSampleRate'] = metricsTraceSampleRate; + } + if (typeof metricsSlowQueryLogThresholdMs !== 'undefined') { + apiPayload['metricsSlowQueryLogThresholdMs'] = + metricsSlowQueryLogThresholdMs; + } + if (typeof sqlApiEnabled !== 'undefined') { + apiPayload['sqlApiEnabled'] = sqlApiEnabled; + } + if (typeof sqlApiAllowedStatements !== 'undefined') { + apiPayload['sqlApiAllowedStatements'] = sqlApiAllowedStatements; + } + if (typeof sqlApiMaxRows !== 'undefined') { + apiPayload['sqlApiMaxRows'] = sqlApiMaxRows; + } + if (typeof sqlApiMaxBytes !== 'undefined') { + apiPayload['sqlApiMaxBytes'] = sqlApiMaxBytes; + } + if (typeof sqlApiTimeoutSeconds !== 'undefined') { + apiPayload['sqlApiTimeoutSeconds'] = sqlApiTimeoutSeconds; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { databaseId: string }): Promise<{}>; + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. + * + * @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 = '/mysql/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + */ + listBackups(params: { + databaseId: string; + queries?: string[]; + }): Promise; + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBackups( + databaseId: string, + queries?: string[], + ): Promise; + listBackups( + paramsOrFirst: { databaseId: string; queries?: string[] } | string, + ...rest: [string[]?] + ): Promise { + let params: { databaseId: string; queries?: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + queries?: string[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + */ + createBackup(params: { + databaseId: string; + type?: string; + }): Promise; + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBackup( + databaseId: string, + type?: string, + ): Promise; + createBackup( + paramsOrFirst: { databaseId: string; type?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; type?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + type?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const type = params.type; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + */ + listBackupPolicies(params: { + databaseId: string; + queries?: string[]; + }): Promise; + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBackupPolicies( + databaseId: string, + queries?: string[], + ): Promise; + listBackupPolicies( + paramsOrFirst: { databaseId: string; queries?: string[] } | string, + ...rest: [string[]?] + ): Promise { + let params: { databaseId: string; queries?: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + queries?: string[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/policies'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.retention - Days to keep backups before deletion. + * @param {string} params.type - Backup type: full or incremental. + * @param {boolean} params.enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + */ + createBackupPolicy(params: { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }): Promise; + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} retention - Days to keep backups before deletion. + * @param {string} type - Backup type: full or incremental. + * @param {boolean} enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBackupPolicy( + databaseId: string, + policyId: string, + name: string, + schedule: string, + retention: number, + type?: string, + enabled?: boolean, + ): Promise; + createBackupPolicy( + paramsOrFirst: + | { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, number?, string?, boolean?] + ): Promise { + let params: { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + name: rest[1] as string, + schedule: rest[2] as string, + retention: rest[3] as number, + type: rest[4] as string, + enabled: rest[5] as boolean, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + const name = params.name; + const schedule = params.schedule; + const retention = params.retention; + const type = params.type; + const enabled = params.enabled; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof schedule === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "schedule"', + ); + } + if (typeof retention === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "retention"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/policies'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof policyId !== 'undefined') { + apiPayload['policyId'] = policyId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof schedule !== 'undefined') { + apiPayload['schedule'] = schedule; + } + if (typeof retention !== 'undefined') { + apiPayload['retention'] = retention; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getBackupPolicy(params: { + databaseId: string; + policyId: string; + }): Promise; + /** + * Get a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBackupPolicy( + databaseId: string, + policyId: string, + ): Promise; + getBackupPolicy( + paramsOrFirst: { databaseId: string; policyId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; policyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.retention - Days to keep backups before deletion. + * @param {boolean} params.enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBackupPolicy(params: { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }): Promise; + /** + * Update a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} retention - Days to keep backups before deletion. + * @param {boolean} enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBackupPolicy( + databaseId: string, + policyId: string, + name?: string, + schedule?: string, + retention?: number, + enabled?: boolean, + ): Promise; + updateBackupPolicy( + paramsOrFirst: + | { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, number?, boolean?] + ): Promise { + let params: { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + name: rest[1] as string, + schedule: rest[2] as string, + retention: rest[3] as number, + enabled: rest[4] as boolean, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + const name = params.name; + const schedule = params.schedule; + const retention = params.retention; + const enabled = params.enabled; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof schedule !== 'undefined') { + apiPayload['schedule'] = schedule; + } + if (typeof retention !== 'undefined') { + apiPayload['retention'] = retention; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBackupPolicy(params: { + databaseId: string; + policyId: string; + }): Promise<{}>; + /** + * Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBackupPolicy(databaseId: string, policyId: string): Promise<{}>; + deleteBackupPolicy( + paramsOrFirst: { databaseId: string; policyId: string } | string, + ...rest: [string?] + ): Promise<{}> { + let params: { databaseId: string; policyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} params.bucket - Storage bucket or container name. + * @param {string} params.accessKey - Access key or client ID for authentication. + * @param {string} params.secretKey - Secret key or service account JSON for authentication. + * @param {string} params.region - Storage region. + * @param {string} params.prefix - Object key prefix for backups. + * @param {string} params.endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBackupStorage(params: { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }): Promise; + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} databaseId - Database ID. + * @param {string} provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} bucket - Storage bucket or container name. + * @param {string} accessKey - Access key or client ID for authentication. + * @param {string} secretKey - Secret key or service account JSON for authentication. + * @param {string} region - Storage region. + * @param {string} prefix - Object key prefix for backups. + * @param {string} endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBackupStorage( + databaseId: string, + provider: string, + bucket: string, + accessKey: string, + secretKey: string, + region?: string, + prefix?: string, + endpoint?: string, + ): Promise; + updateBackupStorage( + paramsOrFirst: + | { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + } + | string, + ...rest: [string?, string?, string?, string?, string?, string?, string?] + ): Promise { + let params: { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + provider: rest[0] as string, + bucket: rest[1] as string, + accessKey: rest[2] as string, + secretKey: rest[3] as string, + region: rest[4] as string, + prefix: rest[5] as string, + endpoint: rest[6] as string, + }; + } + + const databaseId = params.databaseId; + const provider = params.provider; + const bucket = params.bucket; + const accessKey = params.accessKey; + const secretKey = params.secretKey; + const region = params.region; + const prefix = params.prefix; + const endpoint = params.endpoint; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof provider === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "provider"', + ); + } + if (typeof bucket === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucket"'); + } + if (typeof accessKey === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "accessKey"', + ); + } + if (typeof secretKey === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "secretKey"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/storage'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof provider !== 'undefined') { + apiPayload['provider'] = provider; + } + if (typeof bucket !== 'undefined') { + apiPayload['bucket'] = bucket; + } + if (typeof region !== 'undefined') { + apiPayload['region'] = region; + } + if (typeof prefix !== 'undefined') { + apiPayload['prefix'] = prefix; + } + if (typeof endpoint !== 'undefined') { + apiPayload['endpoint'] = endpoint; + } + if (typeof accessKey !== 'undefined') { + apiPayload['accessKey'] = accessKey; + } + if (typeof secretKey !== 'undefined') { + apiPayload['secretKey'] = secretKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getBackup(params: { + databaseId: string; + backupId: string; + }): Promise; + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBackup( + databaseId: string, + backupId: string, + ): Promise; + getBackup( + paramsOrFirst: { databaseId: string; backupId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; backupId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + backupId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "backupId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/{backupId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{backupId}', encodeURIComponent(String(backupId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBackup(params: { databaseId: string; backupId: string }): Promise<{}>; + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBackup(databaseId: string, backupId: string): Promise<{}>; + deleteBackup( + paramsOrFirst: { databaseId: string; backupId: string } | string, + ...rest: [string?] + ): Promise<{}> { + let params: { databaseId: string; backupId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + backupId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "backupId"', + ); + } + const apiPath = '/mysql/{databaseId}/backups/{backupId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{backupId}', encodeURIComponent(String(backupId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listBranches(params: { + databaseId: string; + }): Promise; + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBranches( + databaseId: string, + ): Promise; + listBranches( + 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 = '/mysql/{databaseId}/branches'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {number} params.ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + */ + createBranch(params: { + databaseId: string; + branchId?: string; + ttl?: number; + }): Promise; + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {number} ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBranch( + databaseId: string, + branchId?: string, + ttl?: number, + ): Promise; + createBranch( + paramsOrFirst: + { databaseId: string; branchId?: string; ttl?: number } | string, + ...rest: [string?, number?] + ): Promise { + let params: { databaseId: string; branchId?: string; ttl?: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + branchId?: string; + ttl?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string, + ttl: rest[1] as number, + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + const ttl = params.ttl; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/branches'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof branchId !== 'undefined') { + apiPayload['branchId'] = branchId; + } + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteBranch(params: { + databaseId: string; + branchId: string; + }): Promise; + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBranch( + databaseId: string, + branchId: string, + ): Promise; + deleteBranch( + paramsOrFirst: { databaseId: string; branchId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; branchId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + branchId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof branchId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "branchId"', + ); + } + const apiPath = '/mysql/{databaseId}/branches/{branchId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{branchId}', encodeURIComponent(String(branchId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateCredentials(params: { + databaseId: string; + }): Promise; + /** + * Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateCredentials(databaseId: string): Promise; + updateCredentials( + 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 = '/mysql/{databaseId}/credentials'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.sql - SQL statement to execute. Exactly one statement per request. + * @param {object} params.bindings - Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + * @param {number} params.timeoutSeconds - Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + * @throws {AppwriteException} + * @returns {Promise} + */ + createExecution(params: { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + }): Promise; + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. + * + * @param {string} databaseId - Database ID. + * @param {string} sql - SQL statement to execute. Exactly one statement per request. + * @param {object} bindings - Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + * @param {number} timeoutSeconds - Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createExecution( + databaseId: string, + sql: string, + bindings?: object, + timeoutSeconds?: number, + ): Promise; + createExecution( + paramsOrFirst: + | { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + } + | string, + ...rest: [string?, object?, number?] + ): Promise { + let params: { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + sql: rest[0] as string, + bindings: rest[1] as object, + timeoutSeconds: rest[2] as number, + }; + } + + const databaseId = params.databaseId; + const sql = params.sql; + const bindings = params.bindings; + const timeoutSeconds = params.timeoutSeconds; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof sql === 'undefined') { + throw new AppwriteException('Missing required parameter: "sql"'); + } + const apiPath = '/mysql/{databaseId}/executions'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof sql !== 'undefined') { + apiPayload['sql'] = sql; + } + if (typeof bindings !== 'undefined') { + apiPayload['bindings'] = bindings; + } + if (typeof timeoutSeconds !== 'undefined') { + apiPayload['timeoutSeconds'] = timeoutSeconds; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + */ + createFailover(params: { + databaseId: string; + targetReplicaId?: string; + }): Promise; + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} databaseId - Database ID. + * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFailover( + databaseId: string, + targetReplicaId?: string, + ): Promise; + createFailover( + paramsOrFirst: + { databaseId: string; targetReplicaId?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetReplicaId?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetReplicaId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetReplicaId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetReplicaId = params.targetReplicaId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/failovers'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetReplicaId !== 'undefined') { + apiPayload['targetReplicaId'] = targetReplicaId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} params.hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMaintenance(params: { + databaseId: string; + day: string; + hourUtc: number; + }): Promise; + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} databaseId - Database ID. + * @param {string} day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMaintenance( + databaseId: string, + day: string, + hourUtc: number, + ): Promise; + updateMaintenance( + paramsOrFirst: + { databaseId: string; day: string; hourUtc: number } | string, + ...rest: [string?, number?] + ): Promise { + let params: { databaseId: string; day: string; hourUtc: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + day: string; + hourUtc: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + day: rest[0] as string, + hourUtc: rest[1] as number, + }; + } + + const databaseId = params.databaseId; + const day = params.day; + const hourUtc = params.hourUtc; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof day === 'undefined') { + throw new AppwriteException('Missing required parameter: "day"'); + } + if (typeof hourUtc === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "hourUtc"', + ); + } + const apiPath = '/mysql/{databaseId}/maintenance'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof day !== 'undefined') { + apiPayload['day'] = day; + } + if (typeof hourUtc !== 'undefined') { + apiPayload['hourUtc'] = hourUtc; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} params.specification - Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + */ + createMigration(params: { + databaseId: string; + targetType: string; + specification?: string; + }): Promise; + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} specification - Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMigration( + databaseId: string, + targetType: string, + specification?: string, + ): Promise; + createMigration( + paramsOrFirst: + | { databaseId: string; targetType: string; specification?: string } + | string, + ...rest: [string?, string?] + ): Promise { + let params: { + databaseId: string; + targetType: string; + specification?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetType: string; + specification?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetType: rest[0] as string, + specification: rest[1] as string, + }; + } + + const databaseId = params.databaseId; + const targetType = params.targetType; + const specification = params.specification; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof targetType === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "targetType"', + ); + } + const apiPath = '/mysql/{databaseId}/migrations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetType !== 'undefined') { + apiPayload['targetType'] = targetType; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by operation status. + * @param {number} params.limit - Maximum number of operations to return. + * @param {number} params.offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listOperations(params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by operation status. + * @param {number} limit - Maximum number of operations to return. + * @param {number} offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOperations( + databaseId: string, + status?: string, + limit?: number, + offset?: number, + ): Promise; + listOperations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + limit: rest[1] as number, + offset: rest[2] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/operations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPitr(params: { + databaseId: string; + }): Promise; + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPitr(databaseId: string): Promise; + getPitr( + 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 = '/mysql/{databaseId}/pitr'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPooler(params: { + databaseId: string; + }): Promise; + /** + * Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPooler(databaseId: string): Promise; + getPooler( + 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 = '/mysql/{databaseId}/pooler'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.mode - Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + * @param {number} params.maxConnections - Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + * @param {number} params.defaultPoolSize - Default pool size per user. + * @param {boolean} params.readWriteSplitting - Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + * @param {string} params.poolerCpuRequest - Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + * @param {string} params.poolerCpuLimit - Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + * @param {string} params.poolerMemoryRequest - Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + * @param {string} params.poolerMemoryLimit - Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePooler(params: { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + }): Promise; + /** + * Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. + * + * @param {string} databaseId - Database ID. + * @param {string} mode - Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + * @param {number} maxConnections - Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + * @param {number} defaultPoolSize - Default pool size per user. + * @param {boolean} readWriteSplitting - Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + * @param {string} poolerCpuRequest - Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + * @param {string} poolerCpuLimit - Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + * @param {string} poolerMemoryRequest - Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + * @param {string} poolerMemoryLimit - Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePooler( + databaseId: string, + mode?: string, + maxConnections?: number, + defaultPoolSize?: number, + readWriteSplitting?: boolean, + poolerCpuRequest?: string, + poolerCpuLimit?: string, + poolerMemoryRequest?: string, + poolerMemoryLimit?: string, + ): Promise; + updatePooler( + paramsOrFirst: + | { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + } + | string, + ...rest: [ + string?, + number?, + number?, + boolean?, + string?, + string?, + string?, + string?, + ] + ): Promise { + let params: { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + mode: rest[0] as string, + maxConnections: rest[1] as number, + defaultPoolSize: rest[2] as number, + readWriteSplitting: rest[3] as boolean, + poolerCpuRequest: rest[4] as string, + poolerCpuLimit: rest[5] as string, + poolerMemoryRequest: rest[6] as string, + poolerMemoryLimit: rest[7] as string, + }; + } + + const databaseId = params.databaseId; + const mode = params.mode; + const maxConnections = params.maxConnections; + const defaultPoolSize = params.defaultPoolSize; + const readWriteSplitting = params.readWriteSplitting; + const poolerCpuRequest = params.poolerCpuRequest; + const poolerCpuLimit = params.poolerCpuLimit; + const poolerMemoryRequest = params.poolerMemoryRequest; + const poolerMemoryLimit = params.poolerMemoryLimit; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/pooler'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof mode !== 'undefined') { + apiPayload['mode'] = mode; + } + if (typeof maxConnections !== 'undefined') { + apiPayload['maxConnections'] = maxConnections; + } + if (typeof defaultPoolSize !== 'undefined') { + apiPayload['defaultPoolSize'] = defaultPoolSize; + } + if (typeof readWriteSplitting !== 'undefined') { + apiPayload['readWriteSplitting'] = readWriteSplitting; + } + if (typeof poolerCpuRequest !== 'undefined') { + apiPayload['poolerCpuRequest'] = poolerCpuRequest; + } + if (typeof poolerCpuLimit !== 'undefined') { + apiPayload['poolerCpuLimit'] = poolerCpuLimit; + } + if (typeof poolerMemoryRequest !== 'undefined') { + apiPayload['poolerMemoryRequest'] = poolerMemoryRequest; + } + if (typeof poolerMemoryLimit !== 'undefined') { + apiPayload['poolerMemoryLimit'] = poolerMemoryLimit; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReplicas(params: { + databaseId: string; + }): Promise; + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReplicas(databaseId: string): Promise; + getReplicas( + 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 = '/mysql/{databaseId}/replicas'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by restoration status. + * @param {string} params.type - Filter by restoration type. + * @param {number} params.limit - Maximum number of restorations to return. + * @param {number} params.offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listRestorations(params: { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by restoration status. + * @param {string} type - Filter by restoration type. + * @param {number} limit - Maximum number of restorations to return. + * @param {number} offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRestorations( + databaseId: string, + status?: string, + type?: string, + limit?: number, + offset?: number, + ): Promise; + listRestorations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + type: rest[1] as string, + limit: rest[2] as number, + offset: rest[3] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const type = params.type; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/restorations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} params.backupId - Backup ID to restore from (required for backup type). + * @param {string} params.targetDatabaseId - Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + * @param {string} params.targetTime - Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + * @throws {AppwriteException} + * @returns {Promise} + */ + createRestoration(params: { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }): Promise; + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} backupId - Backup ID to restore from (required for backup type). + * @param {string} targetDatabaseId - Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + * @param {string} targetTime - Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRestoration( + databaseId: string, + type?: string, + backupId?: string, + targetDatabaseId?: string, + targetTime?: string, + ): Promise; + createRestoration( + paramsOrFirst: + | { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + } + | string, + ...rest: [string?, string?, string?, string?] + ): Promise { + let params: { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string, + backupId: rest[1] as string, + targetDatabaseId: rest[2] as string, + targetTime: rest[3] as string, + }; + } + + const databaseId = params.databaseId; + const type = params.type; + const backupId = params.backupId; + const targetDatabaseId = params.targetDatabaseId; + const targetTime = params.targetTime; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/mysql/{databaseId}/restorations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof backupId !== 'undefined') { + apiPayload['backupId'] = backupId; + } + if (typeof targetDatabaseId !== 'undefined') { + apiPayload['targetDatabaseId'] = targetDatabaseId; + } + if (typeof targetTime !== 'undefined') { + apiPayload['targetTime'] = targetTime; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getRestoration(params: { + databaseId: string; + restorationId: string; + }): Promise; + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRestoration( + databaseId: string, + restorationId: string, + ): Promise; + getRestoration( + paramsOrFirst: { databaseId: string; restorationId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; restorationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + restorationId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + restorationId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const restorationId = params.restorationId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof restorationId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "restorationId"', + ); + } + const apiPath = '/mysql/{databaseId}/restorations/{restorationId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{restorationId}', + encodeURIComponent(String(restorationId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getStatus(params: { databaseId: string }): Promise; + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getStatus(databaseId: string): Promise; + getStatus( + 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 = '/mysql/{databaseId}/status'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + */ + createUpgrade(params: { + databaseId: string; + targetVersion: string; + }): Promise; + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createUpgrade( + databaseId: string, + targetVersion: string, + ): Promise; + createUpgrade( + paramsOrFirst: { databaseId: string; targetVersion: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetVersion: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetVersion: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetVersion: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetVersion = params.targetVersion; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof targetVersion === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "targetVersion"', + ); + } + const apiPath = '/mysql/{databaseId}/upgrades'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetVersion !== 'undefined') { + apiPayload['targetVersion'] = targetVersion; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } +} diff --git a/src/services/oauth-2.ts b/src/services/oauth-2.ts index 4458be3..b05acbd 100644 --- a/src/services/oauth-2.ts +++ b/src/services/oauth-2.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Oauth2 { client: Client; @@ -19,7 +17,11 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - approve(params: { grantId: string, authorizationDetails?: string, scope?: string }): Promise; + approve(params: { + grantId: string; + authorizationDetails?: string; + scope?: string; + }): Promise; /** * Approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. * @@ -30,55 +32,71 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - approve(grantId: string, authorizationDetails?: string, scope?: string): Promise; approve( - paramsOrFirst: { grantId: string, authorizationDetails?: string, scope?: string } | string, - ...rest: [(string)?, (string)?] + grantId: string, + authorizationDetails?: string, + scope?: string, + ): Promise; + approve( + paramsOrFirst: + | { grantId: string; authorizationDetails?: string; scope?: string } + | string, + ...rest: [string?, string?] ): Promise { - let params: { grantId: string, authorizationDetails?: string, scope?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { grantId: string, authorizationDetails?: string, scope?: string }; + let params: { + grantId: string; + authorizationDetails?: string; + scope?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + grantId: string; + authorizationDetails?: string; + scope?: string; + }; } else { params = { grantId: paramsOrFirst as string, authorizationDetails: rest[0] as string, - scope: rest[1] as string + scope: rest[1] as string, }; } - + const grantId = params.grantId; const authorizationDetails = params.authorizationDetails; const scope = params.scope; - if (typeof grantId === 'undefined') { - throw new AppwriteException('Missing required parameter: "grantId"'); + throw new AppwriteException( + 'Missing required parameter: "grantId"', + ); } - - const apiPath = '/oauth2/{project_id}/approve'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/approve'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof grantId !== 'undefined') { - payload['grant_id'] = grantId; + apiPayload['grant_id'] = grantId; } if (typeof authorizationDetails !== 'undefined') { - payload['authorization_details'] = authorizationDetails; + apiPayload['authorization_details'] = authorizationDetails; } if (typeof scope !== 'undefined') { - payload['scope'] = scope; + apiPayload['scope'] = scope; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -101,7 +119,22 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - authorize(params?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }): Promise; + authorize(params?: { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + }): Promise; /** * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. * @@ -123,15 +156,96 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - authorize(clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string): Promise; authorize( - paramsOrFirst?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (string)?, (string)?] + clientId?: string, + redirectUri?: string, + responseType?: string, + scope?: string, + state?: string, + nonce?: string, + codeChallenge?: string, + codeChallengeMethod?: string, + prompt?: string, + maxAge?: number, + authorizationDetails?: string, + resource?: string, + audience?: string, + requestUri?: string, + ): Promise; + authorize( + paramsOrFirst?: + | { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + } + | string, + ...rest: [ + string?, + string?, + string?, + string?, + string?, + string?, + string?, + string?, + number?, + string?, + string?, + string?, + string?, + ] ): Promise { - let params: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; + let params: { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + }; } else { params = { clientId: paramsOrFirst as string, @@ -147,10 +261,10 @@ export class Oauth2 { authorizationDetails: rest[9] as string, resource: rest[10] as string, audience: rest[11] as string, - requestUri: rest[12] as string + requestUri: rest[12] as string, }; } - + const clientId = params.clientId; const redirectUri = params.redirectUri; const responseType = params.responseType; @@ -165,64 +279,60 @@ export class Oauth2 { const resource = params.resource; const audience = params.audience; const requestUri = params.requestUri; - - - const apiPath = '/oauth2/{project_id}/authorize'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/authorize'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['client_id'] = clientId; + apiPayload['client_id'] = clientId; } if (typeof redirectUri !== 'undefined') { - payload['redirect_uri'] = redirectUri; + apiPayload['redirect_uri'] = redirectUri; } if (typeof responseType !== 'undefined') { - payload['response_type'] = responseType; + apiPayload['response_type'] = responseType; } if (typeof scope !== 'undefined') { - payload['scope'] = scope; + apiPayload['scope'] = scope; } if (typeof state !== 'undefined') { - payload['state'] = state; + apiPayload['state'] = state; } if (typeof nonce !== 'undefined') { - payload['nonce'] = nonce; + apiPayload['nonce'] = nonce; } if (typeof codeChallenge !== 'undefined') { - payload['code_challenge'] = codeChallenge; + apiPayload['code_challenge'] = codeChallenge; } if (typeof codeChallengeMethod !== 'undefined') { - payload['code_challenge_method'] = codeChallengeMethod; + apiPayload['code_challenge_method'] = codeChallengeMethod; } if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; + apiPayload['prompt'] = prompt; } if (typeof maxAge !== 'undefined') { - payload['max_age'] = maxAge; + apiPayload['max_age'] = maxAge; } if (typeof authorizationDetails !== 'undefined') { - payload['authorization_details'] = authorizationDetails; + apiPayload['authorization_details'] = authorizationDetails; } if (typeof resource !== 'undefined') { - payload['resource'] = resource; + apiPayload['resource'] = resource; } if (typeof audience !== 'undefined') { - payload['audience'] = audience; + apiPayload['audience'] = audience; } if (typeof requestUri !== 'undefined') { - payload['request_uri'] = requestUri; + apiPayload['request_uri'] = requestUri; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -245,7 +355,22 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - authorizePost(params?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }): Promise; + authorizePost(params?: { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + }): Promise; /** * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. * @@ -267,15 +392,96 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - authorizePost(clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string): Promise; authorizePost( - paramsOrFirst?: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (string)?, (string)?] + clientId?: string, + redirectUri?: string, + responseType?: string, + scope?: string, + state?: string, + nonce?: string, + codeChallenge?: string, + codeChallengeMethod?: string, + prompt?: string, + maxAge?: number, + authorizationDetails?: string, + resource?: string, + audience?: string, + requestUri?: string, + ): Promise; + authorizePost( + paramsOrFirst?: + | { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + } + | string, + ...rest: [ + string?, + string?, + string?, + string?, + string?, + string?, + string?, + string?, + number?, + string?, + string?, + string?, + string?, + ] ): Promise { - let params: { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, redirectUri?: string, responseType?: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string, requestUri?: string }; + let params: { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + clientId?: string; + redirectUri?: string; + responseType?: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + requestUri?: string; + }; } else { params = { clientId: paramsOrFirst as string, @@ -291,10 +497,10 @@ export class Oauth2 { authorizationDetails: rest[9] as string, resource: rest[10] as string, audience: rest[11] as string, - requestUri: rest[12] as string + requestUri: rest[12] as string, }; } - + const clientId = params.clientId; const redirectUri = params.redirectUri; const responseType = params.responseType; @@ -309,65 +515,61 @@ export class Oauth2 { const resource = params.resource; const audience = params.audience; const requestUri = params.requestUri; - - - const apiPath = '/oauth2/{project_id}/authorize'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/authorize'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['client_id'] = clientId; + apiPayload['client_id'] = clientId; } if (typeof redirectUri !== 'undefined') { - payload['redirect_uri'] = redirectUri; + apiPayload['redirect_uri'] = redirectUri; } if (typeof responseType !== 'undefined') { - payload['response_type'] = responseType; + apiPayload['response_type'] = responseType; } if (typeof scope !== 'undefined') { - payload['scope'] = scope; + apiPayload['scope'] = scope; } if (typeof state !== 'undefined') { - payload['state'] = state; + apiPayload['state'] = state; } if (typeof nonce !== 'undefined') { - payload['nonce'] = nonce; + apiPayload['nonce'] = nonce; } if (typeof codeChallenge !== 'undefined') { - payload['code_challenge'] = codeChallenge; + apiPayload['code_challenge'] = codeChallenge; } if (typeof codeChallengeMethod !== 'undefined') { - payload['code_challenge_method'] = codeChallengeMethod; + apiPayload['code_challenge_method'] = codeChallengeMethod; } if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; + apiPayload['prompt'] = prompt; } if (typeof maxAge !== 'undefined') { - payload['max_age'] = maxAge; + apiPayload['max_age'] = maxAge; } if (typeof authorizationDetails !== 'undefined') { - payload['authorization_details'] = authorizationDetails; + apiPayload['authorization_details'] = authorizationDetails; } if (typeof resource !== 'undefined') { - payload['resource'] = resource; + apiPayload['resource'] = resource; } if (typeof audience !== 'undefined') { - payload['audience'] = audience; + apiPayload['audience'] = audience; } if (typeof requestUri !== 'undefined') { - payload['request_uri'] = requestUri; + apiPayload['request_uri'] = requestUri; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -381,7 +583,13 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - createDeviceAuthorization(params?: { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string }): Promise; + createDeviceAuthorization(params?: { + clientId?: string; + scope?: string; + authorizationDetails?: string; + resource?: string; + audience?: string; + }): Promise; /** * Start the OAuth2 Device Authorization Grant. Returns the device code, user code, verification URL, expiration, and polling interval. * @@ -394,62 +602,89 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDeviceAuthorization(clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string): Promise; createDeviceAuthorization( - paramsOrFirst?: { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?] + clientId?: string, + scope?: string, + authorizationDetails?: string, + resource?: string, + audience?: string, + ): Promise; + createDeviceAuthorization( + paramsOrFirst?: + | { + clientId?: string; + scope?: string; + authorizationDetails?: string; + resource?: string; + audience?: string; + } + | string, + ...rest: [string?, string?, string?, string?] ): Promise { - let params: { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, scope?: string, authorizationDetails?: string, resource?: string, audience?: string }; + let params: { + clientId?: string; + scope?: string; + authorizationDetails?: string; + resource?: string; + audience?: string; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + clientId?: string; + scope?: string; + authorizationDetails?: string; + resource?: string; + audience?: string; + }; } else { params = { clientId: paramsOrFirst as string, scope: rest[0] as string, authorizationDetails: rest[1] as string, resource: rest[2] as string, - audience: rest[3] as string + audience: rest[3] as string, }; } - + const clientId = params.clientId; const scope = params.scope; const authorizationDetails = params.authorizationDetails; const resource = params.resource; const audience = params.audience; - - - const apiPath = '/oauth2/{project_id}/device_authorization'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/device_authorization'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['client_id'] = clientId; + apiPayload['client_id'] = clientId; } if (typeof scope !== 'undefined') { - payload['scope'] = scope; + apiPayload['scope'] = scope; } if (typeof authorizationDetails !== 'undefined') { - payload['authorization_details'] = authorizationDetails; + apiPayload['authorization_details'] = authorizationDetails; } if (typeof resource !== 'undefined') { - payload['resource'] = resource; + apiPayload['resource'] = resource; } if (typeof audience !== 'undefined') { - payload['audience'] = audience; + apiPayload['audience'] = audience; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -470,42 +705,44 @@ export class Oauth2 { */ createGrant(userCode: string): Promise; createGrant( - paramsOrFirst: { userCode: string } | string + paramsOrFirst: { userCode: string } | string, ): Promise { let params: { userCode: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userCode: string }; } else { params = { - userCode: paramsOrFirst as string + userCode: paramsOrFirst as string, }; } - - const userCode = params.userCode; + const userCode = params.userCode; if (typeof userCode === 'undefined') { - throw new AppwriteException('Missing required parameter: "userCode"'); + throw new AppwriteException( + 'Missing required parameter: "userCode"', + ); } - - const apiPath = '/oauth2/{project_id}/grants'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/grants'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof userCode !== 'undefined') { - payload['user_code'] = userCode; + apiPayload['user_code'] = userCode; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -526,38 +763,42 @@ export class Oauth2 { */ getGrant(grantId: string): Promise; getGrant( - paramsOrFirst: { grantId: string } | string + paramsOrFirst: { grantId: string } | string, ): Promise { let params: { grantId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { grantId: string }; } else { params = { - grantId: paramsOrFirst as string + grantId: paramsOrFirst as string, }; } - - const grantId = params.grantId; + const grantId = params.grantId; if (typeof grantId === 'undefined') { - throw new AppwriteException('Missing required parameter: "grantId"'); - } - - const apiPath = '/oauth2/{project_id}/grants/{grant_id}'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))).replace('{grant_id}', encodeURIComponent(String(grantId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "grantId"', + ); + } + const apiPath = '/oauth2/{project_id}/grants/{grant_id}' + .replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ) + .replace('{grant_id}', encodeURIComponent(String(grantId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -569,7 +810,11 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - listOrganizations(params?: { limit?: number, offset?: number, search?: string }): Promise; + listOrganizations(params?: { + limit?: number; + offset?: number; + search?: string; + }): Promise; /** * List the organizations the OAuth2 access token can access. Resolves the token's `organization` authorization details, expanding the `*` wildcard into the concrete set of organizations the user can see. * @@ -580,51 +825,61 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listOrganizations(limit?: number, offset?: number, search?: string): Promise; listOrganizations( - paramsOrFirst?: { limit?: number, offset?: number, search?: string } | number, - ...rest: [(number)?, (string)?] + limit?: number, + offset?: number, + search?: string, + ): Promise; + listOrganizations( + paramsOrFirst?: + { limit?: number; offset?: number; search?: string } | number, + ...rest: [number?, string?] ): Promise { - let params: { limit?: number, offset?: number, search?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { limit?: number, offset?: number, search?: string }; + let params: { limit?: number; offset?: number; search?: string }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + limit?: number; + offset?: number; + search?: string; + }; } else { params = { limit: paramsOrFirst as number, offset: rest[0] as number, - search: rest[1] as string + search: rest[1] as string, }; } - + const limit = params.limit; const offset = params.offset; const search = params.search; - - - const apiPath = '/oauth2/{project_id}/organizations'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/organizations'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof limit !== 'undefined') { - payload['limit'] = limit; + apiPayload['limit'] = limit; } if (typeof offset !== 'undefined') { - payload['offset'] = offset; + apiPayload['offset'] = offset; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -646,7 +901,21 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - createPAR(params: { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string }): Promise; + createPAR(params: { + clientId: string; + redirectUri: string; + responseType: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + }): Promise; /** * Store an OAuth2 authorization request server-side and receive a short-lived request_uri handle for the authorize endpoint. * @@ -667,15 +936,90 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPAR(clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string): Promise; createPAR( - paramsOrFirst: { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?, (string)?, (string)?] + clientId: string, + redirectUri: string, + responseType: string, + scope?: string, + state?: string, + nonce?: string, + codeChallenge?: string, + codeChallengeMethod?: string, + prompt?: string, + maxAge?: number, + authorizationDetails?: string, + resource?: string, + audience?: string, + ): Promise; + createPAR( + paramsOrFirst: + | { + clientId: string; + redirectUri: string; + responseType: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + } + | string, + ...rest: [ + string?, + string?, + string?, + string?, + string?, + string?, + string?, + string?, + number?, + string?, + string?, + string?, + ] ): Promise { - let params: { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId: string, redirectUri: string, responseType: string, scope?: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string, resource?: string, audience?: string }; + let params: { + clientId: string; + redirectUri: string; + responseType: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + clientId: string; + redirectUri: string; + responseType: string; + scope?: string; + state?: string; + nonce?: string; + codeChallenge?: string; + codeChallengeMethod?: string; + prompt?: string; + maxAge?: number; + authorizationDetails?: string; + resource?: string; + audience?: string; + }; } else { params = { clientId: paramsOrFirst as string, @@ -690,10 +1034,10 @@ export class Oauth2 { maxAge: rest[8] as number, authorizationDetails: rest[9] as string, resource: rest[10] as string, - audience: rest[11] as string + audience: rest[11] as string, }; } - + const clientId = params.clientId; const redirectUri = params.redirectUri; const responseType = params.responseType; @@ -707,71 +1051,73 @@ export class Oauth2 { const authorizationDetails = params.authorizationDetails; const resource = params.resource; const audience = params.audience; - if (typeof clientId === 'undefined') { - throw new AppwriteException('Missing required parameter: "clientId"'); + throw new AppwriteException( + 'Missing required parameter: "clientId"', + ); } if (typeof redirectUri === 'undefined') { - throw new AppwriteException('Missing required parameter: "redirectUri"'); + throw new AppwriteException( + 'Missing required parameter: "redirectUri"', + ); } if (typeof responseType === 'undefined') { - throw new AppwriteException('Missing required parameter: "responseType"'); + throw new AppwriteException( + 'Missing required parameter: "responseType"', + ); } - - const apiPath = '/oauth2/{project_id}/par'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/par'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['client_id'] = clientId; + apiPayload['client_id'] = clientId; } if (typeof redirectUri !== 'undefined') { - payload['redirect_uri'] = redirectUri; + apiPayload['redirect_uri'] = redirectUri; } if (typeof responseType !== 'undefined') { - payload['response_type'] = responseType; + apiPayload['response_type'] = responseType; } if (typeof scope !== 'undefined') { - payload['scope'] = scope; + apiPayload['scope'] = scope; } if (typeof state !== 'undefined') { - payload['state'] = state; + apiPayload['state'] = state; } if (typeof nonce !== 'undefined') { - payload['nonce'] = nonce; + apiPayload['nonce'] = nonce; } if (typeof codeChallenge !== 'undefined') { - payload['code_challenge'] = codeChallenge; + apiPayload['code_challenge'] = codeChallenge; } if (typeof codeChallengeMethod !== 'undefined') { - payload['code_challenge_method'] = codeChallengeMethod; + apiPayload['code_challenge_method'] = codeChallengeMethod; } if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; + apiPayload['prompt'] = prompt; } if (typeof maxAge !== 'undefined') { - payload['max_age'] = maxAge; + apiPayload['max_age'] = maxAge; } if (typeof authorizationDetails !== 'undefined') { - payload['authorization_details'] = authorizationDetails; + apiPayload['authorization_details'] = authorizationDetails; } if (typeof resource !== 'undefined') { - payload['resource'] = resource; + apiPayload['resource'] = resource; } if (typeof audience !== 'undefined') { - payload['audience'] = audience; + apiPayload['audience'] = audience; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -783,7 +1129,11 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - listProjects(params?: { limit?: number, offset?: number, search?: string }): Promise; + listProjects(params?: { + limit?: number; + offset?: number; + search?: string; + }): Promise; /** * List the projects the OAuth2 access token can access. Resolves the token's `project` authorization details, expanding the `*` wildcard into the concrete set of projects the user can see. * @@ -794,51 +1144,61 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listProjects(limit?: number, offset?: number, search?: string): Promise; listProjects( - paramsOrFirst?: { limit?: number, offset?: number, search?: string } | number, - ...rest: [(number)?, (string)?] + limit?: number, + offset?: number, + search?: string, + ): Promise; + listProjects( + paramsOrFirst?: + { limit?: number; offset?: number; search?: string } | number, + ...rest: [number?, string?] ): Promise { - let params: { limit?: number, offset?: number, search?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { limit?: number, offset?: number, search?: string }; + let params: { limit?: number; offset?: number; search?: string }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + limit?: number; + offset?: number; + search?: string; + }; } else { params = { limit: paramsOrFirst as number, offset: rest[0] as number, - search: rest[1] as string + search: rest[1] as string, }; } - + const limit = params.limit; const offset = params.offset; const search = params.search; - - - const apiPath = '/oauth2/{project_id}/projects'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/projects'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof limit !== 'undefined') { - payload['limit'] = limit; + apiPayload['limit'] = limit; } if (typeof offset !== 'undefined') { - payload['offset'] = offset; + apiPayload['offset'] = offset; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -859,42 +1219,44 @@ export class Oauth2 { */ reject(grantId: string): Promise; reject( - paramsOrFirst: { grantId: string } | string + paramsOrFirst: { grantId: string } | string, ): Promise { let params: { grantId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { grantId: string }; } else { params = { - grantId: paramsOrFirst as string + grantId: paramsOrFirst as string, }; } - - const grantId = params.grantId; + const grantId = params.grantId; if (typeof grantId === 'undefined') { - throw new AppwriteException('Missing required parameter: "grantId"'); + throw new AppwriteException( + 'Missing required parameter: "grantId"', + ); } - - const apiPath = '/oauth2/{project_id}/reject'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/reject'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof grantId !== 'undefined') { - payload['grant_id'] = grantId; + apiPayload['grant_id'] = grantId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -907,7 +1269,12 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise<{}>} */ - revoke(params: { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string }): Promise<{}>; + revoke(params: { + token: string; + tokenTypeHint?: string; + clientId?: string; + clientSecret?: string; + }): Promise<{}>; /** * Revoke an OAuth2 access token or refresh token. * @@ -919,60 +1286,82 @@ export class Oauth2 { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - revoke(token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string): Promise<{}>; revoke( - paramsOrFirst: { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + token: string, + tokenTypeHint?: string, + clientId?: string, + clientSecret?: string, + ): Promise<{}>; + revoke( + paramsOrFirst: + | { + token: string; + tokenTypeHint?: string; + clientId?: string; + clientSecret?: string; + } + | string, + ...rest: [string?, string?, string?] ): Promise<{}> { - let params: { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { token: string, tokenTypeHint?: string, clientId?: string, clientSecret?: string }; + let params: { + token: string; + tokenTypeHint?: string; + clientId?: string; + clientSecret?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + token: string; + tokenTypeHint?: string; + clientId?: string; + clientSecret?: string; + }; } else { params = { token: paramsOrFirst as string, tokenTypeHint: rest[0] as string, clientId: rest[1] as string, - clientSecret: rest[2] as string + clientSecret: rest[2] as string, }; } - + const token = params.token; const tokenTypeHint = params.tokenTypeHint; const clientId = params.clientId; const clientSecret = params.clientSecret; - if (typeof token === 'undefined') { throw new AppwriteException('Missing required parameter: "token"'); } - - const apiPath = '/oauth2/{project_id}/revoke'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/revoke'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof token !== 'undefined') { - payload['token'] = token; + apiPayload['token'] = token; } if (typeof tokenTypeHint !== 'undefined') { - payload['token_type_hint'] = tokenTypeHint; + apiPayload['token_type_hint'] = tokenTypeHint; } if (typeof clientId !== 'undefined') { - payload['client_id'] = clientId; + apiPayload['client_id'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['client_secret'] = clientSecret; + apiPayload['client_secret'] = clientSecret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -991,7 +1380,18 @@ export class Oauth2 { * @throws {AppwriteException} * @returns {Promise} */ - createToken(params: { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string }): Promise; + createToken(params: { + grantType: string; + code?: string; + refreshToken?: string; + deviceCode?: string; + clientId?: string; + clientSecret?: string; + codeVerifier?: string; + redirectUri?: string; + resource?: string; + audience?: string; + }): Promise; /** * Exchange an OAuth2 authorization code, refresh token, or device code for access and refresh tokens. * @@ -1009,15 +1409,75 @@ export class Oauth2 { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createToken(grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string): Promise; createToken( - paramsOrFirst: { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + grantType: string, + code?: string, + refreshToken?: string, + deviceCode?: string, + clientId?: string, + clientSecret?: string, + codeVerifier?: string, + redirectUri?: string, + resource?: string, + audience?: string, + ): Promise; + createToken( + paramsOrFirst: + | { + grantType: string; + code?: string; + refreshToken?: string; + deviceCode?: string; + clientId?: string; + clientSecret?: string; + codeVerifier?: string; + redirectUri?: string; + resource?: string; + audience?: string; + } + | string, + ...rest: [ + string?, + string?, + string?, + string?, + string?, + string?, + string?, + string?, + string?, + ] ): Promise { - let params: { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { grantType: string, code?: string, refreshToken?: string, deviceCode?: string, clientId?: string, clientSecret?: string, codeVerifier?: string, redirectUri?: string, resource?: string, audience?: string }; + let params: { + grantType: string; + code?: string; + refreshToken?: string; + deviceCode?: string; + clientId?: string; + clientSecret?: string; + codeVerifier?: string; + redirectUri?: string; + resource?: string; + audience?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + grantType: string; + code?: string; + refreshToken?: string; + deviceCode?: string; + clientId?: string; + clientSecret?: string; + codeVerifier?: string; + redirectUri?: string; + resource?: string; + audience?: string; + }; } else { params = { grantType: paramsOrFirst as string, @@ -1029,10 +1489,10 @@ export class Oauth2 { codeVerifier: rest[5] as string, redirectUri: rest[6] as string, resource: rest[7] as string, - audience: rest[8] as string + audience: rest[8] as string, }; } - + const grantType = params.grantType; const code = params.code; const refreshToken = params.refreshToken; @@ -1043,55 +1503,53 @@ export class Oauth2 { const redirectUri = params.redirectUri; const resource = params.resource; const audience = params.audience; - if (typeof grantType === 'undefined') { - throw new AppwriteException('Missing required parameter: "grantType"'); + throw new AppwriteException( + 'Missing required parameter: "grantType"', + ); } - - const apiPath = '/oauth2/{project_id}/token'.replace('{project_id}', encodeURIComponent(String(this.client.config.project))); - const payload: Payload = {}; + const apiPath = '/oauth2/{project_id}/token'.replace( + '{project_id}', + encodeURIComponent(String(this.client.config.project)), + ); + const apiPayload: Payload = {}; if (typeof grantType !== 'undefined') { - payload['grant_type'] = grantType; + apiPayload['grant_type'] = grantType; } if (typeof code !== 'undefined') { - payload['code'] = code; + apiPayload['code'] = code; } if (typeof refreshToken !== 'undefined') { - payload['refresh_token'] = refreshToken; + apiPayload['refresh_token'] = refreshToken; } if (typeof deviceCode !== 'undefined') { - payload['device_code'] = deviceCode; + apiPayload['device_code'] = deviceCode; } if (typeof clientId !== 'undefined') { - payload['client_id'] = clientId; + apiPayload['client_id'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['client_secret'] = clientSecret; + apiPayload['client_secret'] = clientSecret; } if (typeof codeVerifier !== 'undefined') { - payload['code_verifier'] = codeVerifier; + apiPayload['code_verifier'] = codeVerifier; } if (typeof redirectUri !== 'undefined') { - payload['redirect_uri'] = redirectUri; + apiPayload['redirect_uri'] = redirectUri; } if (typeof resource !== 'undefined') { - payload['resource'] = resource; + apiPayload['resource'] = resource; } if (typeof audience !== 'undefined') { - payload['audience'] = audience; + apiPayload['audience'] = audience; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } } diff --git a/src/services/organization.ts b/src/services/organization.ts index e286608..a79629b 100644 --- a/src/services/organization.ts +++ b/src/services/organization.ts @@ -1,10 +1,8 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - import { OrganizationKeyScopes } from '../enums/organization-key-scopes'; import { Region } from '../enums/region'; - export class Organization { client: Client; @@ -18,23 +16,19 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise>} */ - get(): Promise> { - + get< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(): Promise> { const apiPath = '/organization'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -44,7 +38,9 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise>} */ - update(params: { name: string }): Promise>; + update< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { name: string }): Promise>; /** * Update the current organization's name. * @@ -53,45 +49,44 @@ export class Organization { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - update(name: string): Promise>; update( - paramsOrFirst: { name: string } | string + name: string, + ): Promise>; + update( + paramsOrFirst: { name: string } | string, ): Promise> { let params: { name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { name: string }; } else { params = { - name: paramsOrFirst as string + name: paramsOrFirst as string, }; } - - const name = params.name; + const name = params.name; if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/organization'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -101,22 +96,16 @@ export class Organization { * @returns {Promise<{}>} */ delete(): Promise<{}> { - const apiPath = '/organization'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -127,7 +116,10 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - listInstallations(params?: { queries?: string[], total?: boolean }): Promise; + listInstallations(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * List app installations on the organization. Any organization member can read installations. * @@ -137,47 +129,51 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listInstallations(queries?: string[], total?: boolean): Promise; listInstallations( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listInstallations( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/organization/installations'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -188,7 +184,10 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - createInstallation(params: { appId: string, authorizationDetails?: string }): Promise; + createInstallation(params: { + appId: string; + authorizationDetails?: string; + }): Promise; /** * Install an app on the organization. Only organization members with the owner role can install apps. The installation is granted the scopes the app currently requests. * @@ -198,51 +197,55 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createInstallation(appId: string, authorizationDetails?: string): Promise; createInstallation( - paramsOrFirst: { appId: string, authorizationDetails?: string } | string, - ...rest: [(string)?] + appId: string, + authorizationDetails?: string, + ): Promise; + createInstallation( + paramsOrFirst: + { appId: string; authorizationDetails?: string } | string, + ...rest: [string?] ): Promise { - let params: { appId: string, authorizationDetails?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, authorizationDetails?: string }; + let params: { appId: string; authorizationDetails?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + appId: string; + authorizationDetails?: string; + }; } else { params = { appId: paramsOrFirst as string, - authorizationDetails: rest[0] as string + authorizationDetails: rest[0] as string, }; } - + const appId = params.appId; const authorizationDetails = params.authorizationDetails; - if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - const apiPath = '/organization/installations'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof appId !== 'undefined') { - payload['appId'] = appId; + apiPayload['appId'] = appId; } if (typeof authorizationDetails !== 'undefined') { - payload['authorizationDetails'] = authorizationDetails; + apiPayload['authorizationDetails'] = authorizationDetails; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -252,7 +255,9 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - getInstallation(params: { installationId: string }): Promise; + getInstallation(params: { + installationId: string; + }): Promise; /** * Get an app installation on the organization by its unique ID. Any organization member can read installations. * @@ -263,39 +268,41 @@ export class Organization { */ getInstallation(installationId: string): Promise; getInstallation( - paramsOrFirst: { installationId: string } | string + paramsOrFirst: { installationId: string } | string, ): Promise { let params: { installationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { installationId: string }; } else { params = { - installationId: paramsOrFirst as string + installationId: paramsOrFirst as string, }; } - - const installationId = params.installationId; + const installationId = params.installationId; if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); } - - const apiPath = '/organization/installations/{installationId}'.replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + const apiPath = '/organization/installations/{installationId}'.replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -306,7 +313,10 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - updateInstallation(params: { installationId: string, authorizationDetails?: string }): Promise; + updateInstallation(params: { + installationId: string; + authorizationDetails?: string; + }): Promise; /** * Update an app installation on the organization. Only organization members with the owner role can update installations. The installation's granted scopes are refreshed to the scopes the app currently requests; previously issued installation access tokens are revoked. * @@ -316,48 +326,57 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateInstallation(installationId: string, authorizationDetails?: string): Promise; updateInstallation( - paramsOrFirst: { installationId: string, authorizationDetails?: string } | string, - ...rest: [(string)?] + installationId: string, + authorizationDetails?: string, + ): Promise; + updateInstallation( + paramsOrFirst: + { installationId: string; authorizationDetails?: string } | string, + ...rest: [string?] ): Promise { - let params: { installationId: string, authorizationDetails?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { installationId: string, authorizationDetails?: string }; + let params: { installationId: string; authorizationDetails?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + installationId: string; + authorizationDetails?: string; + }; } else { params = { installationId: paramsOrFirst as string, - authorizationDetails: rest[0] as string + authorizationDetails: rest[0] as string, }; } - + const installationId = params.installationId; const authorizationDetails = params.authorizationDetails; - if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); } - - const apiPath = '/organization/installations/{installationId}'.replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + const apiPath = '/organization/installations/{installationId}'.replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; if (typeof authorizationDetails !== 'undefined') { - payload['authorizationDetails'] = authorizationDetails; + apiPayload['authorizationDetails'] = authorizationDetails; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -378,40 +397,42 @@ export class Organization { */ deleteInstallation(installationId: string): Promise<{}>; deleteInstallation( - paramsOrFirst: { installationId: string } | string + paramsOrFirst: { installationId: string } | string, ): Promise<{}> { let params: { installationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { installationId: string }; } else { params = { - installationId: paramsOrFirst as string + installationId: paramsOrFirst as string, }; } - - const installationId = params.installationId; + const installationId = params.installationId; if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); } - - const apiPath = '/organization/installations/{installationId}'.replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + const apiPath = '/organization/installations/{installationId}'.replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -422,7 +443,10 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - listKeys(params?: { queries?: string[], total?: boolean }): Promise; + listKeys(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all API keys from the current organization. * @@ -434,45 +458,46 @@ export class Organization { */ listKeys(queries?: string[], total?: boolean): Promise; listKeys( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/organization/keys'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -485,7 +510,12 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - createKey(params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }): Promise; + createKey(params: { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + }): Promise; /** * Create a new organization API key. * @@ -497,29 +527,54 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createKey(keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string): Promise; createKey( - paramsOrFirst: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string } | string, - ...rest: [(string)?, (OrganizationKeyScopes[])?, (string)?] + keyId: string, + name: string, + scopes: OrganizationKeyScopes[], + expire?: string, + ): Promise; + createKey( + paramsOrFirst: + | { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + } + | string, + ...rest: [string?, OrganizationKeyScopes[]?, string?] ): Promise { - let params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; + let params: { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + }; } else { params = { keyId: paramsOrFirst as string, name: rest[0] as string, scopes: rest[1] as OrganizationKeyScopes[], - expire: rest[2] as string + 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"'); } @@ -529,35 +584,29 @@ export class Organization { if (typeof scopes === 'undefined') { throw new AppwriteException('Missing required parameter: "scopes"'); } - const apiPath = '/organization/keys'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof keyId !== 'undefined') { - payload['keyId'] = keyId; + apiPayload['keyId'] = keyId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } if (typeof expire !== 'undefined') { - payload['expire'] = expire; + apiPayload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -577,40 +626,38 @@ export class Organization { * @deprecated Use the object parameter style method for a better developer experience. */ getKey(keyId: string): Promise; - getKey( - paramsOrFirst: { keyId: string } | string - ): Promise { + getKey(paramsOrFirst: { keyId: string } | string): Promise { let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { keyId: string }; } else { params = { - keyId: paramsOrFirst as string + keyId: paramsOrFirst as string, }; } - - const keyId = params.keyId; + const keyId = params.keyId; if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } - - const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/organization/keys/{keyId}'.replace( + '{keyId}', + encodeURIComponent(String(keyId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -623,7 +670,12 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - updateKey(params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }): Promise; + updateKey(params: { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + }): Promise; /** * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. * @@ -635,29 +687,54 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateKey(keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string): Promise; updateKey( - paramsOrFirst: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string } | string, - ...rest: [(string)?, (OrganizationKeyScopes[])?, (string)?] + keyId: string, + name: string, + scopes: OrganizationKeyScopes[], + expire?: string, + ): Promise; + updateKey( + paramsOrFirst: + | { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + } + | string, + ...rest: [string?, OrganizationKeyScopes[]?, string?] ): Promise { - let params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; + let params: { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + keyId: string; + name: string; + scopes: OrganizationKeyScopes[]; + expire?: string; + }; } else { params = { keyId: paramsOrFirst as string, name: rest[0] as string, scopes: rest[1] as OrganizationKeyScopes[], - expire: rest[2] as string + 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"'); } @@ -667,32 +744,29 @@ export class Organization { if (typeof scopes === 'undefined') { throw new AppwriteException('Missing required parameter: "scopes"'); } - - const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/organization/keys/{keyId}'.replace( + '{keyId}', + encodeURIComponent(String(keyId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } if (typeof expire !== 'undefined') { - payload['expire'] = expire; + apiPayload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -712,40 +786,38 @@ export class Organization { * @deprecated Use the object parameter style method for a better developer experience. */ deleteKey(keyId: string): Promise<{}>; - deleteKey( - paramsOrFirst: { keyId: string } | string - ): Promise<{}> { + deleteKey(paramsOrFirst: { keyId: string } | string): Promise<{}> { let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { keyId: string }; } else { params = { - keyId: paramsOrFirst as string + keyId: paramsOrFirst as string, }; } - - const keyId = params.keyId; + const keyId = params.keyId; if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } - - const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/organization/keys/{keyId}'.replace( + '{keyId}', + encodeURIComponent(String(keyId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -757,7 +829,11 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - listMemberships(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listMemberships(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all memberships from the current organization. * @@ -768,52 +844,59 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMemberships(queries?: string[], search?: string, total?: boolean): Promise; listMemberships( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listMemberships( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/organization/memberships'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -828,7 +911,14 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - createMembership(params: { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise; + createMembership(params: { + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + }): Promise; /** * Invite a new member to join the current organization. An email with a link to join the organization will be sent to the new member's email address. If member doesn't exist in the project it will be automatically created. * @@ -842,15 +932,49 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMembership(roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise; createMembership( - paramsOrFirst: { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string[], - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?] + roles: string[], + email?: string, + userId?: string, + phone?: string, + url?: string, + name?: string, + ): Promise; + createMembership( + paramsOrFirst: + | { + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + } + | string[], + ...rest: [string?, string?, string?, string?, string?] ): Promise { - let params: { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + let params: { + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + }; } else { params = { roles: paramsOrFirst as string[], @@ -858,55 +982,48 @@ export class Organization { userId: rest[1] as string, phone: rest[2] as string, url: rest[3] as string, - name: rest[4] as string + name: rest[4] as string, }; } - + const roles = params.roles; const email = params.email; const userId = params.userId; const phone = params.phone; const url = params.url; const name = params.name; - if (typeof roles === 'undefined') { throw new AppwriteException('Missing required parameter: "roles"'); } - const apiPath = '/organization/memberships'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof phone !== 'undefined') { - payload['phone'] = phone; + apiPayload['phone'] = phone; } if (typeof roles !== 'undefined') { - payload['roles'] = roles; + apiPayload['roles'] = roles; } if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -927,39 +1044,41 @@ export class Organization { */ getMembership(membershipId: string): Promise; getMembership( - paramsOrFirst: { membershipId: string } | string + paramsOrFirst: { membershipId: string } | string, ): Promise { let params: { membershipId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { membershipId: string }; } else { params = { - membershipId: paramsOrFirst as string + membershipId: paramsOrFirst as string, }; } - - const membershipId = params.membershipId; + const membershipId = params.membershipId; if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); + throw new AppwriteException( + 'Missing required parameter: "membershipId"', + ); } - - const apiPath = '/organization/memberships/{membershipId}'.replace('{membershipId}', encodeURIComponent(String(membershipId))); - const payload: Payload = {}; + const apiPath = '/organization/memberships/{membershipId}'.replace( + '{membershipId}', + encodeURIComponent(String(membershipId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -970,7 +1089,10 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - updateMembership(params: { membershipId: string, roles: string[] }): Promise; + updateMembership(params: { + membershipId: string; + roles: string[]; + }): Promise; /** * Modify the roles of a member in the current organization. * @@ -980,51 +1102,59 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMembership(membershipId: string, roles: string[]): Promise; updateMembership( - paramsOrFirst: { membershipId: string, roles: string[] } | string, - ...rest: [(string[])?] + membershipId: string, + roles: string[], + ): Promise; + updateMembership( + paramsOrFirst: { membershipId: string; roles: string[] } | string, + ...rest: [string[]?] ): Promise { - let params: { membershipId: string, roles: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { membershipId: string, roles: string[] }; + let params: { membershipId: string; roles: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + membershipId: string; + roles: string[]; + }; } else { params = { membershipId: paramsOrFirst as string, - roles: rest[0] as string[] + roles: rest[0] as string[], }; } - + const membershipId = params.membershipId; const roles = params.roles; - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); + throw new AppwriteException( + 'Missing required parameter: "membershipId"', + ); } if (typeof roles === 'undefined') { throw new AppwriteException('Missing required parameter: "roles"'); } - - const apiPath = '/organization/memberships/{membershipId}'.replace('{membershipId}', encodeURIComponent(String(membershipId))); - const payload: Payload = {}; + const apiPath = '/organization/memberships/{membershipId}'.replace( + '{membershipId}', + encodeURIComponent(String(membershipId)), + ); + const apiPayload: Payload = {}; if (typeof roles !== 'undefined') { - payload['roles'] = roles; + apiPayload['roles'] = roles; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1045,39 +1175,41 @@ export class Organization { */ deleteMembership(membershipId: string): Promise<{}>; deleteMembership( - paramsOrFirst: { membershipId: string } | string + paramsOrFirst: { membershipId: string } | string, ): Promise<{}> { let params: { membershipId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { membershipId: string }; } else { params = { - membershipId: paramsOrFirst as string + membershipId: paramsOrFirst as string, }; } - - const membershipId = params.membershipId; + const membershipId = params.membershipId; if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); + throw new AppwriteException( + 'Missing required parameter: "membershipId"', + ); } - - const apiPath = '/organization/memberships/{membershipId}'.replace('{membershipId}', encodeURIComponent(String(membershipId))); - const payload: Payload = {}; + const apiPath = '/organization/memberships/{membershipId}'.replace( + '{membershipId}', + encodeURIComponent(String(membershipId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1089,7 +1221,11 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - listProjects(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listProjects(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all projects. You can use the query params to filter your results. * @@ -1100,52 +1236,59 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listProjects(queries?: string[], search?: string, total?: boolean): Promise; listProjects( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listProjects( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/organization/projects'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1157,7 +1300,11 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - createProject(params: { projectId: string, name: string, region?: Region }): Promise; + createProject(params: { + projectId: string; + name: string; + region?: Region; + }): Promise; /** * Create a new project. * @@ -1168,59 +1315,67 @@ export class Organization { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createProject(projectId: string, name: string, region?: Region): Promise; createProject( - paramsOrFirst: { projectId: string, name: string, region?: Region } | string, - ...rest: [(string)?, (Region)?] + projectId: string, + name: string, + region?: Region, + ): Promise; + createProject( + paramsOrFirst: + { projectId: string; name: string; region?: Region } | string, + ...rest: [string?, Region?] ): Promise { - let params: { projectId: string, name: string, region?: Region }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, name: string, region?: Region }; + let params: { projectId: string; name: string; region?: Region }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + projectId: string; + name: string; + region?: Region; + }; } else { params = { projectId: paramsOrFirst as string, name: rest[0] as string, - region: rest[1] as Region + region: rest[1] as Region, }; } - + const projectId = params.projectId; const name = params.name; const region = params.region; - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); + throw new AppwriteException( + 'Missing required parameter: "projectId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/organization/projects'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof projectId !== 'undefined') { - payload['projectId'] = projectId; + apiPayload['projectId'] = projectId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof region !== 'undefined') { - payload['region'] = region; + apiPayload['region'] = region; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1241,38 +1396,40 @@ export class Organization { */ getProject(projectId: string): Promise; getProject( - paramsOrFirst: { projectId: string } | string + paramsOrFirst: { projectId: string } | string, ): Promise { let params: { projectId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { projectId: string }; } else { params = { - projectId: paramsOrFirst as string + projectId: paramsOrFirst as string, }; } - - const projectId = params.projectId; + const projectId = params.projectId; if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); + throw new AppwriteException( + 'Missing required parameter: "projectId"', + ); } - - const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', encodeURIComponent(String(projectId))); - const payload: Payload = {}; + const apiPath = '/organization/projects/{projectId}'.replace( + '{projectId}', + encodeURIComponent(String(projectId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - } + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1283,7 +1440,10 @@ export class Organization { * @throws {AppwriteException} * @returns {Promise} */ - updateProject(params: { projectId: string, name: string }): Promise; + updateProject(params: { + projectId: string; + name: string; + }): Promise; /** * Update a project by its unique ID. * @@ -1295,49 +1455,54 @@ export class Organization { */ updateProject(projectId: string, name: string): Promise; updateProject( - paramsOrFirst: { projectId: string, name: string } | string, - ...rest: [(string)?] + paramsOrFirst: { projectId: string; name: string } | string, + ...rest: [string?] ): Promise { - let params: { projectId: string, name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, name: string }; + let params: { projectId: string; name: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + projectId: string; + name: string; + }; } else { params = { projectId: paramsOrFirst as string, - name: rest[0] as string + name: rest[0] as string, }; } - + const projectId = params.projectId; const name = params.name; - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); + throw new AppwriteException( + 'Missing required parameter: "projectId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - - const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', encodeURIComponent(String(projectId))); - const payload: Payload = {}; + const apiPath = '/organization/projects/{projectId}'.replace( + '{projectId}', + encodeURIComponent(String(projectId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1357,39 +1522,39 @@ export class Organization { * @deprecated Use the object parameter style method for a better developer experience. */ deleteProject(projectId: string): Promise<{}>; - deleteProject( - paramsOrFirst: { projectId: string } | string - ): Promise<{}> { + deleteProject(paramsOrFirst: { projectId: string } | string): Promise<{}> { let params: { projectId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { projectId: string }; } else { params = { - projectId: paramsOrFirst as string + projectId: paramsOrFirst as string, }; } - - const projectId = params.projectId; + const projectId = params.projectId; if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); + throw new AppwriteException( + 'Missing required parameter: "projectId"', + ); } - - const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', encodeURIComponent(String(projectId))); - const payload: Payload = {}; + const apiPath = '/organization/projects/{projectId}'.replace( + '{projectId}', + encodeURIComponent(String(projectId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/postgresql.ts b/src/services/postgresql.ts new file mode 100644 index 0000000..414d7be --- /dev/null +++ b/src/services/postgresql.ts @@ -0,0 +1,3477 @@ +import { AppwriteException, Client, type Payload } from '../client'; +import type { Models } from '../models'; + +export class Postgresql { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} params.queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { + queries?: string[]; + }): Promise; + /** + * List all dedicated databases. Results support pagination. + * + * @param {string[]} queries - Array of query strings. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[]): Promise; + list( + paramsOrFirst?: { queries?: string[] } | string[], + ): Promise { + let params: { queries?: string[] }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[], + }; + } + + const queries = params.queries; + const apiPath = '/postgresql'; + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} params.databaseId - Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Database display name. Max length: 128 chars. + * @param {string} params.version - Database engine version. Defaults to latest for selected engine. + * @param {string} params.specification - Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + * @param {number} params.replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} params.pitr - Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + * @param {number} params.pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }): Promise; + /** + * Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. + * + * @param {string} databaseId - Database ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Database display name. Max length: 128 chars. + * @param {string} version - Database engine version. Defaults to latest for selected engine. + * @param {string} specification - Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. + * @param {number} replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds. + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes of inactivity before container scales to zero. + * @param {boolean} pitr - Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. + * @param {number} pitrRetentionDays - Number of days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create( + databaseId: string, + name: string, + version?: string, + specification?: string, + replicas?: number, + syncMode?: string, + networkIdleTimeoutSeconds?: number, + networkIPAllowlist?: string[], + idleTimeoutMinutes?: number, + pitr?: boolean, + pitrRetentionDays?: number, + storageAutoscaling?: boolean, + storageAutoscalingThresholdPercent?: number, + storageAutoscalingMaxGb?: number, + ): Promise; + create( + paramsOrFirst: + | { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + } + | string, + ...rest: [ + string?, + string?, + string?, + number?, + string?, + number?, + string[]?, + number?, + boolean?, + number?, + boolean?, + number?, + number?, + ] + ): Promise { + let params: { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + version?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + version: rest[1] as string, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + networkIdleTimeoutSeconds: rest[5] as number, + networkIPAllowlist: rest[6] as string[], + idleTimeoutMinutes: rest[7] as number, + pitr: rest[8] as boolean, + pitrRetentionDays: rest[9] as number, + storageAutoscaling: rest[10] as boolean, + storageAutoscalingThresholdPercent: rest[11] as number, + storageAutoscalingMaxGb: rest[12] as number, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const version = params.version; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const pitr = params.pitr; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = + params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/postgresql'; + const apiPayload: Payload = {}; + if (typeof databaseId !== 'undefined') { + apiPayload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof version !== 'undefined') { + apiPayload['version'] = version; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + apiPayload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + apiPayload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + apiPayload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof pitr !== 'undefined') { + apiPayload['pitr'] = pitr; + } + if (typeof pitrRetentionDays !== 'undefined') { + apiPayload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + apiPayload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + apiPayload['storageAutoscalingThresholdPercent'] = + storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + apiPayload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listSpecifications(): Promise { + const apiPath = '/postgresql/specifications'; + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { databaseId: string }): Promise; + /** + * Get a dedicated database by its unique ID. Returns the database configuration and current status. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise; + get( + 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 = '/postgresql/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Database display name. + * @param {string} params.status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + * @param {string} params.specification - Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + * @param {number} params.replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} params.networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} params.networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} params.idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} params.pitr - Enable or disable point-in-time recovery (PITR). + * @param {number} params.pitrRetentionDays - Days to retain PITR data. + * @param {boolean} params.storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} params.storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} params.storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {number} params.metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} params.metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} params.sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} params.sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + * @param {number} params.sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} params.sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} params.sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }): Promise; + /** + * Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Database display name. + * @param {string} status - Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. + * @param {string} specification - Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. + * @param {number} replicas - Number of high availability replicas (0-5). High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode preference. Allowed values: async, sync, quorum. + * @param {number} networkIdleTimeoutSeconds - Connection idle timeout in seconds (60-86400). + * @param {string[]} networkIPAllowlist - IP addresses/CIDR ranges allowed to connect. + * @param {number} idleTimeoutMinutes - Minutes before container scales to zero. + * @param {boolean} pitr - Enable or disable point-in-time recovery (PITR). + * @param {number} pitrRetentionDays - Days to retain PITR data. + * @param {boolean} storageAutoscaling - Enable automatic storage expansion when usage exceeds threshold. + * @param {number} storageAutoscalingThresholdPercent - Storage usage percentage (50-95) that triggers automatic expansion. + * @param {number} storageAutoscalingMaxGb - Maximum storage size in GB for autoscaling. 0 means no limit. + * @param {number} metricsTraceSampleRate - Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. + * @param {number} metricsSlowQueryLogThresholdMs - Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. + * @param {boolean} sqlApiEnabled - Enable the SQL API sidecar for this database. + * @param {string[]} sqlApiAllowedStatements - Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. + * @param {number} sqlApiMaxRows - Maximum rows returned per SQL API execution (1-1000000). + * @param {number} sqlApiMaxBytes - Maximum serialised SQL API result payload in bytes (1024-104857600). + * @param {number} sqlApiTimeoutSeconds - Per-call SQL API execution timeout in seconds (1-300). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update( + databaseId: string, + name?: string, + status?: string, + specification?: string, + replicas?: number, + syncMode?: string, + networkIdleTimeoutSeconds?: number, + networkIPAllowlist?: string[], + idleTimeoutMinutes?: number, + pitr?: boolean, + pitrRetentionDays?: number, + storageAutoscaling?: boolean, + storageAutoscalingThresholdPercent?: number, + storageAutoscalingMaxGb?: number, + metricsTraceSampleRate?: number, + metricsSlowQueryLogThresholdMs?: number, + sqlApiEnabled?: boolean, + sqlApiAllowedStatements?: string[], + sqlApiMaxRows?: number, + sqlApiMaxBytes?: number, + sqlApiTimeoutSeconds?: number, + ): Promise; + update( + paramsOrFirst: + | { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + } + | string, + ...rest: [ + string?, + string?, + string?, + number?, + string?, + number?, + string[]?, + number?, + boolean?, + number?, + boolean?, + number?, + number?, + number?, + number?, + boolean?, + string[]?, + number?, + number?, + number?, + ] + ): Promise { + let params: { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name?: string; + status?: string; + specification?: string; + replicas?: number; + syncMode?: string; + networkIdleTimeoutSeconds?: number; + networkIPAllowlist?: string[]; + idleTimeoutMinutes?: number; + pitr?: boolean; + pitrRetentionDays?: number; + storageAutoscaling?: boolean; + storageAutoscalingThresholdPercent?: number; + storageAutoscalingMaxGb?: number; + metricsTraceSampleRate?: number; + metricsSlowQueryLogThresholdMs?: number; + sqlApiEnabled?: boolean; + sqlApiAllowedStatements?: string[]; + sqlApiMaxRows?: number; + sqlApiMaxBytes?: number; + sqlApiTimeoutSeconds?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + status: rest[1] as string, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + networkIdleTimeoutSeconds: rest[5] as number, + networkIPAllowlist: rest[6] as string[], + idleTimeoutMinutes: rest[7] as number, + pitr: rest[8] as boolean, + pitrRetentionDays: rest[9] as number, + storageAutoscaling: rest[10] as boolean, + storageAutoscalingThresholdPercent: rest[11] as number, + storageAutoscalingMaxGb: rest[12] as number, + metricsTraceSampleRate: rest[13] as number, + metricsSlowQueryLogThresholdMs: rest[14] as number, + sqlApiEnabled: rest[15] as boolean, + sqlApiAllowedStatements: rest[16] as string[], + sqlApiMaxRows: rest[17] as number, + sqlApiMaxBytes: rest[18] as number, + sqlApiTimeoutSeconds: rest[19] as number, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const status = params.status; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + const networkIdleTimeoutSeconds = params.networkIdleTimeoutSeconds; + const networkIPAllowlist = params.networkIPAllowlist; + const idleTimeoutMinutes = params.idleTimeoutMinutes; + const pitr = params.pitr; + const pitrRetentionDays = params.pitrRetentionDays; + const storageAutoscaling = params.storageAutoscaling; + const storageAutoscalingThresholdPercent = + params.storageAutoscalingThresholdPercent; + const storageAutoscalingMaxGb = params.storageAutoscalingMaxGb; + const metricsTraceSampleRate = params.metricsTraceSampleRate; + const metricsSlowQueryLogThresholdMs = + params.metricsSlowQueryLogThresholdMs; + const sqlApiEnabled = params.sqlApiEnabled; + const sqlApiAllowedStatements = params.sqlApiAllowedStatements; + const sqlApiMaxRows = params.sqlApiMaxRows; + const sqlApiMaxBytes = params.sqlApiMaxBytes; + const sqlApiTimeoutSeconds = params.sqlApiTimeoutSeconds; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + if (typeof networkIdleTimeoutSeconds !== 'undefined') { + apiPayload['networkIdleTimeoutSeconds'] = networkIdleTimeoutSeconds; + } + if (typeof networkIPAllowlist !== 'undefined') { + apiPayload['networkIPAllowlist'] = networkIPAllowlist; + } + if (typeof idleTimeoutMinutes !== 'undefined') { + apiPayload['idleTimeoutMinutes'] = idleTimeoutMinutes; + } + if (typeof pitr !== 'undefined') { + apiPayload['pitr'] = pitr; + } + if (typeof pitrRetentionDays !== 'undefined') { + apiPayload['pitrRetentionDays'] = pitrRetentionDays; + } + if (typeof storageAutoscaling !== 'undefined') { + apiPayload['storageAutoscaling'] = storageAutoscaling; + } + if (typeof storageAutoscalingThresholdPercent !== 'undefined') { + apiPayload['storageAutoscalingThresholdPercent'] = + storageAutoscalingThresholdPercent; + } + if (typeof storageAutoscalingMaxGb !== 'undefined') { + apiPayload['storageAutoscalingMaxGb'] = storageAutoscalingMaxGb; + } + if (typeof metricsTraceSampleRate !== 'undefined') { + apiPayload['metricsTraceSampleRate'] = metricsTraceSampleRate; + } + if (typeof metricsSlowQueryLogThresholdMs !== 'undefined') { + apiPayload['metricsSlowQueryLogThresholdMs'] = + metricsSlowQueryLogThresholdMs; + } + if (typeof sqlApiEnabled !== 'undefined') { + apiPayload['sqlApiEnabled'] = sqlApiEnabled; + } + if (typeof sqlApiAllowedStatements !== 'undefined') { + apiPayload['sqlApiAllowedStatements'] = sqlApiAllowedStatements; + } + if (typeof sqlApiMaxRows !== 'undefined') { + apiPayload['sqlApiMaxRows'] = sqlApiMaxRows; + } + if (typeof sqlApiMaxBytes !== 'undefined') { + apiPayload['sqlApiMaxBytes'] = sqlApiMaxBytes; + } + if (typeof sqlApiTimeoutSeconds !== 'undefined') { + apiPayload['sqlApiTimeoutSeconds'] = sqlApiTimeoutSeconds; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { databaseId: string }): Promise<{}>; + /** + * Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. + * + * @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 = '/postgresql/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + */ + listBackups(params: { + databaseId: string; + queries?: string[]; + }): Promise; + /** + * List all backups for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: status, type, databaseId + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBackups( + databaseId: string, + queries?: string[], + ): Promise; + listBackups( + paramsOrFirst: { databaseId: string; queries?: string[] } | string, + ...rest: [string[]?] + ): Promise { + let params: { databaseId: string; queries?: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + queries?: string[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + */ + createBackup(params: { + databaseId: string; + type?: string; + }): Promise; + /** + * Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Backup type: full or incremental. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBackup( + databaseId: string, + type?: string, + ): Promise; + createBackup( + paramsOrFirst: { databaseId: string; type?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; type?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + type?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const type = params.type; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + */ + listBackupPolicies(params: { + databaseId: string; + queries?: string[]; + }): Promise; + /** + * List scheduled backup policies for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBackupPolicies( + databaseId: string, + queries?: string[], + ): Promise; + listBackupPolicies( + paramsOrFirst: { databaseId: string; queries?: string[] } | string, + ...rest: [string[]?] + ): Promise { + let params: { databaseId: string; queries?: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + queries?: string[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/policies'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.retention - Days to keep backups before deletion. + * @param {string} params.type - Backup type: full or incremental. + * @param {boolean} params.enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + */ + createBackupPolicy(params: { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }): Promise; + /** + * Create a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} retention - Days to keep backups before deletion. + * @param {string} type - Backup type: full or incremental. + * @param {boolean} enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBackupPolicy( + databaseId: string, + policyId: string, + name: string, + schedule: string, + retention: number, + type?: string, + enabled?: boolean, + ): Promise; + createBackupPolicy( + paramsOrFirst: + | { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, number?, string?, boolean?] + ): Promise { + let params: { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + name: string; + schedule: string; + retention: number; + type?: string; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + name: rest[1] as string, + schedule: rest[2] as string, + retention: rest[3] as number, + type: rest[4] as string, + enabled: rest[5] as boolean, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + const name = params.name; + const schedule = params.schedule; + const retention = params.retention; + const type = params.type; + const enabled = params.enabled; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof schedule === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "schedule"', + ); + } + if (typeof retention === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "retention"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/policies'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof policyId !== 'undefined') { + apiPayload['policyId'] = policyId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof schedule !== 'undefined') { + apiPayload['schedule'] = schedule; + } + if (typeof retention !== 'undefined') { + apiPayload['retention'] = retention; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getBackupPolicy(params: { + databaseId: string; + policyId: string; + }): Promise; + /** + * Get a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBackupPolicy( + databaseId: string, + policyId: string, + ): Promise; + getBackupPolicy( + paramsOrFirst: { databaseId: string; policyId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; policyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a scheduled backup policy for a dedicated database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.retention - Days to keep backups before deletion. + * @param {boolean} params.enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBackupPolicy(params: { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }): Promise; + /** + * Update a scheduled backup policy for a dedicated database. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} retention - Days to keep backups before deletion. + * @param {boolean} enabled - Is policy enabled? When disabled, no backups will be taken. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBackupPolicy( + databaseId: string, + policyId: string, + name?: string, + schedule?: string, + retention?: number, + enabled?: boolean, + ): Promise; + updateBackupPolicy( + paramsOrFirst: + | { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, number?, boolean?] + ): Promise { + let params: { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + name?: string; + schedule?: string; + retention?: number; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + name: rest[1] as string, + schedule: rest[2] as string, + retention: rest[3] as number, + enabled: rest[4] as boolean, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + const name = params.name; + const schedule = params.schedule; + const retention = params.retention; + const enabled = params.enabled; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof schedule !== 'undefined') { + apiPayload['schedule'] = schedule; + } + if (typeof retention !== 'undefined') { + apiPayload['retention'] = retention; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBackupPolicy(params: { + databaseId: string; + policyId: string; + }): Promise<{}>; + /** + * Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. + * + * @param {string} databaseId - Database ID. + * @param {string} policyId - Policy ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBackupPolicy(databaseId: string, policyId: string): Promise<{}>; + deleteBackupPolicy( + paramsOrFirst: { databaseId: string; policyId: string } | string, + ...rest: [string?] + ): Promise<{}> { + let params: { databaseId: string; policyId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + policyId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + policyId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const policyId = params.policyId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof policyId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/policies/{policyId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{policyId}', encodeURIComponent(String(policyId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} params.bucket - Storage bucket or container name. + * @param {string} params.accessKey - Access key or client ID for authentication. + * @param {string} params.secretKey - Secret key or service account JSON for authentication. + * @param {string} params.region - Storage region. + * @param {string} params.prefix - Object key prefix for backups. + * @param {string} params.endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + */ + updateBackupStorage(params: { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }): Promise; + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. + * + * @param {string} databaseId - Database ID. + * @param {string} provider - Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). + * @param {string} bucket - Storage bucket or container name. + * @param {string} accessKey - Access key or client ID for authentication. + * @param {string} secretKey - Secret key or service account JSON for authentication. + * @param {string} region - Storage region. + * @param {string} prefix - Object key prefix for backups. + * @param {string} endpoint - Custom endpoint for S3-compatible storage (e.g. MinIO). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBackupStorage( + databaseId: string, + provider: string, + bucket: string, + accessKey: string, + secretKey: string, + region?: string, + prefix?: string, + endpoint?: string, + ): Promise; + updateBackupStorage( + paramsOrFirst: + | { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + } + | string, + ...rest: [string?, string?, string?, string?, string?, string?, string?] + ): Promise { + let params: { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + provider: string; + bucket: string; + accessKey: string; + secretKey: string; + region?: string; + prefix?: string; + endpoint?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + provider: rest[0] as string, + bucket: rest[1] as string, + accessKey: rest[2] as string, + secretKey: rest[3] as string, + region: rest[4] as string, + prefix: rest[5] as string, + endpoint: rest[6] as string, + }; + } + + const databaseId = params.databaseId; + const provider = params.provider; + const bucket = params.bucket; + const accessKey = params.accessKey; + const secretKey = params.secretKey; + const region = params.region; + const prefix = params.prefix; + const endpoint = params.endpoint; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof provider === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "provider"', + ); + } + if (typeof bucket === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucket"'); + } + if (typeof accessKey === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "accessKey"', + ); + } + if (typeof secretKey === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "secretKey"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/storage'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof provider !== 'undefined') { + apiPayload['provider'] = provider; + } + if (typeof bucket !== 'undefined') { + apiPayload['bucket'] = bucket; + } + if (typeof region !== 'undefined') { + apiPayload['region'] = region; + } + if (typeof prefix !== 'undefined') { + apiPayload['prefix'] = prefix; + } + if (typeof endpoint !== 'undefined') { + apiPayload['endpoint'] = endpoint; + } + if (typeof accessKey !== 'undefined') { + apiPayload['accessKey'] = accessKey; + } + if (typeof secretKey !== 'undefined') { + apiPayload['secretKey'] = secretKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getBackup(params: { + databaseId: string; + backupId: string; + }): Promise; + /** + * Get details of a specific database backup including its status, size, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBackup( + databaseId: string, + backupId: string, + ): Promise; + getBackup( + paramsOrFirst: { databaseId: string; backupId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; backupId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + backupId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "backupId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/{backupId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{backupId}', encodeURIComponent(String(backupId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBackup(params: { databaseId: string; backupId: string }): Promise<{}>; + /** + * Delete a database backup. This will permanently remove the backup from storage and cannot be undone. + * + * @param {string} databaseId - Database ID. + * @param {string} backupId - Backup ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBackup(databaseId: string, backupId: string): Promise<{}>; + deleteBackup( + paramsOrFirst: { databaseId: string; backupId: string } | string, + ...rest: [string?] + ): Promise<{}> { + let params: { databaseId: string; backupId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + backupId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + backupId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const backupId = params.backupId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof backupId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "backupId"', + ); + } + const apiPath = '/postgresql/{databaseId}/backups/{backupId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{backupId}', encodeURIComponent(String(backupId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listBranches(params: { + databaseId: string; + }): Promise; + /** + * List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBranches( + databaseId: string, + ): Promise; + listBranches( + 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 = '/postgresql/{databaseId}/branches'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {number} params.ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + */ + createBranch(params: { + databaseId: string; + branchId?: string; + ttl?: number; + }): Promise; + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {number} ttl - Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBranch( + databaseId: string, + branchId?: string, + ttl?: number, + ): Promise; + createBranch( + paramsOrFirst: + { databaseId: string; branchId?: string; ttl?: number } | string, + ...rest: [string?, number?] + ): Promise { + let params: { databaseId: string; branchId?: string; ttl?: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + branchId?: string; + ttl?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string, + ttl: rest[1] as number, + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + const ttl = params.ttl; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/branches'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof branchId !== 'undefined') { + apiPayload['branchId'] = branchId; + } + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteBranch(params: { + databaseId: string; + branchId: string; + }): Promise; + /** + * Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. + * + * @param {string} databaseId - Database ID. + * @param {string} branchId - Branch ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBranch( + databaseId: string, + branchId: string, + ): Promise; + deleteBranch( + paramsOrFirst: { databaseId: string; branchId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; branchId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + branchId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + branchId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const branchId = params.branchId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof branchId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "branchId"', + ); + } + const apiPath = '/postgresql/{databaseId}/branches/{branchId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{branchId}', encodeURIComponent(String(branchId))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateCredentials(params: { + databaseId: string; + }): Promise; + /** + * Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateCredentials(databaseId: string): Promise; + updateCredentials( + 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 = '/postgresql/{databaseId}/credentials'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.sql - SQL statement to execute. Exactly one statement per request. + * @param {object} params.bindings - Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + * @param {number} params.timeoutSeconds - Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + * @throws {AppwriteException} + * @returns {Promise} + */ + createExecution(params: { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + }): Promise; + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. + * + * @param {string} databaseId - Database ID. + * @param {string} sql - SQL statement to execute. Exactly one statement per request. + * @param {object} bindings - Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. + * @param {number} timeoutSeconds - Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createExecution( + databaseId: string, + sql: string, + bindings?: object, + timeoutSeconds?: number, + ): Promise; + createExecution( + paramsOrFirst: + | { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + } + | string, + ...rest: [string?, object?, number?] + ): Promise { + let params: { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + sql: string; + bindings?: object; + timeoutSeconds?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + sql: rest[0] as string, + bindings: rest[1] as object, + timeoutSeconds: rest[2] as number, + }; + } + + const databaseId = params.databaseId; + const sql = params.sql; + const bindings = params.bindings; + const timeoutSeconds = params.timeoutSeconds; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof sql === 'undefined') { + throw new AppwriteException('Missing required parameter: "sql"'); + } + const apiPath = '/postgresql/{databaseId}/executions'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof sql !== 'undefined') { + apiPayload['sql'] = sql; + } + if (typeof bindings !== 'undefined') { + apiPayload['bindings'] = bindings; + } + if (typeof timeoutSeconds !== 'undefined') { + apiPayload['timeoutSeconds'] = timeoutSeconds; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List installed and available extensions for a PostgreSQL database. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + listExtensions(params: { + databaseId: string; + }): Promise; + /** + * List installed and available extensions for a PostgreSQL database. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listExtensions( + databaseId: string, + ): Promise; + listExtensions( + 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 = '/postgresql/{databaseId}/extensions'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Install a database extension. Only available for PostgreSQL databases. The install runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Extension name (e.g., pgvector, postgis, uuid-ossp). + * @throws {AppwriteException} + * @returns {Promise} + */ + createExtension(params: { + databaseId: string; + name: string; + }): Promise; + /** + * Install a database extension. Only available for PostgreSQL databases. The install runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Extension name (e.g., pgvector, postgis, uuid-ossp). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createExtension( + databaseId: string, + name: string, + ): Promise; + createExtension( + paramsOrFirst: { databaseId: string; name: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; name: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/postgresql/{databaseId}/extensions'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Uninstall a database extension from a PostgreSQL database. The uninstall runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.extensionName - Extension name to uninstall. + * @throws {AppwriteException} + * @returns {Promise} + */ + deleteExtension(params: { + databaseId: string; + extensionName: string; + }): Promise; + /** + * Uninstall a database extension from a PostgreSQL database. The uninstall runs asynchronously; poll the extensions list endpoint for status. + * + * @param {string} databaseId - Database ID. + * @param {string} extensionName - Extension name to uninstall. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteExtension( + databaseId: string, + extensionName: string, + ): Promise; + deleteExtension( + paramsOrFirst: { databaseId: string; extensionName: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; extensionName: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + extensionName: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + extensionName: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const extensionName = params.extensionName; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof extensionName === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "extensionName"', + ); + } + const apiPath = '/postgresql/{databaseId}/extensions/{extensionName}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{extensionName}', + encodeURIComponent(String(extensionName)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + */ + createFailover(params: { + databaseId: string; + targetReplicaId?: string; + }): Promise; + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} databaseId - Database ID. + * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFailover( + databaseId: string, + targetReplicaId?: string, + ): Promise; + createFailover( + paramsOrFirst: + { databaseId: string; targetReplicaId?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetReplicaId?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetReplicaId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetReplicaId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetReplicaId = params.targetReplicaId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/failovers'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetReplicaId !== 'undefined') { + apiPayload['targetReplicaId'] = targetReplicaId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} params.hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateMaintenance(params: { + databaseId: string; + day: string; + hourUtc: number; + }): Promise; + /** + * Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. + * + * @param {string} databaseId - Database ID. + * @param {string} day - Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. + * @param {number} hourUtc - Hour in UTC (0-23) for maintenance window start. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMaintenance( + databaseId: string, + day: string, + hourUtc: number, + ): Promise; + updateMaintenance( + paramsOrFirst: + { databaseId: string; day: string; hourUtc: number } | string, + ...rest: [string?, number?] + ): Promise { + let params: { databaseId: string; day: string; hourUtc: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + day: string; + hourUtc: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + day: rest[0] as string, + hourUtc: rest[1] as number, + }; + } + + const databaseId = params.databaseId; + const day = params.day; + const hourUtc = params.hourUtc; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof day === 'undefined') { + throw new AppwriteException('Missing required parameter: "day"'); + } + if (typeof hourUtc === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "hourUtc"', + ); + } + const apiPath = '/postgresql/{databaseId}/maintenance'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof day !== 'undefined') { + apiPayload['day'] = day; + } + if (typeof hourUtc !== 'undefined') { + apiPayload['hourUtc'] = hourUtc; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} params.specification - Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + */ + createMigration(params: { + databaseId: string; + targetType: string; + specification?: string; + }): Promise; + /** + * Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetType - Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). + * @param {string} specification - Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMigration( + databaseId: string, + targetType: string, + specification?: string, + ): Promise; + createMigration( + paramsOrFirst: + | { databaseId: string; targetType: string; specification?: string } + | string, + ...rest: [string?, string?] + ): Promise { + let params: { + databaseId: string; + targetType: string; + specification?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetType: string; + specification?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetType: rest[0] as string, + specification: rest[1] as string, + }; + } + + const databaseId = params.databaseId; + const targetType = params.targetType; + const specification = params.specification; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof targetType === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "targetType"', + ); + } + const apiPath = '/postgresql/{databaseId}/migrations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetType !== 'undefined') { + apiPayload['targetType'] = targetType; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by operation status. + * @param {number} params.limit - Maximum number of operations to return. + * @param {number} params.offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listOperations(params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by operation status. + * @param {number} limit - Maximum number of operations to return. + * @param {number} offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOperations( + databaseId: string, + status?: string, + limit?: number, + offset?: number, + ): Promise; + listOperations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + limit: rest[1] as number, + offset: rest[2] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/operations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPitr(params: { + databaseId: string; + }): Promise; + /** + * Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPitr(databaseId: string): Promise; + getPitr( + 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 = '/postgresql/{databaseId}/pitr'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getPooler(params: { + databaseId: string; + }): Promise; + /** + * Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPooler(databaseId: string): Promise; + getPooler( + 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 = '/postgresql/{databaseId}/pooler'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.mode - Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + * @param {number} params.maxConnections - Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + * @param {number} params.defaultPoolSize - Default pool size per user. + * @param {boolean} params.readWriteSplitting - Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + * @param {string} params.poolerCpuRequest - Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + * @param {string} params.poolerCpuLimit - Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + * @param {string} params.poolerMemoryRequest - Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + * @param {string} params.poolerMemoryLimit - Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePooler(params: { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + }): Promise; + /** + * Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. + * + * @param {string} databaseId - Database ID. + * @param {string} mode - Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. + * @param {number} maxConnections - Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. + * @param {number} defaultPoolSize - Default pool size per user. + * @param {boolean} readWriteSplitting - Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. + * @param {string} poolerCpuRequest - Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). + * @param {string} poolerCpuLimit - Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. + * @param {string} poolerMemoryRequest - Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). + * @param {string} poolerMemoryLimit - Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePooler( + databaseId: string, + mode?: string, + maxConnections?: number, + defaultPoolSize?: number, + readWriteSplitting?: boolean, + poolerCpuRequest?: string, + poolerCpuLimit?: string, + poolerMemoryRequest?: string, + poolerMemoryLimit?: string, + ): Promise; + updatePooler( + paramsOrFirst: + | { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + } + | string, + ...rest: [ + string?, + number?, + number?, + boolean?, + string?, + string?, + string?, + string?, + ] + ): Promise { + let params: { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + mode?: string; + maxConnections?: number; + defaultPoolSize?: number; + readWriteSplitting?: boolean; + poolerCpuRequest?: string; + poolerCpuLimit?: string; + poolerMemoryRequest?: string; + poolerMemoryLimit?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + mode: rest[0] as string, + maxConnections: rest[1] as number, + defaultPoolSize: rest[2] as number, + readWriteSplitting: rest[3] as boolean, + poolerCpuRequest: rest[4] as string, + poolerCpuLimit: rest[5] as string, + poolerMemoryRequest: rest[6] as string, + poolerMemoryLimit: rest[7] as string, + }; + } + + const databaseId = params.databaseId; + const mode = params.mode; + const maxConnections = params.maxConnections; + const defaultPoolSize = params.defaultPoolSize; + const readWriteSplitting = params.readWriteSplitting; + const poolerCpuRequest = params.poolerCpuRequest; + const poolerCpuLimit = params.poolerCpuLimit; + const poolerMemoryRequest = params.poolerMemoryRequest; + const poolerMemoryLimit = params.poolerMemoryLimit; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/pooler'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof mode !== 'undefined') { + apiPayload['mode'] = mode; + } + if (typeof maxConnections !== 'undefined') { + apiPayload['maxConnections'] = maxConnections; + } + if (typeof defaultPoolSize !== 'undefined') { + apiPayload['defaultPoolSize'] = defaultPoolSize; + } + if (typeof readWriteSplitting !== 'undefined') { + apiPayload['readWriteSplitting'] = readWriteSplitting; + } + if (typeof poolerCpuRequest !== 'undefined') { + apiPayload['poolerCpuRequest'] = poolerCpuRequest; + } + if (typeof poolerCpuLimit !== 'undefined') { + apiPayload['poolerCpuLimit'] = poolerCpuLimit; + } + if (typeof poolerMemoryRequest !== 'undefined') { + apiPayload['poolerMemoryRequest'] = poolerMemoryRequest; + } + if (typeof poolerMemoryLimit !== 'undefined') { + apiPayload['poolerMemoryLimit'] = poolerMemoryLimit; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReplicas(params: { + databaseId: string; + }): Promise; + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReplicas(databaseId: string): Promise; + getReplicas( + 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 = '/postgresql/{databaseId}/replicas'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by restoration status. + * @param {string} params.type - Filter by restoration type. + * @param {number} params.limit - Maximum number of restorations to return. + * @param {number} params.offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listRestorations(params: { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List all restorations for a dedicated database. Results can be filtered by status and type. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by restoration status. + * @param {string} type - Filter by restoration type. + * @param {number} limit - Maximum number of restorations to return. + * @param {number} offset - Number of restorations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRestorations( + databaseId: string, + status?: string, + type?: string, + limit?: number, + offset?: number, + ): Promise; + listRestorations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + type?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + type: rest[1] as string, + limit: rest[2] as number, + offset: rest[3] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const type = params.type; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/restorations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} params.backupId - Backup ID to restore from (required for backup type). + * @param {string} params.targetDatabaseId - Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + * @param {string} params.targetTime - Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + * @throws {AppwriteException} + * @returns {Promise} + */ + createRestoration(params: { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }): Promise; + /** + * Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. + * + * @param {string} databaseId - Database ID. + * @param {string} type - Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. + * @param {string} backupId - Backup ID to restore from (required for backup type). + * @param {string} targetDatabaseId - Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. + * @param {string} targetTime - Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRestoration( + databaseId: string, + type?: string, + backupId?: string, + targetDatabaseId?: string, + targetTime?: string, + ): Promise; + createRestoration( + paramsOrFirst: + | { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + } + | string, + ...rest: [string?, string?, string?, string?] + ): Promise { + let params: { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + type?: string; + backupId?: string; + targetDatabaseId?: string; + targetTime?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + type: rest[0] as string, + backupId: rest[1] as string, + targetDatabaseId: rest[2] as string, + targetTime: rest[3] as string, + }; + } + + const databaseId = params.databaseId; + const type = params.type; + const backupId = params.backupId; + const targetDatabaseId = params.targetDatabaseId; + const targetTime = params.targetTime; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/postgresql/{databaseId}/restorations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof backupId !== 'undefined') { + apiPayload['backupId'] = backupId; + } + if (typeof targetDatabaseId !== 'undefined') { + apiPayload['targetDatabaseId'] = targetDatabaseId; + } + if (typeof targetTime !== 'undefined') { + apiPayload['targetTime'] = targetTime; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getRestoration(params: { + databaseId: string; + restorationId: string; + }): Promise; + /** + * Get details of a specific database restoration including its status, type, and timestamps. + * + * @param {string} databaseId - Database ID. + * @param {string} restorationId - Restoration ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRestoration( + databaseId: string, + restorationId: string, + ): Promise; + getRestoration( + paramsOrFirst: { databaseId: string; restorationId: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; restorationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + restorationId: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + restorationId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const restorationId = params.restorationId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof restorationId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "restorationId"', + ); + } + const apiPath = '/postgresql/{databaseId}/restorations/{restorationId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{restorationId}', + encodeURIComponent(String(restorationId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getStatus(params: { databaseId: string }): Promise; + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getStatus(databaseId: string): Promise; + getStatus( + 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 = '/postgresql/{databaseId}/status'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + */ + createUpgrade(params: { + databaseId: string; + targetVersion: string; + }): Promise; + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. + * + * @param {string} databaseId - Database ID. + * @param {string} targetVersion - Target engine version to upgrade to. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createUpgrade( + databaseId: string, + targetVersion: string, + ): Promise; + createUpgrade( + paramsOrFirst: { databaseId: string; targetVersion: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetVersion: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetVersion: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetVersion: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetVersion = params.targetVersion; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof targetVersion === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "targetVersion"', + ); + } + const apiPath = '/postgresql/{databaseId}/upgrades'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetVersion !== 'undefined') { + apiPayload['targetVersion'] = targetVersion; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } +} diff --git a/src/services/presences.ts b/src/services/presences.ts index d7e8af9..eb15536 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Presences { client: Client; @@ -12,7 +10,7 @@ export class Presences { /** * 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. @@ -20,10 +18,14 @@ export class Presences { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise; + list(params?: { + queries?: string[]; + total?: boolean; + ttl?: number; + }): Promise; /** * List presence logs. Expired entries are filtered out automatically. - * + * * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. @@ -32,57 +34,64 @@ export class Presences { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], total?: boolean, ttl?: number): Promise; list( - paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], - ...rest: [(boolean)?, (number)?] + queries?: string[], + total?: boolean, + ttl?: number, + ): Promise; + list( + paramsOrFirst?: + { queries?: string[]; total?: boolean; ttl?: number } | string[], + ...rest: [boolean?, number?] ): Promise { - let params: { queries?: string[], total?: boolean, ttl?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean, ttl?: number }; + 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 + ttl: rest[1] as number, }; } - + const queries = params.queries; const total = params.total; const ttl = params.ttl; - - const apiPath = '/presences'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; + apiPayload['ttl'] = ttl; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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} @@ -91,7 +100,7 @@ export class Presences { get(params: { presenceId: string }): Promise; /** * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. - * + * * * @param {string} presenceId - Presence unique ID. * @throws {AppwriteException} @@ -100,44 +109,46 @@ export class Presences { */ get(presenceId: string): Promise; get( - paramsOrFirst: { presenceId: string } | string + paramsOrFirst: { presenceId: string } | string, ): Promise { let params: { presenceId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { presenceId: string }; } else { params = { - presenceId: paramsOrFirst as string + presenceId: paramsOrFirst as string, }; } - - const presenceId = params.presenceId; + const presenceId = params.presenceId; if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); + throw new AppwriteException( + 'Missing required parameter: "presenceId"', + ); } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); - const payload: Payload = {}; + const apiPath = '/presences/{presenceId}'.replace( + '{presenceId}', + encodeURIComponent(String(presenceId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Create or update a presence log by its user ID. - * + * * * @param {string} params.presenceId - Presence unique ID. * @param {string} params.userId - User ID. @@ -148,10 +159,17 @@ export class Presences { * @throws {AppwriteException} * @returns {Promise} */ - upsert(params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise; + upsert(params: { + presenceId: string; + userId: string; + status: string; + permissions?: string[]; + expiresAt?: string; + metadata?: object; + }): Promise; /** * Create or update a presence log by its user ID. - * + * * * @param {string} presenceId - Presence unique ID. * @param {string} userId - User ID. @@ -163,15 +181,49 @@ export class Presences { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - upsert(presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise; upsert( - paramsOrFirst: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] + presenceId: string, + userId: string, + status: string, + permissions?: string[], + expiresAt?: string, + metadata?: object, + ): Promise; + upsert( + paramsOrFirst: + | { + presenceId: string; + userId: string; + status: string; + permissions?: string[]; + expiresAt?: string; + metadata?: object; + } + | string, + ...rest: [string?, string?, string[]?, string?, object?] ): Promise { - let params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + let params: { + presenceId: string; + userId: string; + status: string; + permissions?: string[]; + expiresAt?: string; + metadata?: object; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + presenceId: string; + userId: string; + status: string; + permissions?: string[]; + expiresAt?: string; + metadata?: object; + }; } else { params = { presenceId: paramsOrFirst as string, @@ -179,19 +231,20 @@ export class Presences { status: rest[1] as string, permissions: rest[2] as string[], expiresAt: rest[3] as string, - metadata: rest[4] as object + metadata: rest[4] as object, }; } - + const presenceId = params.presenceId; const userId = params.userId; const status = params.status; const permissions = params.permissions; const expiresAt = params.expiresAt; const metadata = params.metadata; - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); + throw new AppwriteException( + 'Missing required parameter: "presenceId"', + ); } if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -199,43 +252,40 @@ export class Presences { if (typeof status === 'undefined') { throw new AppwriteException('Missing required parameter: "status"'); } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); - const payload: Payload = {}; + const apiPath = '/presences/{presenceId}'.replace( + '{presenceId}', + encodeURIComponent(String(presenceId)), + ); + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof status !== 'undefined') { - payload['status'] = status; + apiPayload['status'] = status; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof expiresAt !== 'undefined') { - payload['expiresAt'] = expiresAt; + apiPayload['expiresAt'] = expiresAt; } if (typeof metadata !== 'undefined') { - payload['metadata'] = metadata; + apiPayload['metadata'] = metadata; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * + * * * @param {string} params.presenceId - Presence unique ID. * @param {string} params.userId - User ID. @@ -247,10 +297,18 @@ export class Presences { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise; + update(params: { + presenceId: string; + userId: string; + status?: string; + expiresAt?: string; + metadata?: object; + permissions?: string[]; + purge?: boolean; + }): Promise; /** * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * + * * * @param {string} presenceId - Presence unique ID. * @param {string} userId - User ID. @@ -263,15 +321,53 @@ export class Presences { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise; update( - paramsOrFirst: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (object)?, (string[])?, (boolean)?] + presenceId: string, + userId: string, + status?: string, + expiresAt?: string, + metadata?: object, + permissions?: string[], + purge?: boolean, + ): Promise; + update( + paramsOrFirst: + | { + presenceId: string; + userId: string; + status?: string; + expiresAt?: string; + metadata?: object; + permissions?: string[]; + purge?: boolean; + } + | string, + ...rest: [string?, string?, string?, object?, string[]?, boolean?] ): Promise { - let params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + let params: { + presenceId: string; + userId: string; + status?: string; + expiresAt?: string; + metadata?: object; + permissions?: string[]; + purge?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + presenceId: string; + userId: string; + status?: string; + expiresAt?: string; + metadata?: object; + permissions?: string[]; + purge?: boolean; + }; } else { params = { presenceId: paramsOrFirst as string, @@ -280,10 +376,10 @@ export class Presences { expiresAt: rest[2] as string, metadata: rest[3] as object, permissions: rest[4] as string[], - purge: rest[5] as boolean + purge: rest[5] as boolean, }; } - + const presenceId = params.presenceId; const userId = params.userId; const status = params.status; @@ -291,53 +387,51 @@ export class Presences { const metadata = params.metadata; const permissions = params.permissions; const purge = params.purge; - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); + throw new AppwriteException( + 'Missing required parameter: "presenceId"', + ); } if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); - const payload: Payload = {}; + const apiPath = '/presences/{presenceId}'.replace( + '{presenceId}', + encodeURIComponent(String(presenceId)), + ); + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof status !== 'undefined') { - payload['status'] = status; + apiPayload['status'] = status; } if (typeof expiresAt !== 'undefined') { - payload['expiresAt'] = expiresAt; + apiPayload['expiresAt'] = expiresAt; } if (typeof metadata !== 'undefined') { - payload['metadata'] = metadata; + apiPayload['metadata'] = metadata; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof purge !== 'undefined') { - payload['purge'] = purge; + apiPayload['purge'] = purge; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Delete a presence log by its unique ID. - * + * * * @param {string} params.presenceId - Presence unique ID. * @throws {AppwriteException} @@ -346,7 +440,7 @@ export class Presences { delete(params: { presenceId: string }): Promise<{}>; /** * Delete a presence log by its unique ID. - * + * * * @param {string} presenceId - Presence unique ID. * @throws {AppwriteException} @@ -354,39 +448,39 @@ export class Presences { * @deprecated Use the object parameter style method for a better developer experience. */ delete(presenceId: string): Promise<{}>; - delete( - paramsOrFirst: { presenceId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { presenceId: string } | string): Promise<{}> { let params: { presenceId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { presenceId: string }; } else { params = { - presenceId: paramsOrFirst as string + presenceId: paramsOrFirst as string, }; } - - const presenceId = params.presenceId; + const presenceId = params.presenceId; if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); + throw new AppwriteException( + 'Missing required parameter: "presenceId"', + ); } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', encodeURIComponent(String(presenceId))); - const payload: Payload = {}; + const apiPath = '/presences/{presenceId}'.replace( + '{presenceId}', + encodeURIComponent(String(presenceId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/project.ts b/src/services/project.ts index 990a230..2c6ea0a 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -1,7 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - import { ProjectAuthMethodId } from '../enums/project-auth-method-id'; import { ProjectKeyScopes } from '../enums/project-key-scopes'; import { ProjectOAuth2GooglePrompt } from '../enums/project-o-auth-2-google-prompt'; @@ -13,7 +12,6 @@ import { ProjectServiceId } from '../enums/project-service-id'; import { ProjectSMTPSecure } from '../enums/project-smtp-secure'; import { ProjectEmailTemplateId } from '../enums/project-email-template-id'; import { ProjectEmailTemplateLocale } from '../enums/project-email-template-locale'; - export class Project { client: Client; @@ -28,21 +26,15 @@ export class Project { * @returns {Promise} */ get(): Promise { - const apiPath = '/project'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - } + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -52,35 +44,32 @@ export class Project { * @returns {Promise<{}>} */ delete(): Promise<{}> { - const apiPath = '/project'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** - * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. + * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. * * @param {ProjectAuthMethodId} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone * @param {boolean} params.enabled - Auth method status. * @throws {AppwriteException} * @returns {Promise} */ - updateAuthMethod(params: { methodId: ProjectAuthMethodId, enabled: boolean }): Promise; + updateAuthMethod(params: { + methodId: ProjectAuthMethodId; + enabled: boolean; + }): Promise; /** - * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. + * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. * * @param {ProjectAuthMethodId} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone * @param {boolean} enabled - Auth method status. @@ -88,51 +77,64 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateAuthMethod(methodId: ProjectAuthMethodId, enabled: boolean): Promise; updateAuthMethod( - paramsOrFirst: { methodId: ProjectAuthMethodId, enabled: boolean } | ProjectAuthMethodId, - ...rest: [(boolean)?] + methodId: ProjectAuthMethodId, + enabled: boolean, + ): Promise; + updateAuthMethod( + paramsOrFirst: + | { methodId: ProjectAuthMethodId; enabled: boolean } + | ProjectAuthMethodId, + ...rest: [boolean?] ): Promise { - let params: { methodId: ProjectAuthMethodId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { methodId: ProjectAuthMethodId, enabled: boolean }; + let params: { methodId: ProjectAuthMethodId; enabled: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + methodId: ProjectAuthMethodId; + enabled: boolean; + }; } else { params = { methodId: paramsOrFirst as ProjectAuthMethodId, - enabled: rest[0] as boolean + enabled: rest[0] as boolean, }; } - + const methodId = params.methodId; const enabled = params.enabled; - if (typeof methodId === 'undefined') { - throw new AppwriteException('Missing required parameter: "methodId"'); + throw new AppwriteException( + 'Missing required parameter: "methodId"', + ); } if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - - const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', encodeURIComponent(String(methodId))); - const payload: Payload = {}; + const apiPath = '/project/auth-methods/{methodId}'.replace( + '{methodId}', + encodeURIComponent(String(methodId)), + ); + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -143,7 +145,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - listKeys(params?: { queries?: string[], total?: boolean }): Promise; + listKeys(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all API keys from the current project. * @@ -155,50 +160,51 @@ export class Project { */ listKeys(queries?: string[], total?: boolean): Promise; listKeys( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/project/keys'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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 {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 200 scopes are allowed. @@ -206,10 +212,13 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - createEphemeralKey(params: { scopes: ProjectKeyScopes[], duration: number }): Promise; + createEphemeralKey(params: { + scopes: ProjectKeyScopes[]; + duration: number; + }): Promise; /** * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * + * * You can also create a standard API key if you need a longer-lived key instead. * * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 200 scopes are allowed. @@ -218,58 +227,66 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createEphemeralKey(scopes: ProjectKeyScopes[], duration: number): Promise; createEphemeralKey( - paramsOrFirst: { scopes: ProjectKeyScopes[], duration: number } | ProjectKeyScopes[], - ...rest: [(number)?] + scopes: ProjectKeyScopes[], + duration: number, + ): Promise; + createEphemeralKey( + paramsOrFirst: + | { scopes: ProjectKeyScopes[]; duration: number } + | ProjectKeyScopes[], + ...rest: [number?] ): Promise { - let params: { scopes: ProjectKeyScopes[], duration: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { scopes: ProjectKeyScopes[], duration: number }; + let params: { scopes: ProjectKeyScopes[]; duration: number }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + scopes: ProjectKeyScopes[]; + duration: number; + }; } else { params = { scopes: paramsOrFirst as ProjectKeyScopes[], - duration: rest[0] as number + 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"'); + throw new AppwriteException( + 'Missing required parameter: "duration"', + ); } - const apiPath = '/project/keys/ephemeral'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } if (typeof duration !== 'undefined') { - payload['duration'] = duration; + apiPayload['duration'] = duration; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** - * Get a key by its unique ID. + * Get a key by its unique ID. * * @param {string} params.keyId - Key ID. * @throws {AppwriteException} @@ -277,7 +294,7 @@ export class Project { */ getKey(params: { keyId: string }): Promise; /** - * Get a key by its unique ID. + * Get a key by its unique ID. * * @param {string} keyId - Key ID. * @throws {AppwriteException} @@ -285,40 +302,38 @@ export class Project { * @deprecated Use the object parameter style method for a better developer experience. */ getKey(keyId: string): Promise; - getKey( - paramsOrFirst: { keyId: string } | string - ): Promise { + getKey(paramsOrFirst: { keyId: string } | string): Promise { let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { keyId: string }; } else { params = { - keyId: paramsOrFirst as string + keyId: paramsOrFirst as string, }; } - - const keyId = params.keyId; + const keyId = params.keyId; if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/project/keys/{keyId}'.replace( + '{keyId}', + encodeURIComponent(String(keyId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -331,7 +346,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }): Promise; + updateKey(params: { + keyId: string; + name: string; + scopes: ProjectKeyScopes[]; + expire?: string; + }): Promise; /** * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. * @@ -343,29 +363,54 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateKey(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise; updateKey( - paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, - ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] + keyId: string, + name: string, + scopes: ProjectKeyScopes[], + expire?: string, + ): Promise; + updateKey( + paramsOrFirst: + | { + keyId: string; + name: string; + scopes: ProjectKeyScopes[]; + expire?: string; + } + | string, + ...rest: [string?, ProjectKeyScopes[]?, string?] ): Promise { - let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; + let params: { + keyId: string; + name: string; + scopes: ProjectKeyScopes[]; + expire?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + keyId: string; + name: string; + scopes: ProjectKeyScopes[]; + expire?: string; + }; } else { params = { keyId: paramsOrFirst as string, name: rest[0] as string, scopes: rest[1] as ProjectKeyScopes[], - expire: rest[2] as string + 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"'); } @@ -375,32 +420,29 @@ export class Project { if (typeof scopes === 'undefined') { throw new AppwriteException('Missing required parameter: "scopes"'); } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/project/keys/{keyId}'.replace( + '{keyId}', + encodeURIComponent(String(keyId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } if (typeof expire !== 'undefined') { - payload['expire'] = expire; + apiPayload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -420,40 +462,38 @@ export class Project { * @deprecated Use the object parameter style method for a better developer experience. */ deleteKey(keyId: string): Promise<{}>; - deleteKey( - paramsOrFirst: { keyId: string } | string - ): Promise<{}> { + deleteKey(paramsOrFirst: { keyId: string } | string): Promise<{}> { let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { keyId: string }; } else { params = { - keyId: paramsOrFirst as string + keyId: paramsOrFirst as string, }; } - - const keyId = params.keyId; + const keyId = params.keyId; if (typeof keyId === 'undefined') { throw new AppwriteException('Missing required parameter: "keyId"'); } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', encodeURIComponent(String(keyId))); - const payload: Payload = {}; + const apiPath = '/project/keys/{keyId}'.replace( + '{keyId}', + encodeURIComponent(String(keyId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -474,43 +514,40 @@ export class Project { */ updateLabels(labels: string[]): Promise; updateLabels( - paramsOrFirst: { labels: string[] } | string[] + paramsOrFirst: { labels: string[] } | string[], ): Promise { let params: { labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { labels: string[] }; } else { params = { - labels: paramsOrFirst as string[] + labels: paramsOrFirst as string[], }; } - - const labels = params.labels; + const labels = params.labels; if (typeof labels === 'undefined') { throw new AppwriteException('Missing required parameter: "labels"'); } - const apiPath = '/project/labels'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof labels !== 'undefined') { - payload['labels'] = labels; + apiPayload['labels'] = labels; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -521,7 +558,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - listMockPhones(params?: { queries?: string[], total?: boolean }): Promise; + listMockPhones(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. * @@ -531,47 +571,51 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMockPhones(queries?: string[], total?: boolean): Promise; listMockPhones( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listMockPhones( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/project/mock-phones'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -582,7 +626,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - createMockPhone(params: { number: string, otp: string }): Promise; + createMockPhone(params: { + number: string; + otp: string; + }): Promise; /** * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. * @@ -594,52 +641,49 @@ export class Project { */ createMockPhone(number: string, otp: string): Promise; createMockPhone( - paramsOrFirst: { number: string, otp: string } | string, - ...rest: [(string)?] + paramsOrFirst: { number: string; otp: string } | string, + ...rest: [string?] ): Promise { - let params: { number: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string, otp: string }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof number !== 'undefined') { - payload['number'] = number; + apiPayload['number'] = number; } if (typeof otp !== 'undefined') { - payload['otp'] = otp; + apiPayload['otp'] = otp; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -660,39 +704,39 @@ export class Project { */ getMockPhone(number: string): Promise; getMockPhone( - paramsOrFirst: { number: string } | string + paramsOrFirst: { number: string } | string, ): Promise { let params: { number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { number: string }; } else { params = { - number: paramsOrFirst as string + number: paramsOrFirst as string, }; } - - const number = params.number; + const number = params.number; if (typeof number === 'undefined') { throw new AppwriteException('Missing required parameter: "number"'); } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', encodeURIComponent(String(number))); - const payload: Payload = {}; + const apiPath = '/project/mock-phones/{number}'.replace( + '{number}', + encodeURIComponent(String(number)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -703,7 +747,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateMockPhone(params: { number: string, otp: string }): Promise; + updateMockPhone(params: { + number: string; + otp: string; + }): Promise; /** * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. * @@ -715,49 +762,49 @@ export class Project { */ updateMockPhone(number: string, otp: string): Promise; updateMockPhone( - paramsOrFirst: { number: string, otp: string } | string, - ...rest: [(string)?] + paramsOrFirst: { number: string; otp: string } | string, + ...rest: [string?] ): Promise { - let params: { number: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string, otp: string }; + 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 + 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}', encodeURIComponent(String(number))); - const payload: Payload = {}; + const apiPath = '/project/mock-phones/{number}'.replace( + '{number}', + encodeURIComponent(String(number)), + ); + const apiPayload: Payload = {}; if (typeof otp !== 'undefined') { - payload['otp'] = otp; + apiPayload['otp'] = otp; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -777,40 +824,38 @@ export class Project { * @deprecated Use the object parameter style method for a better developer experience. */ deleteMockPhone(number: string): Promise<{}>; - deleteMockPhone( - paramsOrFirst: { number: string } | string - ): Promise<{}> { + deleteMockPhone(paramsOrFirst: { number: string } | string): Promise<{}> { let params: { number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { number: string }; } else { params = { - number: paramsOrFirst as string + number: paramsOrFirst as string, }; } - - const number = params.number; + const number = params.number; if (typeof number === 'undefined') { throw new AppwriteException('Missing required parameter: "number"'); } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', encodeURIComponent(String(number))); - const payload: Payload = {}; + const apiPath = '/project/mock-phones/{number}'.replace( + '{number}', + encodeURIComponent(String(number)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -821,7 +866,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - listOAuth2Providers(params?: { queries?: string[], total?: boolean }): Promise; + listOAuth2Providers(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * 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. * @@ -831,47 +879,51 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listOAuth2Providers(queries?: string[], total?: boolean): Promise; listOAuth2Providers( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listOAuth2Providers( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/project/oauth2'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -896,7 +948,24 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] }): Promise; + updateOAuth2Server(params: { + enabled: boolean; + authorizationUrl: string; + scopes?: string[]; + authorizationDetailsTypes?: string[]; + accessTokenDuration?: number; + refreshTokenDuration?: number; + publicAccessTokenDuration?: number; + publicRefreshTokenDuration?: number; + installationAccessTokenDuration?: number; + confidentialPkce?: boolean; + verificationUrl?: string; + userCodeLength?: number; + userCodeFormat?: string; + deviceCodeDuration?: number; + defaultScopes?: string[]; + installationScopes?: string[]; + }): Promise; /** * Update the OAuth2 server (OIDC provider) configuration. * @@ -920,15 +989,105 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Server(enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[]): Promise; updateOAuth2Server( - paramsOrFirst: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] } | boolean, - ...rest: [(string)?, (string[])?, (string[])?, (number)?, (number)?, (number)?, (number)?, (number)?, (boolean)?, (string)?, (number)?, (string)?, (number)?, (string[])?, (string[])?] + enabled: boolean, + authorizationUrl: string, + scopes?: string[], + authorizationDetailsTypes?: string[], + accessTokenDuration?: number, + refreshTokenDuration?: number, + publicAccessTokenDuration?: number, + publicRefreshTokenDuration?: number, + installationAccessTokenDuration?: number, + confidentialPkce?: boolean, + verificationUrl?: string, + userCodeLength?: number, + userCodeFormat?: string, + deviceCodeDuration?: number, + defaultScopes?: string[], + installationScopes?: string[], + ): Promise; + updateOAuth2Server( + paramsOrFirst: + | { + enabled: boolean; + authorizationUrl: string; + scopes?: string[]; + authorizationDetailsTypes?: string[]; + accessTokenDuration?: number; + refreshTokenDuration?: number; + publicAccessTokenDuration?: number; + publicRefreshTokenDuration?: number; + installationAccessTokenDuration?: number; + confidentialPkce?: boolean; + verificationUrl?: string; + userCodeLength?: number; + userCodeFormat?: string; + deviceCodeDuration?: number; + defaultScopes?: string[]; + installationScopes?: string[]; + } + | boolean, + ...rest: [ + string?, + string[]?, + string[]?, + number?, + number?, + number?, + number?, + number?, + boolean?, + string?, + number?, + string?, + number?, + string[]?, + string[]?, + ] ): Promise { - let params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, installationAccessTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number, defaultScopes?: string[], installationScopes?: string[] }; + let params: { + enabled: boolean; + authorizationUrl: string; + scopes?: string[]; + authorizationDetailsTypes?: string[]; + accessTokenDuration?: number; + refreshTokenDuration?: number; + publicAccessTokenDuration?: number; + publicRefreshTokenDuration?: number; + installationAccessTokenDuration?: number; + confidentialPkce?: boolean; + verificationUrl?: string; + userCodeLength?: number; + userCodeFormat?: string; + deviceCodeDuration?: number; + defaultScopes?: string[]; + installationScopes?: string[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + enabled: boolean; + authorizationUrl: string; + scopes?: string[]; + authorizationDetailsTypes?: string[]; + accessTokenDuration?: number; + refreshTokenDuration?: number; + publicAccessTokenDuration?: number; + publicRefreshTokenDuration?: number; + installationAccessTokenDuration?: number; + confidentialPkce?: boolean; + verificationUrl?: string; + userCodeLength?: number; + userCodeFormat?: string; + deviceCodeDuration?: number; + defaultScopes?: string[]; + installationScopes?: string[]; + }; } else { params = { enabled: paramsOrFirst as boolean, @@ -946,10 +1105,10 @@ export class Project { userCodeFormat: rest[11] as string, deviceCodeDuration: rest[12] as number, defaultScopes: rest[13] as string[], - installationScopes: rest[14] as string[] + installationScopes: rest[14] as string[], }; } - + const enabled = params.enabled; const authorizationUrl = params.authorizationUrl; const scopes = params.scopes; @@ -958,7 +1117,8 @@ export class Project { const refreshTokenDuration = params.refreshTokenDuration; const publicAccessTokenDuration = params.publicAccessTokenDuration; const publicRefreshTokenDuration = params.publicRefreshTokenDuration; - const installationAccessTokenDuration = params.installationAccessTokenDuration; + const installationAccessTokenDuration = + params.installationAccessTokenDuration; const confidentialPkce = params.confidentialPkce; const verificationUrl = params.verificationUrl; const userCodeLength = params.userCodeLength; @@ -966,78 +1126,77 @@ export class Project { const deviceCodeDuration = params.deviceCodeDuration; const defaultScopes = params.defaultScopes; const installationScopes = params.installationScopes; - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } if (typeof authorizationUrl === 'undefined') { - throw new AppwriteException('Missing required parameter: "authorizationUrl"'); + throw new AppwriteException( + 'Missing required parameter: "authorizationUrl"', + ); } - const apiPath = '/project/oauth2-server'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof authorizationUrl !== 'undefined') { - payload['authorizationUrl'] = authorizationUrl; + apiPayload['authorizationUrl'] = authorizationUrl; } if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; + apiPayload['scopes'] = scopes; } if (typeof authorizationDetailsTypes !== 'undefined') { - payload['authorizationDetailsTypes'] = authorizationDetailsTypes; + apiPayload['authorizationDetailsTypes'] = authorizationDetailsTypes; } if (typeof accessTokenDuration !== 'undefined') { - payload['accessTokenDuration'] = accessTokenDuration; + apiPayload['accessTokenDuration'] = accessTokenDuration; } if (typeof refreshTokenDuration !== 'undefined') { - payload['refreshTokenDuration'] = refreshTokenDuration; + apiPayload['refreshTokenDuration'] = refreshTokenDuration; } if (typeof publicAccessTokenDuration !== 'undefined') { - payload['publicAccessTokenDuration'] = publicAccessTokenDuration; + apiPayload['publicAccessTokenDuration'] = publicAccessTokenDuration; } if (typeof publicRefreshTokenDuration !== 'undefined') { - payload['publicRefreshTokenDuration'] = publicRefreshTokenDuration; + apiPayload['publicRefreshTokenDuration'] = + publicRefreshTokenDuration; } if (typeof installationAccessTokenDuration !== 'undefined') { - payload['installationAccessTokenDuration'] = installationAccessTokenDuration; + apiPayload['installationAccessTokenDuration'] = + installationAccessTokenDuration; } if (typeof confidentialPkce !== 'undefined') { - payload['confidentialPkce'] = confidentialPkce; + apiPayload['confidentialPkce'] = confidentialPkce; } if (typeof verificationUrl !== 'undefined') { - payload['verificationUrl'] = verificationUrl; + apiPayload['verificationUrl'] = verificationUrl; } if (typeof userCodeLength !== 'undefined') { - payload['userCodeLength'] = userCodeLength; + apiPayload['userCodeLength'] = userCodeLength; } if (typeof userCodeFormat !== 'undefined') { - payload['userCodeFormat'] = userCodeFormat; + apiPayload['userCodeFormat'] = userCodeFormat; } if (typeof deviceCodeDuration !== 'undefined') { - payload['deviceCodeDuration'] = deviceCodeDuration; + apiPayload['deviceCodeDuration'] = deviceCodeDuration; } if (typeof defaultScopes !== 'undefined') { - payload['defaultScopes'] = defaultScopes; + apiPayload['defaultScopes'] = defaultScopes; } if (typeof installationScopes !== 'undefined') { - payload['installationScopes'] = installationScopes; + apiPayload['installationScopes'] = installationScopes; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1049,7 +1208,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Amazon(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Amazon(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Amazon configuration. * @@ -1060,53 +1223,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Amazon(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Amazon( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Amazon( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1120,7 +1295,13 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Apple(params?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }): Promise; + updateOAuth2Apple(params?: { + serviceId?: string; + keyId?: string; + teamId?: string; + p8File?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Apple configuration. * @@ -1133,63 +1314,87 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Apple(serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean): Promise; updateOAuth2Apple( - paramsOrFirst?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] + serviceId?: string, + keyId?: string, + teamId?: string, + p8File?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Apple( + paramsOrFirst?: + | { + serviceId?: string; + keyId?: string; + teamId?: string; + p8File?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, boolean?] ): Promise { - let params: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof serviceId !== 'undefined') { - payload['serviceId'] = serviceId; + apiPayload['serviceId'] = serviceId; } if (typeof keyId !== 'undefined') { - payload['keyId'] = keyId; + apiPayload['keyId'] = keyId; } if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } if (typeof p8File !== 'undefined') { - payload['p8File'] = p8File; + apiPayload['p8File'] = p8File; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1201,7 +1406,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Appwrite(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Appwrite(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Appwrite configuration. * @@ -1212,53 +1421,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Appwrite(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Appwrite( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Appwrite( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + enabled: rest[1] as boolean, }; } - + const clientId = params.clientId; const clientSecret = params.clientSecret; const enabled = params.enabled; - - const apiPath = '/project/oauth2/appwrite'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1271,7 +1492,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Auth0(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise; + updateOAuth2Auth0(params?: { + clientId?: string; + clientSecret?: string; + endpoint?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Auth0 configuration. * @@ -1283,58 +1509,78 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Auth0(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise; updateOAuth2Auth0( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + endpoint?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Auth0( + paramsOrFirst?: + | { + clientId?: string; + clientSecret?: string; + endpoint?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; + apiPayload['endpoint'] = endpoint; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1347,7 +1593,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Authentik(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise; + updateOAuth2Authentik(params?: { + clientId?: string; + clientSecret?: string; + endpoint?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Authentik configuration. * @@ -1359,58 +1610,78 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Authentik(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise; updateOAuth2Authentik( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + endpoint?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Authentik( + paramsOrFirst?: + | { + clientId?: string; + clientSecret?: string; + endpoint?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; + apiPayload['endpoint'] = endpoint; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1422,7 +1693,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Autodesk(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Autodesk(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Autodesk configuration. * @@ -1433,53 +1708,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Autodesk(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Autodesk( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Autodesk( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1491,7 +1778,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Bitbucket(params?: { key?: string, secret?: string, enabled?: boolean }): Promise; + updateOAuth2Bitbucket(params?: { + key?: string; + secret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Bitbucket configuration. * @@ -1502,53 +1793,60 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Bitbucket(key?: string, secret?: string, enabled?: boolean): Promise; updateOAuth2Bitbucket( - paramsOrFirst?: { key?: string, secret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + key?: string, + secret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Bitbucket( + paramsOrFirst?: + { key?: string; secret?: string; enabled?: boolean } | string, + ...rest: [string?, boolean?] ): Promise { - let params: { key?: string, secret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { key?: string, secret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1560,7 +1858,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Bitly(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Bitly(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Bitly configuration. * @@ -1571,53 +1873,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Bitly(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Bitly( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Bitly( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1629,7 +1943,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Box(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Box(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Box configuration. * @@ -1640,53 +1958,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Box(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Box( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Box( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1698,7 +2028,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Dailymotion(params?: { apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Dailymotion(params?: { + apiKey?: string; + apiSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Dailymotion configuration. * @@ -1709,53 +2043,60 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Dailymotion(apiKey?: string, apiSecret?: string, enabled?: boolean): Promise; updateOAuth2Dailymotion( - paramsOrFirst?: { apiKey?: string, apiSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + apiKey?: string, + apiSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Dailymotion( + paramsOrFirst?: + { apiKey?: string; apiSecret?: string; enabled?: boolean } | string, + ...rest: [string?, boolean?] ): Promise { - let params: { apiKey?: string, apiSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { apiKey?: string, apiSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + apiPayload['apiKey'] = apiKey; } if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; + apiPayload['apiSecret'] = apiSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1767,7 +2108,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Discord(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Discord(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Discord configuration. * @@ -1778,53 +2123,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Discord(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Discord( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Discord( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1836,7 +2193,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Disqus(params?: { publicKey?: string, secretKey?: string, enabled?: boolean }): Promise; + updateOAuth2Disqus(params?: { + publicKey?: string; + secretKey?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Disqus configuration. * @@ -1847,53 +2208,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Disqus(publicKey?: string, secretKey?: string, enabled?: boolean): Promise; updateOAuth2Disqus( - paramsOrFirst?: { publicKey?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + publicKey?: string, + secretKey?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Disqus( + paramsOrFirst?: + | { publicKey?: string; secretKey?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { publicKey?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { publicKey?: string, secretKey?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof publicKey !== 'undefined') { - payload['publicKey'] = publicKey; + apiPayload['publicKey'] = publicKey; } if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; + apiPayload['secretKey'] = secretKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1905,7 +2278,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Dropbox(params?: { appKey?: string, appSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Dropbox(params?: { + appKey?: string; + appSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Dropbox configuration. * @@ -1916,53 +2293,60 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Dropbox(appKey?: string, appSecret?: string, enabled?: boolean): Promise; updateOAuth2Dropbox( - paramsOrFirst?: { appKey?: string, appSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + appKey?: string, + appSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Dropbox( + paramsOrFirst?: + { appKey?: string; appSecret?: string; enabled?: boolean } | string, + ...rest: [string?, boolean?] ): Promise { - let params: { appKey?: string, appSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appKey?: string, appSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof appKey !== 'undefined') { - payload['appKey'] = appKey; + apiPayload['appKey'] = appKey; } if (typeof appSecret !== 'undefined') { - payload['appSecret'] = appSecret; + apiPayload['appSecret'] = appSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1974,7 +2358,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Etsy(params?: { keyString?: string, sharedSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Etsy(params?: { + keyString?: string; + sharedSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Etsy configuration. * @@ -1985,53 +2373,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Etsy(keyString?: string, sharedSecret?: string, enabled?: boolean): Promise; updateOAuth2Etsy( - paramsOrFirst?: { keyString?: string, sharedSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + keyString?: string, + sharedSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Etsy( + paramsOrFirst?: + | { keyString?: string; sharedSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { keyString?: string, sharedSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyString?: string, sharedSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof keyString !== 'undefined') { - payload['keyString'] = keyString; + apiPayload['keyString'] = keyString; } if (typeof sharedSecret !== 'undefined') { - payload['sharedSecret'] = sharedSecret; + apiPayload['sharedSecret'] = sharedSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2043,7 +2443,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Facebook(params?: { appId?: string, appSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Facebook(params?: { + appId?: string; + appSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Facebook configuration. * @@ -2054,53 +2458,60 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Facebook(appId?: string, appSecret?: string, enabled?: boolean): Promise; updateOAuth2Facebook( - paramsOrFirst?: { appId?: string, appSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + appId?: string, + appSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Facebook( + paramsOrFirst?: + { appId?: string; appSecret?: string; enabled?: boolean } | string, + ...rest: [string?, boolean?] ): Promise { - let params: { appId?: string, appSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId?: string, appSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof appId !== 'undefined') { - payload['appId'] = appId; + apiPayload['appId'] = appId; } if (typeof appSecret !== 'undefined') { - payload['appSecret'] = appSecret; + apiPayload['appSecret'] = appSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2112,7 +2523,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Figma(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Figma(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Figma configuration. * @@ -2123,53 +2538,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Figma(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Figma( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Figma( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2182,7 +2609,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2FusionAuth(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise; + updateOAuth2FusionAuth(params?: { + clientId?: string; + clientSecret?: string; + endpoint?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 FusionAuth configuration. * @@ -2194,58 +2626,78 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2FusionAuth(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise; updateOAuth2FusionAuth( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + endpoint?: string, + enabled?: boolean, + ): Promise; + updateOAuth2FusionAuth( + paramsOrFirst?: + | { + clientId?: string; + clientSecret?: string; + endpoint?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; + apiPayload['endpoint'] = endpoint; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2257,7 +2709,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2GitHub(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2GitHub(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 GitHub configuration. * @@ -2268,53 +2724,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2GitHub(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2GitHub( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2GitHub( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2327,7 +2795,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Gitlab(params?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }): Promise; + updateOAuth2Gitlab(params?: { + applicationId?: string; + secret?: string; + endpoint?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Gitlab configuration. * @@ -2339,58 +2812,78 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Gitlab(applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean): Promise; updateOAuth2Gitlab( - paramsOrFirst?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + applicationId?: string, + secret?: string, + endpoint?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Gitlab( + paramsOrFirst?: + | { + applicationId?: string; + secret?: string; + endpoint?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - let params: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; + apiPayload['applicationId'] = applicationId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; + apiPayload['endpoint'] = endpoint; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2403,7 +2896,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Google(params?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }): Promise; + updateOAuth2Google(params?: { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2GooglePrompt[]; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Google configuration. * @@ -2415,72 +2913,183 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Google(clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean): Promise; updateOAuth2Google( - paramsOrFirst?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean } | string, - ...rest: [(string)?, (ProjectOAuth2GooglePrompt[])?, (boolean)?] + clientId?: string, + clientSecret?: string, + prompt?: ProjectOAuth2GooglePrompt[], + enabled?: boolean, + ): Promise; + updateOAuth2Google( + paramsOrFirst?: + | { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2GooglePrompt[]; + enabled?: boolean; + } + | string, + ...rest: [string?, ProjectOAuth2GooglePrompt[]?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; + let params: { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2GooglePrompt[]; + enabled?: boolean; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2GooglePrompt[]; + enabled?: boolean; + }; } else { params = { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, prompt: rest[1] as ProjectOAuth2GooglePrompt[], - enabled: rest[2] as boolean + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; + apiPayload['prompt'] = prompt; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** - * Update the project OAuth2 Keycloak configuration. + * Update the project OAuth2 Hugging Face 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.clientId - 'Client ID' of Hugging Face OAuth2 app. For example: 2ab9cff9-d711-40ad-a91e-b08a49c42d24 + * @param {string} params.clientSecret - 'Client Secret' of Hugging Face OAuth2 app. For example: oauth_app_secret_wcLhRtl000000000000000000000xbNdLt + * @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} + */ + updateOAuth2HuggingFace(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; + /** + * Update the project OAuth2 Hugging Face configuration. + * + * @param {string} clientId - 'Client ID' of Hugging Face OAuth2 app. For example: 2ab9cff9-d711-40ad-a91e-b08a49c42d24 + * @param {string} clientSecret - 'Client Secret' of Hugging Face OAuth2 app. For example: oauth_app_secret_wcLhRtl000000000000000000000xbNdLt + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2HuggingFace( + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2HuggingFace( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] + ): Promise { + let params: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean, + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + const apiPath = '/project/oauth2/huggingface'; + const apiPayload: Payload = {}; + if (typeof clientId !== 'undefined') { + apiPayload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + apiPayload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Update the project OAuth2 Keycloak configuration. + * + * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} params.endpoint - Domain of Keycloak instance. For example: keycloak.example.com * @param {string} params.realmName - Keycloak realm name. For example: appwrite-realm * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Keycloak(params?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }): Promise; + updateOAuth2Keycloak(params?: { + clientId?: string; + clientSecret?: string; + endpoint?: string; + realmName?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Keycloak configuration. * @@ -2493,63 +3102,87 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Keycloak(clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean): Promise; updateOAuth2Keycloak( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + endpoint?: string, + realmName?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Keycloak( + paramsOrFirst?: + | { + clientId?: string; + clientSecret?: string; + endpoint?: string; + realmName?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; + apiPayload['endpoint'] = endpoint; } if (typeof realmName !== 'undefined') { - payload['realmName'] = realmName; + apiPayload['realmName'] = realmName; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2561,7 +3194,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Kick(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Kick(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Kick configuration. * @@ -2572,53 +3209,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Kick(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Kick( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Kick( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2630,7 +3279,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Linkedin(params?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Linkedin(params?: { + clientId?: string; + primaryClientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Linkedin configuration. * @@ -2641,53 +3294,69 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Linkedin(clientId?: string, primaryClientSecret?: string, enabled?: boolean): Promise; updateOAuth2Linkedin( - paramsOrFirst?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + primaryClientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Linkedin( + paramsOrFirst?: + | { + clientId?: string; + primaryClientSecret?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof primaryClientSecret !== 'undefined') { - payload['primaryClientSecret'] = primaryClientSecret; + apiPayload['primaryClientSecret'] = primaryClientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2700,7 +3369,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Microsoft(params?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }): Promise; + updateOAuth2Microsoft(params?: { + applicationId?: string; + applicationSecret?: string; + tenant?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Microsoft configuration. * @@ -2712,58 +3386,78 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Microsoft(applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean): Promise; updateOAuth2Microsoft( - paramsOrFirst?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + applicationId?: string, + applicationSecret?: string, + tenant?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Microsoft( + paramsOrFirst?: + | { + applicationId?: string; + applicationSecret?: string; + tenant?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - let params: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; + apiPayload['applicationId'] = applicationId; } if (typeof applicationSecret !== 'undefined') { - payload['applicationSecret'] = applicationSecret; + apiPayload['applicationSecret'] = applicationSecret; } if (typeof tenant !== 'undefined') { - payload['tenant'] = tenant; + apiPayload['tenant'] = tenant; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2775,7 +3469,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Notion(params?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Notion(params?: { + oauthClientId?: string; + oauthClientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Notion configuration. * @@ -2786,53 +3484,69 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Notion(oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean): Promise; updateOAuth2Notion( - paramsOrFirst?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + oauthClientId?: string, + oauthClientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Notion( + paramsOrFirst?: + | { + oauthClientId?: string; + oauthClientSecret?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof oauthClientId !== 'undefined') { - payload['oauthClientId'] = oauthClientId; + apiPayload['oauthClientId'] = oauthClientId; } if (typeof oauthClientSecret !== 'undefined') { - payload['oauthClientSecret'] = oauthClientSecret; + apiPayload['oauthClientSecret'] = oauthClientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2850,7 +3564,17 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean }): Promise; + updateOAuth2Oidc(params?: { + clientId?: string; + clientSecret?: string; + wellKnownURL?: string; + authorizationURL?: string; + tokenURL?: string; + userInfoURL?: string; + prompt?: ProjectOAuth2OidcPrompt[]; + maxAge?: number; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Oidc configuration. * @@ -2867,15 +3591,71 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean): Promise; updateOAuth2Oidc( - paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (ProjectOAuth2OidcPrompt[])?, (number)?, (boolean)?] + clientId?: string, + clientSecret?: string, + wellKnownURL?: string, + authorizationURL?: string, + tokenURL?: string, + userInfoURL?: string, + prompt?: ProjectOAuth2OidcPrompt[], + maxAge?: number, + enabled?: boolean, + ): Promise; + updateOAuth2Oidc( + paramsOrFirst?: + | { + clientId?: string; + clientSecret?: string; + wellKnownURL?: string; + authorizationURL?: string; + tokenURL?: string; + userInfoURL?: string; + prompt?: ProjectOAuth2OidcPrompt[]; + maxAge?: number; + enabled?: boolean; + } + | string, + ...rest: [ + string?, + string?, + string?, + string?, + string?, + ProjectOAuth2OidcPrompt[]?, + number?, + boolean?, + ] ): Promise { - let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, 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, prompt?: ProjectOAuth2OidcPrompt[], maxAge?: number, enabled?: boolean }; + let params: { + clientId?: string; + clientSecret?: string; + wellKnownURL?: string; + authorizationURL?: string; + tokenURL?: string; + userInfoURL?: string; + prompt?: ProjectOAuth2OidcPrompt[]; + maxAge?: number; + 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; + prompt?: ProjectOAuth2OidcPrompt[]; + maxAge?: number; + enabled?: boolean; + }; } else { params = { clientId: paramsOrFirst as string, @@ -2886,10 +3666,10 @@ export class Project { userInfoURL: rest[4] as string, prompt: rest[5] as ProjectOAuth2OidcPrompt[], maxAge: rest[6] as number, - enabled: rest[7] as boolean + enabled: rest[7] as boolean, }; } - + const clientId = params.clientId; const clientSecret = params.clientSecret; const wellKnownURL = params.wellKnownURL; @@ -2899,51 +3679,44 @@ export class Project { const prompt = params.prompt; const maxAge = params.maxAge; const enabled = params.enabled; - - const apiPath = '/project/oauth2/oidc'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof wellKnownURL !== 'undefined') { - payload['wellKnownURL'] = wellKnownURL; + apiPayload['wellKnownURL'] = wellKnownURL; } if (typeof authorizationURL !== 'undefined') { - payload['authorizationURL'] = authorizationURL; + apiPayload['authorizationURL'] = authorizationURL; } if (typeof tokenURL !== 'undefined') { - payload['tokenURL'] = tokenURL; + apiPayload['tokenURL'] = tokenURL; } if (typeof userInfoURL !== 'undefined') { - payload['userInfoURL'] = userInfoURL; + apiPayload['userInfoURL'] = userInfoURL; } if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; + apiPayload['prompt'] = prompt; } if (typeof maxAge !== 'undefined') { - payload['maxAge'] = maxAge; + apiPayload['maxAge'] = maxAge; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2957,7 +3730,13 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Okta(params?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }): Promise; + updateOAuth2Okta(params?: { + clientId?: string; + clientSecret?: string; + domain?: string; + authorizationServerId?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Okta configuration. * @@ -2970,63 +3749,87 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Okta(clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean): Promise; updateOAuth2Okta( - paramsOrFirst?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + domain?: string, + authorizationServerId?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Okta( + paramsOrFirst?: + | { + clientId?: string; + clientSecret?: string; + domain?: string; + authorizationServerId?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } if (typeof authorizationServerId !== 'undefined') { - payload['authorizationServerId'] = authorizationServerId; + apiPayload['authorizationServerId'] = authorizationServerId; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3038,7 +3841,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Paypal(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise; + updateOAuth2Paypal(params?: { + clientId?: string; + secretKey?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Paypal configuration. * @@ -3049,53 +3856,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Paypal(clientId?: string, secretKey?: string, enabled?: boolean): Promise; updateOAuth2Paypal( - paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + secretKey?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Paypal( + paramsOrFirst?: + | { clientId?: string; secretKey?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; + apiPayload['secretKey'] = secretKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3107,7 +3926,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2PaypalSandbox(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise; + updateOAuth2PaypalSandbox(params?: { + clientId?: string; + secretKey?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 PaypalSandbox configuration. * @@ -3118,53 +3941,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2PaypalSandbox(clientId?: string, secretKey?: string, enabled?: boolean): Promise; updateOAuth2PaypalSandbox( - paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + secretKey?: string, + enabled?: boolean, + ): Promise; + updateOAuth2PaypalSandbox( + paramsOrFirst?: + | { clientId?: string; secretKey?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; + apiPayload['secretKey'] = secretKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3176,7 +4011,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Podio(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Podio(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Podio configuration. * @@ -3187,53 +4026,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Podio(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Podio( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Podio( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3245,7 +4096,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Salesforce(params?: { customerKey?: string, customerSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Salesforce(params?: { + customerKey?: string; + customerSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Salesforce configuration. * @@ -3256,53 +4111,69 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Salesforce(customerKey?: string, customerSecret?: string, enabled?: boolean): Promise; updateOAuth2Salesforce( - paramsOrFirst?: { customerKey?: string, customerSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + customerKey?: string, + customerSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Salesforce( + paramsOrFirst?: + | { + customerKey?: string; + customerSecret?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { customerKey?: string, customerSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { customerKey?: string, customerSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof customerKey !== 'undefined') { - payload['customerKey'] = customerKey; + apiPayload['customerKey'] = customerKey; } if (typeof customerSecret !== 'undefined') { - payload['customerSecret'] = customerSecret; + apiPayload['customerSecret'] = customerSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3314,7 +4185,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Slack(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Slack(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Slack configuration. * @@ -3325,53 +4200,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Slack(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Slack( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Slack( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3383,7 +4270,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Spotify(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Spotify(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Spotify configuration. * @@ -3394,53 +4285,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Spotify(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Spotify( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Spotify( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3452,7 +4355,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Stripe(params?: { clientId?: string, apiSecretKey?: string, enabled?: boolean }): Promise; + updateOAuth2Stripe(params?: { + clientId?: string; + apiSecretKey?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Stripe configuration. * @@ -3463,53 +4370,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Stripe(clientId?: string, apiSecretKey?: string, enabled?: boolean): Promise; updateOAuth2Stripe( - paramsOrFirst?: { clientId?: string, apiSecretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + apiSecretKey?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Stripe( + paramsOrFirst?: + | { clientId?: string; apiSecretKey?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, apiSecretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, apiSecretKey?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof apiSecretKey !== 'undefined') { - payload['apiSecretKey'] = apiSecretKey; + apiPayload['apiSecretKey'] = apiSecretKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3521,7 +4440,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Tradeshift(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Tradeshift(params?: { + oauth2ClientId?: string; + oauth2ClientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Tradeshift configuration. * @@ -3532,53 +4455,69 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Tradeshift(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise; updateOAuth2Tradeshift( - paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + oauth2ClientId?: string, + oauth2ClientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Tradeshift( + paramsOrFirst?: + | { + oauth2ClientId?: string; + oauth2ClientSecret?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof oauth2ClientId !== 'undefined') { - payload['oauth2ClientId'] = oauth2ClientId; + apiPayload['oauth2ClientId'] = oauth2ClientId; } if (typeof oauth2ClientSecret !== 'undefined') { - payload['oauth2ClientSecret'] = oauth2ClientSecret; + apiPayload['oauth2ClientSecret'] = oauth2ClientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3590,7 +4529,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2TradeshiftSandbox(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2TradeshiftSandbox(params?: { + oauth2ClientId?: string; + oauth2ClientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Tradeshift Sandbox configuration. * @@ -3601,53 +4544,69 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2TradeshiftSandbox(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise; updateOAuth2TradeshiftSandbox( - paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + oauth2ClientId?: string, + oauth2ClientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2TradeshiftSandbox( + paramsOrFirst?: + | { + oauth2ClientId?: string; + oauth2ClientSecret?: string; + enabled?: boolean; + } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof oauth2ClientId !== 'undefined') { - payload['oauth2ClientId'] = oauth2ClientId; + apiPayload['oauth2ClientId'] = oauth2ClientId; } if (typeof oauth2ClientSecret !== 'undefined') { - payload['oauth2ClientSecret'] = oauth2ClientSecret; + apiPayload['oauth2ClientSecret'] = oauth2ClientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3659,7 +4618,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Twitch(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Twitch(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Twitch configuration. * @@ -3670,53 +4633,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Twitch(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Twitch( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Twitch( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3728,7 +4703,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2WordPress(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2WordPress(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 WordPress configuration. * @@ -3739,53 +4718,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2WordPress(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2WordPress( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2WordPress( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3797,7 +4788,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2X(params?: { customerKey?: string, secretKey?: string, enabled?: boolean }): Promise; + updateOAuth2X(params?: { + customerKey?: string; + secretKey?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 X configuration. * @@ -3808,53 +4803,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2X(customerKey?: string, secretKey?: string, enabled?: boolean): Promise; updateOAuth2X( - paramsOrFirst?: { customerKey?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + customerKey?: string, + secretKey?: string, + enabled?: boolean, + ): Promise; + updateOAuth2X( + paramsOrFirst?: + | { customerKey?: string; secretKey?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { customerKey?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { customerKey?: string, secretKey?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof customerKey !== 'undefined') { - payload['customerKey'] = customerKey; + apiPayload['customerKey'] = customerKey; } if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; + apiPayload['secretKey'] = secretKey; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3866,7 +4873,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Yahoo(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Yahoo(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Yahoo configuration. * @@ -3877,53 +4888,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Yahoo(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Yahoo( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Yahoo( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3935,7 +4958,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Yandex(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Yandex(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Yandex configuration. * @@ -3946,53 +4973,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Yandex(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Yandex( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Yandex( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4004,7 +5043,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Zoho(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Zoho(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Zoho configuration. * @@ -4015,53 +5058,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Zoho(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Zoho( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Zoho( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4073,7 +5128,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Zoom(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise; + updateOAuth2Zoom(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise; /** * Update the project OAuth2 Zoom configuration. * @@ -4084,53 +5143,65 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Zoom(clientId?: string, clientSecret?: string, enabled?: boolean): Promise; updateOAuth2Zoom( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise; + updateOAuth2Zoom( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; + apiPayload['clientId'] = clientId; } if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; + apiPayload['clientSecret'] = clientSecret; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4138,52 +5209,188 @@ export class Project { * * @param {ProjectOAuthProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} - * @returns {Promise} - */ - getOAuth2Provider(params: { providerId: ProjectOAuthProviderId }): Promise; + * @returns {Promise} + */ + getOAuth2Provider(params: { + providerId: ProjectOAuthProviderId; + }): 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.OAuth2HuggingFace + | 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 {ProjectOAuthProviderId} providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getOAuth2Provider(providerId: ProjectOAuthProviderId): Promise; getOAuth2Provider( - paramsOrFirst: { providerId: ProjectOAuthProviderId } | ProjectOAuthProviderId - ): Promise { + providerId: ProjectOAuthProviderId, + ): 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.OAuth2HuggingFace + | 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: ProjectOAuthProviderId } | ProjectOAuthProviderId, + ): 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.OAuth2HuggingFace + | 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: ProjectOAuthProviderId }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: ProjectOAuthProviderId }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'providerId' in paramsOrFirst + ) { + params = (paramsOrFirst || {}) as { + providerId: ProjectOAuthProviderId; + }; } else { params = { - providerId: paramsOrFirst as ProjectOAuthProviderId + providerId: paramsOrFirst as ProjectOAuthProviderId, }; } - - const providerId = params.providerId; + const providerId = params.providerId; if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); + throw new AppwriteException( + 'Missing required parameter: "providerId"', + ); } - - const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', encodeURIComponent(String(providerId))); - const payload: Payload = {}; + const apiPath = '/project/oauth2/{providerId}'.replace( + '{providerId}', + encodeURIComponent(String(providerId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -4194,7 +5401,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - listPlatforms(params?: { queries?: string[], total?: boolean }): Promise; + listPlatforms(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. * @@ -4204,47 +5414,51 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listPlatforms(queries?: string[], total?: boolean): Promise; listPlatforms( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listPlatforms( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/project/platforms'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -4256,7 +5470,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - createAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise; + createAndroidPlatform(params: { + platformId: string; + name: string; + applicationId: string; + }): Promise; /** * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. * @@ -4267,62 +5485,73 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createAndroidPlatform(platformId: string, name: string, applicationId: string): Promise; createAndroidPlatform( - paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + applicationId: string, + ): Promise; + createAndroidPlatform( + paramsOrFirst: + | { platformId: string; name: string; applicationId: string } + | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, applicationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "applicationId"', + ); } - const apiPath = '/project/platforms/android'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; + apiPayload['platformId'] = platformId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; + apiPayload['applicationId'] = applicationId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4334,7 +5563,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise; + updateAndroidPlatform(params: { + platformId: string; + name: string; + applicationId: string; + }): Promise; /** * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. * @@ -4345,59 +5578,73 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateAndroidPlatform(platformId: string, name: string, applicationId: string): Promise; updateAndroidPlatform( - paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + applicationId: string, + ): Promise; + updateAndroidPlatform( + paramsOrFirst: + | { platformId: string; name: string; applicationId: string } + | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, applicationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "applicationId"', + ); } - - const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); - const payload: Payload = {}; + const apiPath = '/project/platforms/android/{platformId}'.replace( + '{platformId}', + encodeURIComponent(String(platformId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; + apiPayload['applicationId'] = applicationId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -4409,7 +5656,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - createApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise; + createApplePlatform(params: { + platformId: string; + name: string; + bundleIdentifier: string; + }): Promise; /** * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. * @@ -4420,62 +5671,77 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise; createApplePlatform( - paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + bundleIdentifier: string, + ): Promise; + createApplePlatform( + paramsOrFirst: + | { platformId: string; name: string; bundleIdentifier: string } + | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, bundleIdentifier: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "bundleIdentifier"', + ); } - const apiPath = '/project/platforms/apple'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; + apiPayload['platformId'] = platformId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof bundleIdentifier !== 'undefined') { - payload['bundleIdentifier'] = bundleIdentifier; + apiPayload['bundleIdentifier'] = bundleIdentifier; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4487,7 +5753,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise; + updateApplePlatform(params: { + platformId: string; + name: string; + bundleIdentifier: string; + }): Promise; /** * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. * @@ -4498,59 +5768,77 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise; updateApplePlatform( - paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + bundleIdentifier: string, + ): Promise; + updateApplePlatform( + paramsOrFirst: + | { platformId: string; name: string; bundleIdentifier: string } + | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, bundleIdentifier: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "bundleIdentifier"', + ); } - - const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); - const payload: Payload = {}; + const apiPath = '/project/platforms/apple/{platformId}'.replace( + '{platformId}', + encodeURIComponent(String(platformId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof bundleIdentifier !== 'undefined') { - payload['bundleIdentifier'] = bundleIdentifier; + apiPayload['bundleIdentifier'] = bundleIdentifier; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -4562,7 +5850,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - createLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise; + createLinuxPlatform(params: { + platformId: string; + name: string; + packageName: string; + }): Promise; /** * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. * @@ -4573,62 +5865,72 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createLinuxPlatform(platformId: string, name: string, packageName: string): Promise; createLinuxPlatform( - paramsOrFirst: { platformId: string, name: string, packageName: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + packageName: string, + ): Promise; + createLinuxPlatform( + paramsOrFirst: + { platformId: string; name: string; packageName: string } | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, packageName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "packageName"', + ); } - const apiPath = '/project/platforms/linux'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; + apiPayload['platformId'] = platformId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof packageName !== 'undefined') { - payload['packageName'] = packageName; + apiPayload['packageName'] = packageName; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4640,7 +5942,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise; + updateLinuxPlatform(params: { + platformId: string; + name: string; + packageName: string; + }): Promise; /** * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. * @@ -4651,59 +5957,72 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLinuxPlatform(platformId: string, name: string, packageName: string): Promise; updateLinuxPlatform( - paramsOrFirst: { platformId: string, name: string, packageName: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + packageName: string, + ): Promise; + updateLinuxPlatform( + paramsOrFirst: + { platformId: string; name: string; packageName: string } | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, packageName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "packageName"', + ); } - - const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); - const payload: Payload = {}; + const apiPath = '/project/platforms/linux/{platformId}'.replace( + '{platformId}', + encodeURIComponent(String(platformId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof packageName !== 'undefined') { - payload['packageName'] = packageName; + apiPayload['packageName'] = packageName; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -4715,7 +6034,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - createWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise; + createWebPlatform(params: { + platformId: string; + name: string; + hostname: string; + }): Promise; /** * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. * @@ -4726,62 +6049,72 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createWebPlatform(platformId: string, name: string, hostname: string): Promise; createWebPlatform( - paramsOrFirst: { platformId: string, name: string, hostname: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + hostname: string, + ): Promise; + createWebPlatform( + paramsOrFirst: + { platformId: string; name: string; hostname: string } | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, hostname: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "hostname"', + ); } - const apiPath = '/project/platforms/web'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; + apiPayload['platformId'] = platformId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; + apiPayload['hostname'] = hostname; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4793,7 +6126,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise; + updateWebPlatform(params: { + platformId: string; + name: string; + hostname: string; + }): Promise; /** * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. * @@ -4804,59 +6141,72 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateWebPlatform(platformId: string, name: string, hostname: string): Promise; updateWebPlatform( - paramsOrFirst: { platformId: string, name: string, hostname: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + hostname: string, + ): Promise; + updateWebPlatform( + paramsOrFirst: + { platformId: string; name: string; hostname: string } | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, hostname: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "hostname"', + ); } - - const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); - const payload: Payload = {}; + const apiPath = '/project/platforms/web/{platformId}'.replace( + '{platformId}', + encodeURIComponent(String(platformId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; + apiPayload['hostname'] = hostname; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -4868,7 +6218,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - createWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise; + createWindowsPlatform(params: { + platformId: string; + name: string; + packageIdentifierName: string; + }): Promise; /** * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. * @@ -4879,62 +6233,81 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise; createWindowsPlatform( - paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + packageIdentifierName: string, + ): Promise; + createWindowsPlatform( + paramsOrFirst: + | { + platformId: string; + name: string; + packageIdentifierName: string; + } + | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, packageIdentifierName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "packageIdentifierName"', + ); } - const apiPath = '/project/platforms/windows'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; + apiPayload['platformId'] = platformId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof packageIdentifierName !== 'undefined') { - payload['packageIdentifierName'] = packageIdentifierName; + apiPayload['packageIdentifierName'] = packageIdentifierName; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4946,7 +6319,11 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise; + updateWindowsPlatform(params: { + platformId: string; + name: string; + packageIdentifierName: string; + }): Promise; /** * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. * @@ -4957,59 +6334,81 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise; updateWindowsPlatform( - paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, - ...rest: [(string)?, (string)?] + platformId: string, + name: string, + packageIdentifierName: string, + ): Promise; + updateWindowsPlatform( + paramsOrFirst: + | { + platformId: string; + name: string; + packageIdentifierName: string; + } + | string, + ...rest: [string?, string?] ): Promise { - let params: { platformId: string, name: string, packageIdentifierName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + 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 + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "packageIdentifierName"', + ); } - - const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); - const payload: Payload = {}; + const apiPath = '/project/platforms/windows/{platformId}'.replace( + '{platformId}', + encodeURIComponent(String(platformId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof packageIdentifierName !== 'undefined') { - payload['packageIdentifierName'] = packageIdentifierName; + apiPayload['packageIdentifierName'] = packageIdentifierName; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -5019,7 +6418,15 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - getPlatform(params: { platformId: string }): Promise; + 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. * @@ -5028,41 +6435,57 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPlatform(platformId: string): Promise; getPlatform( - paramsOrFirst: { platformId: string } | string - ): Promise { + 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))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { platformId: string }; } else { params = { - platformId: paramsOrFirst as string + platformId: paramsOrFirst as string, }; } - - const platformId = params.platformId; + const platformId = params.platformId; if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); + throw new AppwriteException( + 'Missing required parameter: "platformId"', + ); } - - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); - const payload: Payload = {}; + const apiPath = '/project/platforms/{platformId}'.replace( + '{platformId}', + encodeURIComponent(String(platformId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5083,39 +6506,41 @@ export class Project { */ deletePlatform(platformId: string): Promise<{}>; deletePlatform( - paramsOrFirst: { platformId: string } | string + paramsOrFirst: { platformId: string } | string, ): Promise<{}> { let params: { platformId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { platformId: string }; } else { params = { - platformId: paramsOrFirst as string + platformId: paramsOrFirst as string, }; } - - const platformId = params.platformId; + const platformId = params.platformId; if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); + throw new AppwriteException( + 'Missing required parameter: "platformId"', + ); } - - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', encodeURIComponent(String(platformId))); - const payload: Payload = {}; + const apiPath = '/project/platforms/{platformId}'.replace( + '{platformId}', + encodeURIComponent(String(platformId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -5126,7 +6551,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - listPolicies(params?: { queries?: string[], total?: boolean }): Promise; + listPolicies(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all project policies and their current configuration. * @@ -5136,47 +6564,51 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listPolicies(queries?: string[], total?: boolean): Promise; listPolicies( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listPolicies( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/project/policies'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5186,7 +6618,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateDenyAliasedEmailPolicy(params: { enabled: boolean }): Promise; + updateDenyAliasedEmailPolicy(params: { + enabled: boolean; + }): Promise; /** * Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. * @@ -5197,43 +6631,42 @@ export class Project { */ updateDenyAliasedEmailPolicy(enabled: boolean): Promise; updateDenyAliasedEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/deny-aliased-email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5243,7 +6676,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateDenyCorporateEmailPolicy(params: { enabled: boolean }): Promise; + updateDenyCorporateEmailPolicy(params: { + enabled: boolean; + }): Promise; /** * Configures if only corporate email addresses (non-free and non-disposable domains) are allowed during new user sign-ups and email updates. * @@ -5254,43 +6689,42 @@ export class Project { */ updateDenyCorporateEmailPolicy(enabled: boolean): Promise; updateDenyCorporateEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/deny-corporate-email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5300,7 +6734,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateDenyDisposableEmailPolicy(params: { enabled: boolean }): Promise; + updateDenyDisposableEmailPolicy(params: { + enabled: boolean; + }): Promise; /** * Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. * @@ -5311,43 +6747,42 @@ export class Project { */ updateDenyDisposableEmailPolicy(enabled: boolean): Promise; updateDenyDisposableEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/deny-disposable-email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5357,7 +6792,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateDenyFreeEmailPolicy(params: { enabled: boolean }): Promise; + updateDenyFreeEmailPolicy(params: { + enabled: boolean; + }): Promise; /** * Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. * @@ -5368,43 +6805,42 @@ export class Project { */ updateDenyFreeEmailPolicy(enabled: boolean): Promise; updateDenyFreeEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/deny-free-email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5419,7 +6855,14 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateMembershipPrivacyPolicy(params?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean }): Promise; + updateMembershipPrivacyPolicy(params?: { + userId?: boolean; + userEmail?: boolean; + userPhone?: boolean; + userName?: boolean; + userMFA?: boolean; + userAccessedAt?: boolean; + }): Promise; /** * 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.. * @@ -5433,15 +6876,50 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMembershipPrivacyPolicy(userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean): Promise; updateMembershipPrivacyPolicy( - paramsOrFirst?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean } | boolean, - ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?, (boolean)?] + userId?: boolean, + userEmail?: boolean, + userPhone?: boolean, + userName?: boolean, + userMFA?: boolean, + userAccessedAt?: boolean, + ): Promise; + updateMembershipPrivacyPolicy( + paramsOrFirst?: + | { + userId?: boolean; + userEmail?: boolean; + userPhone?: boolean; + userName?: boolean; + userMFA?: boolean; + userAccessedAt?: boolean; + } + | boolean, + ...rest: [boolean?, boolean?, boolean?, boolean?, boolean?] ): Promise { - let params: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean, userAccessedAt?: boolean }; + let params: { + userId?: boolean; + userEmail?: boolean; + userPhone?: boolean; + userName?: boolean; + userMFA?: boolean; + userAccessedAt?: boolean; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + userId?: boolean; + userEmail?: boolean; + userPhone?: boolean; + userName?: boolean; + userMFA?: boolean; + userAccessedAt?: boolean; + }; } else { params = { userId: paramsOrFirst as boolean, @@ -5449,52 +6927,45 @@ export class Project { userPhone: rest[1] as boolean, userName: rest[2] as boolean, userMFA: rest[3] as boolean, - userAccessedAt: rest[4] as boolean + userAccessedAt: rest[4] as boolean, }; } - + const userId = params.userId; const userEmail = params.userEmail; const userPhone = params.userPhone; const userName = params.userName; const userMFA = params.userMFA; const userAccessedAt = params.userAccessedAt; - - const apiPath = '/project/policies/membership-privacy'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof userEmail !== 'undefined') { - payload['userEmail'] = userEmail; + apiPayload['userEmail'] = userEmail; } if (typeof userPhone !== 'undefined') { - payload['userPhone'] = userPhone; + apiPayload['userPhone'] = userPhone; } if (typeof userName !== 'undefined') { - payload['userName'] = userName; + apiPayload['userName'] = userName; } if (typeof userMFA !== 'undefined') { - payload['userMFA'] = userMFA; + apiPayload['userMFA'] = userMFA; } if (typeof userAccessedAt !== 'undefined') { - payload['userAccessedAt'] = userAccessedAt; + apiPayload['userAccessedAt'] = userAccessedAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5507,7 +6978,12 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateMFAFactorsPolicy(params?: { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean }): Promise; + updateMFAFactorsPolicy(params?: { + totp?: boolean; + email?: boolean; + phone?: boolean; + custom?: boolean; + }): Promise; /** * Updating this policy allows you to control which factors users can use to complete an MFA challenge. Disabled factors cannot be used to create a challenge and are reported as unavailable when listing factors. The custom factor is disabled by default; enable it to deliver challenge codes through your own channel. Recovery codes always remain available as a fallback. * @@ -5519,58 +6995,78 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMFAFactorsPolicy(totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean): Promise; updateMFAFactorsPolicy( - paramsOrFirst?: { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean } | boolean, - ...rest: [(boolean)?, (boolean)?, (boolean)?] + totp?: boolean, + email?: boolean, + phone?: boolean, + custom?: boolean, + ): Promise; + updateMFAFactorsPolicy( + paramsOrFirst?: + | { + totp?: boolean; + email?: boolean; + phone?: boolean; + custom?: boolean; + } + | boolean, + ...rest: [boolean?, boolean?, boolean?] ): Promise { - let params: { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { totp?: boolean, email?: boolean, phone?: boolean, custom?: boolean }; + let params: { + totp?: boolean; + email?: boolean; + phone?: boolean; + custom?: boolean; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + totp?: boolean; + email?: boolean; + phone?: boolean; + custom?: boolean; + }; } else { params = { totp: paramsOrFirst as boolean, email: rest[0] as boolean, phone: rest[1] as boolean, - custom: rest[2] as boolean + custom: rest[2] as boolean, }; } - + const totp = params.totp; const email = params.email; const phone = params.phone; const custom = params.custom; - - const apiPath = '/project/policies/mfa-factors'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof totp !== 'undefined') { - payload['totp'] = totp; + apiPayload['totp'] = totp; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof phone !== 'undefined') { - payload['phone'] = phone; + apiPayload['phone'] = phone; } if (typeof custom !== 'undefined') { - payload['custom'] = custom; + apiPayload['custom'] = custom; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5580,7 +7076,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updatePasswordDictionaryPolicy(params: { enabled: boolean }): Promise; + updatePasswordDictionaryPolicy(params: { + enabled: boolean; + }): Promise; /** * 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. * @@ -5591,58 +7089,59 @@ export class Project { */ updatePasswordDictionaryPolicy(enabled: boolean): Promise; updatePasswordDictionaryPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/password-dictionary'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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 20, or null to disable the limit. * @throws {AppwriteException} * @returns {Promise} */ - updatePasswordHistoryPolicy(params: { total?: number }): Promise; + updatePasswordHistoryPolicy(params: { + total?: number; + }): Promise; /** * 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 20, or null to disable the limit. @@ -5652,43 +7151,40 @@ export class Project { */ updatePasswordHistoryPolicy(total?: number): Promise; updatePasswordHistoryPolicy( - paramsOrFirst?: { total?: number } | number + paramsOrFirst?: { total?: number } | number, ): Promise { let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { total?: number }; } else { params = { - total: paramsOrFirst as number + total: paramsOrFirst as number, }; } - - const total = params.total; + const total = params.total; if (typeof total === 'undefined') { throw new AppwriteException('Missing required parameter: "total"'); } - const apiPath = '/project/policies/password-history'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5698,7 +7194,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updatePasswordPersonalDataPolicy(params: { enabled: boolean }): Promise; + updatePasswordPersonalDataPolicy(params: { + enabled: boolean; + }): Promise; /** * 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. * @@ -5709,43 +7207,42 @@ export class Project { */ updatePasswordPersonalDataPolicy(enabled: boolean): Promise; updatePasswordPersonalDataPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/password-personal-data'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5759,7 +7256,13 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updatePasswordStrengthPolicy(params?: { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean }): Promise; + updatePasswordStrengthPolicy(params?: { + min?: number; + uppercase?: boolean; + lowercase?: boolean; + number?: boolean; + symbols?: boolean; + }): Promise; /** * Update the password strength requirements for users in the project. * @@ -5772,63 +7275,87 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePasswordStrengthPolicy(min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean): Promise; updatePasswordStrengthPolicy( - paramsOrFirst?: { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean } | number, - ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?] + min?: number, + uppercase?: boolean, + lowercase?: boolean, + number?: boolean, + symbols?: boolean, + ): Promise; + updatePasswordStrengthPolicy( + paramsOrFirst?: + | { + min?: number; + uppercase?: boolean; + lowercase?: boolean; + number?: boolean; + symbols?: boolean; + } + | number, + ...rest: [boolean?, boolean?, boolean?, boolean?] ): Promise { - let params: { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { min?: number, uppercase?: boolean, lowercase?: boolean, number?: boolean, symbols?: boolean }; + let params: { + min?: number; + uppercase?: boolean; + lowercase?: boolean; + number?: boolean; + symbols?: boolean; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + min?: number; + uppercase?: boolean; + lowercase?: boolean; + number?: boolean; + symbols?: boolean; + }; } else { params = { min: paramsOrFirst as number, uppercase: rest[0] as boolean, lowercase: rest[1] as boolean, number: rest[2] as boolean, - symbols: rest[3] as boolean + symbols: rest[3] as boolean, }; } - + const min = params.min; const uppercase = params.uppercase; const lowercase = params.lowercase; const number = params.number; const symbols = params.symbols; - - const apiPath = '/project/policies/password-strength'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof uppercase !== 'undefined') { - payload['uppercase'] = uppercase; + apiPayload['uppercase'] = uppercase; } if (typeof lowercase !== 'undefined') { - payload['lowercase'] = lowercase; + apiPayload['lowercase'] = lowercase; } if (typeof number !== 'undefined') { - payload['number'] = number; + apiPayload['number'] = number; } if (typeof symbols !== 'undefined') { - payload['symbols'] = symbols; + apiPayload['symbols'] = symbols; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5838,7 +7365,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateSessionAlertPolicy(params: { enabled: boolean }): Promise; + updateSessionAlertPolicy(params: { + enabled: boolean; + }): Promise; /** * 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. * @@ -5849,43 +7378,42 @@ export class Project { */ updateSessionAlertPolicy(enabled: boolean): Promise; updateSessionAlertPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/session-alert'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5895,7 +7423,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateSessionDurationPolicy(params: { duration: number }): Promise; + updateSessionDurationPolicy(params: { + duration: number; + }): Promise; /** * Update maximum duration how long sessions created within a project should stay active for. * @@ -5906,43 +7436,42 @@ export class Project { */ updateSessionDurationPolicy(duration: number): Promise; updateSessionDurationPolicy( - paramsOrFirst: { duration: number } | number + paramsOrFirst: { duration: number } | number, ): Promise { let params: { duration: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { duration: number }; } else { params = { - duration: paramsOrFirst as number + duration: paramsOrFirst as number, }; } - - const duration = params.duration; + const duration = params.duration; if (typeof duration === 'undefined') { - throw new AppwriteException('Missing required parameter: "duration"'); + throw new AppwriteException( + 'Missing required parameter: "duration"', + ); } - const apiPath = '/project/policies/session-duration'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof duration !== 'undefined') { - payload['duration'] = duration; + apiPayload['duration'] = duration; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5952,7 +7481,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateSessionInvalidationPolicy(params: { enabled: boolean }): Promise; + updateSessionInvalidationPolicy(params: { + enabled: boolean; + }): Promise; /** * 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. * @@ -5963,43 +7494,42 @@ export class Project { */ updateSessionInvalidationPolicy(enabled: boolean): Promise; updateSessionInvalidationPolicy( - paramsOrFirst: { enabled: boolean } | boolean + paramsOrFirst: { enabled: boolean } | boolean, ): Promise { let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { enabled: boolean }; } else { params = { - enabled: paramsOrFirst as boolean + enabled: paramsOrFirst as boolean, }; } - - const enabled = params.enabled; + const enabled = params.enabled; if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - const apiPath = '/project/policies/session-invalidation'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6009,7 +7539,9 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateSessionLimitPolicy(params: { total: number }): Promise; + updateSessionLimitPolicy(params: { + total: number; + }): Promise; /** * 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. * @@ -6020,43 +7552,40 @@ export class Project { */ updateSessionLimitPolicy(total: number): Promise; updateSessionLimitPolicy( - paramsOrFirst: { total: number } | number + paramsOrFirst: { total: number } | number, ): Promise { let params: { total: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { total: number }; } else { params = { - total: paramsOrFirst as number + total: paramsOrFirst as number, }; } - - const total = params.total; + const total = params.total; if (typeof total === 'undefined') { throw new AppwriteException('Missing required parameter: "total"'); } - const apiPath = '/project/policies/session-limit'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6077,43 +7606,40 @@ export class Project { */ updateUserLimitPolicy(total?: number): Promise; updateUserLimitPolicy( - paramsOrFirst?: { total?: number } | number + paramsOrFirst?: { total?: number } | number, ): Promise { let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { total?: number }; } else { params = { - total: paramsOrFirst as number + total: paramsOrFirst as number, }; } - - const total = params.total; + const total = params.total; if (typeof total === 'undefined') { throw new AppwriteException('Missing required parameter: "total"'); } - const apiPath = '/project/policies/user-limit'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6123,7 +7649,25 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - getPolicy(params: { policyId: ProjectPolicyId }): Promise; + getPolicy(params: { + policyId: ProjectPolicyId; + }): Promise< + | Models.PolicyPasswordDictionary + | Models.PolicyPasswordHistory + | Models.PolicyPasswordStrength + | Models.PolicyPasswordPersonalData + | Models.PolicySessionAlert + | Models.PolicySessionDuration + | Models.PolicySessionInvalidation + | Models.PolicySessionLimit + | Models.PolicyUserLimit + | Models.PolicyMembershipPrivacy + | Models.PolicyMfaFactors + | Models.PolicyDenyAliasedEmail + | Models.PolicyDenyDisposableEmail + | Models.PolicyDenyFreeEmail + | Models.PolicyDenyCorporateEmail + >; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * @@ -6132,54 +7676,94 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: ProjectPolicyId): Promise; getPolicy( - paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId - ): Promise { + policyId: ProjectPolicyId, + ): Promise< + | Models.PolicyPasswordDictionary + | Models.PolicyPasswordHistory + | Models.PolicyPasswordStrength + | Models.PolicyPasswordPersonalData + | Models.PolicySessionAlert + | Models.PolicySessionDuration + | Models.PolicySessionInvalidation + | Models.PolicySessionLimit + | Models.PolicyUserLimit + | Models.PolicyMembershipPrivacy + | Models.PolicyMfaFactors + | Models.PolicyDenyAliasedEmail + | Models.PolicyDenyDisposableEmail + | Models.PolicyDenyFreeEmail + | Models.PolicyDenyCorporateEmail + >; + getPolicy( + paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId, + ): Promise< + | Models.PolicyPasswordDictionary + | Models.PolicyPasswordHistory + | Models.PolicyPasswordStrength + | Models.PolicyPasswordPersonalData + | Models.PolicySessionAlert + | Models.PolicySessionDuration + | Models.PolicySessionInvalidation + | Models.PolicySessionLimit + | Models.PolicyUserLimit + | Models.PolicyMembershipPrivacy + | Models.PolicyMfaFactors + | Models.PolicyDenyAliasedEmail + | Models.PolicyDenyDisposableEmail + | Models.PolicyDenyFreeEmail + | Models.PolicyDenyCorporateEmail + > { let params: { policyId: ProjectPolicyId }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + 'policyId' in paramsOrFirst + ) { params = (paramsOrFirst || {}) as { policyId: ProjectPolicyId }; } else { params = { - policyId: paramsOrFirst as ProjectPolicyId + policyId: paramsOrFirst as ProjectPolicyId, }; } - - const policyId = params.policyId; + const policyId = params.policyId; if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); + throw new AppwriteException( + 'Missing required parameter: "policyId"', + ); } - - const apiPath = '/project/policies/{policyId}'.replace('{policyId}', encodeURIComponent(String(policyId))); - const payload: Payload = {}; + const apiPath = '/project/policies/{policyId}'.replace( + '{policyId}', + encodeURIComponent(String(policyId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** - * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. + * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. * * @param {ProjectProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket * @param {boolean} params.enabled - Protocol status. * @throws {AppwriteException} * @returns {Promise} */ - updateProtocol(params: { protocolId: ProjectProtocolId, enabled: boolean }): Promise; + updateProtocol(params: { + protocolId: ProjectProtocolId; + enabled: boolean; + }): Promise; /** - * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. + * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. * * @param {ProjectProtocolId} protocolId - Protocol name. Can be one of: rest, graphql, websocket * @param {boolean} enabled - Protocol status. @@ -6187,64 +7771,80 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateProtocol(protocolId: ProjectProtocolId, enabled: boolean): Promise; updateProtocol( - paramsOrFirst: { protocolId: ProjectProtocolId, enabled: boolean } | ProjectProtocolId, - ...rest: [(boolean)?] + protocolId: ProjectProtocolId, + enabled: boolean, + ): Promise; + updateProtocol( + paramsOrFirst: + | { protocolId: ProjectProtocolId; enabled: boolean } + | ProjectProtocolId, + ...rest: [boolean?] ): Promise { - let params: { protocolId: ProjectProtocolId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { protocolId: ProjectProtocolId, enabled: boolean }; + let params: { protocolId: ProjectProtocolId; enabled: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + protocolId: ProjectProtocolId; + enabled: boolean; + }; } else { params = { protocolId: paramsOrFirst as ProjectProtocolId, - enabled: rest[0] as boolean + enabled: rest[0] as boolean, }; } - + const protocolId = params.protocolId; const enabled = params.enabled; - if (typeof protocolId === 'undefined') { - throw new AppwriteException('Missing required parameter: "protocolId"'); + throw new AppwriteException( + 'Missing required parameter: "protocolId"', + ); } if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - - const apiPath = '/project/protocols/{protocolId}'.replace('{protocolId}', encodeURIComponent(String(protocolId))); - const payload: Payload = {}; + const apiPath = '/project/protocols/{protocolId}'.replace( + '{protocolId}', + encodeURIComponent(String(protocolId)), + ); + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** - * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. + * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. * * @param {ProjectServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 * @param {boolean} params.enabled - Service status. * @throws {AppwriteException} * @returns {Promise} */ - updateService(params: { serviceId: ProjectServiceId, enabled: boolean }): Promise; + updateService(params: { + serviceId: ProjectServiceId; + enabled: boolean; + }): Promise; /** - * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. + * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. * * @param {ProjectServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 * @param {boolean} enabled - Service status. @@ -6252,51 +7852,64 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateService(serviceId: ProjectServiceId, enabled: boolean): Promise; updateService( - paramsOrFirst: { serviceId: ProjectServiceId, enabled: boolean } | ProjectServiceId, - ...rest: [(boolean)?] + serviceId: ProjectServiceId, + enabled: boolean, + ): Promise; + updateService( + paramsOrFirst: + | { serviceId: ProjectServiceId; enabled: boolean } + | ProjectServiceId, + ...rest: [boolean?] ): Promise { - let params: { serviceId: ProjectServiceId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { serviceId: ProjectServiceId, enabled: boolean }; + let params: { serviceId: ProjectServiceId; enabled: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + serviceId: ProjectServiceId; + enabled: boolean; + }; } else { params = { serviceId: paramsOrFirst as ProjectServiceId, - enabled: rest[0] as boolean + enabled: rest[0] as boolean, }; } - + const serviceId = params.serviceId; const enabled = params.enabled; - if (typeof serviceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "serviceId"'); + throw new AppwriteException( + 'Missing required parameter: "serviceId"', + ); } if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); + throw new AppwriteException( + 'Missing required parameter: "enabled"', + ); } - - const apiPath = '/project/services/{serviceId}'.replace('{serviceId}', encodeURIComponent(String(serviceId))); - const payload: Payload = {}; + const apiPath = '/project/services/{serviceId}'.replace( + '{serviceId}', + encodeURIComponent(String(serviceId)), + ); + const apiPayload: Payload = {}; if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6315,7 +7928,18 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateSMTP(params?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }): Promise; + updateSMTP(params?: { + host?: string; + port?: number; + username?: string; + password?: string; + senderEmail?: string; + senderName?: string; + replyToEmail?: string; + replyToName?: string; + secure?: ProjectSMTPSecure; + enabled?: boolean; + }): Promise; /** * Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. * @@ -6333,15 +7957,76 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSMTP(host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean): Promise; updateSMTP( - paramsOrFirst?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean } | string, - ...rest: [(number)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (ProjectSMTPSecure)?, (boolean)?] + host?: string, + port?: number, + username?: string, + password?: string, + senderEmail?: string, + senderName?: string, + replyToEmail?: string, + replyToName?: string, + secure?: ProjectSMTPSecure, + enabled?: boolean, + ): Promise; + updateSMTP( + paramsOrFirst?: + | { + host?: string; + port?: number; + username?: string; + password?: string; + senderEmail?: string; + senderName?: string; + replyToEmail?: string; + replyToName?: string; + secure?: ProjectSMTPSecure; + enabled?: boolean; + } + | string, + ...rest: [ + number?, + string?, + string?, + string?, + string?, + string?, + string?, + ProjectSMTPSecure?, + boolean?, + ] ): Promise { - let params: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; + let params: { + host?: string; + port?: number; + username?: string; + password?: string; + senderEmail?: string; + senderName?: string; + replyToEmail?: string; + replyToName?: string; + secure?: ProjectSMTPSecure; + enabled?: boolean; + }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + host?: string; + port?: number; + username?: string; + password?: string; + senderEmail?: string; + senderName?: string; + replyToEmail?: string; + replyToName?: string; + secure?: ProjectSMTPSecure; + enabled?: boolean; + }; } else { params = { host: paramsOrFirst as string, @@ -6353,10 +8038,10 @@ export class Project { replyToEmail: rest[5] as string, replyToName: rest[6] as string, secure: rest[7] as ProjectSMTPSecure, - enabled: rest[8] as boolean + enabled: rest[8] as boolean, }; } - + const host = params.host; const port = params.port; const username = params.username; @@ -6367,58 +8052,51 @@ export class Project { const replyToName = params.replyToName; const secure = params.secure; const enabled = params.enabled; - - const apiPath = '/project/smtp'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof host !== 'undefined') { - payload['host'] = host; + apiPayload['host'] = host; } if (typeof port !== 'undefined') { - payload['port'] = port; + apiPayload['port'] = port; } if (typeof username !== 'undefined') { - payload['username'] = username; + apiPayload['username'] = username; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof senderEmail !== 'undefined') { - payload['senderEmail'] = senderEmail; + apiPayload['senderEmail'] = senderEmail; } if (typeof senderName !== 'undefined') { - payload['senderName'] = senderName; + apiPayload['senderName'] = senderName; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } if (typeof secure !== 'undefined') { - payload['secure'] = secure; + apiPayload['secure'] = secure; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** - * Send a test email to verify SMTP configuration. + * 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} @@ -6426,7 +8104,7 @@ export class Project { */ createSMTPTest(params: { emails: string[] }): Promise<{}>; /** - * Send a test email to verify SMTP configuration. + * 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} @@ -6435,42 +8113,39 @@ export class Project { */ createSMTPTest(emails: string[]): Promise<{}>; createSMTPTest( - paramsOrFirst: { emails: string[] } | string[] + paramsOrFirst: { emails: string[] } | string[], ): Promise<{}> { let params: { emails: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { emails: string[] }; } else { params = { - emails: paramsOrFirst as string[] + emails: paramsOrFirst as string[], }; } - - const emails = params.emails; + const emails = params.emails; if (typeof emails === 'undefined') { throw new AppwriteException('Missing required parameter: "emails"'); } - const apiPath = '/project/smtp/tests'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof emails !== 'undefined') { - payload['emails'] = emails; + apiPayload['emails'] = emails; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -6481,7 +8156,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - listEmailTemplates(params?: { queries?: string[], total?: boolean }): Promise; + listEmailTemplates(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. * @@ -6491,47 +8169,51 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listEmailTemplates(queries?: string[], total?: boolean): Promise; listEmailTemplates( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listEmailTemplates( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/project/templates/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -6548,7 +8230,16 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - updateEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }): Promise; + updateEmailTemplate(params: { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + subject?: string; + message?: string; + senderName?: string; + senderEmail?: string; + replyToEmail?: string; + replyToName?: string; + }): Promise; /** * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. * @@ -6564,15 +8255,73 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string): Promise; updateEmailTemplate( - paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string } | ProjectEmailTemplateId, - ...rest: [(ProjectEmailTemplateLocale)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + templateId: ProjectEmailTemplateId, + locale?: ProjectEmailTemplateLocale, + subject?: string, + message?: string, + senderName?: string, + senderEmail?: string, + replyToEmail?: string, + replyToName?: string, + ): Promise; + updateEmailTemplate( + paramsOrFirst: + | { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + subject?: string; + message?: string; + senderName?: string; + senderEmail?: string; + replyToEmail?: string; + replyToName?: string; + } + | ProjectEmailTemplateId, + ...rest: [ + ProjectEmailTemplateLocale?, + string?, + string?, + string?, + string?, + string?, + string?, + ] ): Promise { - let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst || 'subject' in paramsOrFirst || 'message' in paramsOrFirst || 'senderName' in paramsOrFirst || 'senderEmail' in paramsOrFirst || 'replyToEmail' in paramsOrFirst || 'replyToName' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; + let params: { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + subject?: string; + message?: string; + senderName?: string; + senderEmail?: string; + replyToEmail?: string; + replyToName?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('templateId' in paramsOrFirst || + 'locale' in paramsOrFirst || + 'subject' in paramsOrFirst || + 'message' in paramsOrFirst || + 'senderName' in paramsOrFirst || + 'senderEmail' in paramsOrFirst || + 'replyToEmail' in paramsOrFirst || + 'replyToName' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + subject?: string; + message?: string; + senderName?: string; + senderEmail?: string; + replyToEmail?: string; + replyToName?: string; + }; } else { params = { templateId: paramsOrFirst as ProjectEmailTemplateId, @@ -6582,10 +8331,10 @@ export class Project { senderName: rest[3] as string, senderEmail: rest[4] as string, replyToEmail: rest[5] as string, - replyToName: rest[6] as string + replyToName: rest[6] as string, }; } - + const templateId = params.templateId; const locale = params.locale; const subject = params.subject; @@ -6594,51 +8343,46 @@ export class Project { const senderEmail = params.senderEmail; const replyToEmail = params.replyToEmail; const replyToName = params.replyToName; - if (typeof templateId === 'undefined') { - throw new AppwriteException('Missing required parameter: "templateId"'); + throw new AppwriteException( + 'Missing required parameter: "templateId"', + ); } - const apiPath = '/project/templates/email'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; + apiPayload['templateId'] = templateId; } if (typeof locale !== 'undefined') { - payload['locale'] = locale; + apiPayload['locale'] = locale; } if (typeof subject !== 'undefined') { - payload['subject'] = subject; + apiPayload['subject'] = subject; } if (typeof message !== 'undefined') { - payload['message'] = message; + apiPayload['message'] = message; } if (typeof senderName !== 'undefined') { - payload['senderName'] = senderName; + apiPayload['senderName'] = senderName; } if (typeof senderEmail !== 'undefined') { - payload['senderEmail'] = senderEmail; + apiPayload['senderEmail'] = senderEmail; } if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; + apiPayload['replyToEmail'] = replyToEmail; } if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; + apiPayload['replyToName'] = replyToName; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6649,7 +8393,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - getEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }): Promise; + getEmailTemplate(params: { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + }): Promise; /** * Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. * @@ -6659,47 +8406,64 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale): Promise; getEmailTemplate( - paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale } | ProjectEmailTemplateId, - ...rest: [(ProjectEmailTemplateLocale)?] + templateId: ProjectEmailTemplateId, + locale?: ProjectEmailTemplateLocale, + ): Promise; + getEmailTemplate( + paramsOrFirst: + | { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + } + | ProjectEmailTemplateId, + ...rest: [ProjectEmailTemplateLocale?] ): Promise { - let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; + let params: { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + templateId: ProjectEmailTemplateId; + locale?: ProjectEmailTemplateLocale; + }; } else { params = { templateId: paramsOrFirst as ProjectEmailTemplateId, - locale: rest[0] as ProjectEmailTemplateLocale + locale: rest[0] as ProjectEmailTemplateLocale, }; } - + const templateId = params.templateId; const locale = params.locale; - if (typeof templateId === 'undefined') { - throw new AppwriteException('Missing required parameter: "templateId"'); + throw new AppwriteException( + 'Missing required parameter: "templateId"', + ); } - - const apiPath = '/project/templates/email/{templateId}'.replace('{templateId}', encodeURIComponent(String(templateId))); - const payload: Payload = {}; + const apiPath = '/project/templates/email/{templateId}'.replace( + '{templateId}', + encodeURIComponent(String(templateId)), + ); + const apiPayload: Payload = {}; if (typeof locale !== 'undefined') { - payload['locale'] = locale; + apiPayload['locale'] = locale; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -6710,7 +8474,10 @@ export class Project { * @throws {AppwriteException} * @returns {Promise} */ - listVariables(params?: { queries?: string[], total?: boolean }): Promise; + listVariables(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all project environment variables. * @@ -6720,96 +8487,132 @@ export class Project { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(queries?: string[], total?: boolean): Promise; listVariables( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listVariables( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/project/variables'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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.key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} */ - createVariable(params: { variableId: string, key: string, value: string, secret?: boolean }): Promise; + createVariable(params: { + variableId: string; + key: string; + value: string; + secret?: boolean; + }): Promise; /** * 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} key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} * @deprecated Use the object parameter style method for a better developer experience. */ - createVariable(variableId: string, key: string, value: string, secret?: boolean): Promise; createVariable( - paramsOrFirst: { variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + variableId: string, + key: string, + value: string, + secret?: boolean, + ): Promise; + createVariable( + paramsOrFirst: + | { + variableId: string; + key: string; + value: string; + secret?: boolean; + } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -6817,39 +8620,33 @@ export class Project { if (typeof value === 'undefined') { throw new AppwriteException('Missing required parameter: "value"'); } - const apiPath = '/project/variables'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; + apiPayload['variableId'] = variableId; } if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** - * Get a variable by its unique ID. + * Get a variable by its unique ID. * * @param {string} params.variableId - Variable unique ID. * @throws {AppwriteException} @@ -6857,7 +8654,7 @@ export class Project { */ getVariable(params: { variableId: string }): Promise; /** - * Get a variable by its unique ID. + * Get a variable by its unique ID. * * @param {string} variableId - Variable unique ID. * @throws {AppwriteException} @@ -6866,119 +8663,150 @@ export class Project { */ getVariable(variableId: string): Promise; getVariable( - paramsOrFirst: { variableId: string } | string + paramsOrFirst: { variableId: string } | string, ): Promise { let params: { variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { variableId: string }; } else { params = { - variableId: paramsOrFirst as string + variableId: paramsOrFirst as string, }; } - - const variableId = params.variableId; + const variableId = params.variableId; if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + const apiPath = '/project/variables/{variableId}'.replace( + '{variableId}', + encodeURIComponent(String(variableId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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.key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} */ - updateVariable(params: { variableId: string, key?: string, value?: string, secret?: boolean }): Promise; + updateVariable(params: { + variableId: string; + key?: string; + value?: string; + secret?: boolean; + }): Promise; /** * Update variable by its unique ID. * * @param {string} variableId - Variable unique ID. - * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} * @deprecated Use the object parameter style method for a better developer experience. */ - updateVariable(variableId: string, key?: string, value?: string, secret?: boolean): Promise; updateVariable( - paramsOrFirst: { variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + variableId: string, + key?: string, + value?: string, + secret?: boolean, + ): Promise; + updateVariable( + paramsOrFirst: + | { + variableId: string; + key?: string; + value?: string; + secret?: boolean; + } + | string, + ...rest: [string?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + const apiPath = '/project/variables/{variableId}'.replace( + '{variableId}', + encodeURIComponent(String(variableId)), + ); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** - * Delete a variable by its unique ID. + * Delete a variable by its unique ID. * * @param {string} params.variableId - Variable unique ID. * @throws {AppwriteException} @@ -6986,7 +8814,7 @@ export class Project { */ deleteVariable(params: { variableId: string }): Promise<{}>; /** - * Delete a variable by its unique ID. + * Delete a variable by its unique ID. * * @param {string} variableId - Variable unique ID. * @throws {AppwriteException} @@ -6995,38 +8823,40 @@ export class Project { */ deleteVariable(variableId: string): Promise<{}>; deleteVariable( - paramsOrFirst: { variableId: string } | string + paramsOrFirst: { variableId: string } | string, ): Promise<{}> { let params: { variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { variableId: string }; } else { params = { - variableId: paramsOrFirst as string + variableId: paramsOrFirst as string, }; } - - const variableId = params.variableId; + const variableId = params.variableId; if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + const apiPath = '/project/variables/{variableId}'.replace( + '{variableId}', + encodeURIComponent(String(variableId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/proxy.ts b/src/services/proxy.ts index 7858451..1f4d674 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -1,11 +1,9 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - import { InvalidationType } from '../enums/invalidation-type'; import { StatusCode } from '../enums/status-code'; import { ProxyResourceType } from '../enums/proxy-resource-type'; - export class Proxy { client: Client; @@ -15,7 +13,7 @@ export class Proxy { /** * Create a new CDN cache invalidation for a domain. Executes a hard purge of cached content. - * + * * Depending on type, the invalidation purges a single cache tag, a single URL path, or all cached content for the domain. * * @param {string} params.domain - Domain name. @@ -24,10 +22,14 @@ export class Proxy { * @throws {AppwriteException} * @returns {Promise} */ - createInvalidation(params: { domain: string, type: InvalidationType, reference?: string }): Promise; + createInvalidation(params: { + domain: string; + type: InvalidationType; + reference?: string; + }): Promise; /** * Create a new CDN cache invalidation for a domain. Executes a hard purge of cached content. - * + * * Depending on type, the invalidation purges a single cache tag, a single URL path, or all cached content for the domain. * * @param {string} domain - Domain name. @@ -37,59 +39,70 @@ export class Proxy { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createInvalidation(domain: string, type: InvalidationType, reference?: string): Promise; createInvalidation( - paramsOrFirst: { domain: string, type: InvalidationType, reference?: string } | string, - ...rest: [(InvalidationType)?, (string)?] + domain: string, + type: InvalidationType, + reference?: string, + ): Promise; + createInvalidation( + paramsOrFirst: + | { domain: string; type: InvalidationType; reference?: string } + | string, + ...rest: [InvalidationType?, string?] ): Promise { - let params: { domain: string, type: InvalidationType, reference?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, type: InvalidationType, reference?: string }; + let params: { + domain: string; + type: InvalidationType; + reference?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + domain: string; + type: InvalidationType; + reference?: string; + }; } else { params = { domain: paramsOrFirst as string, type: rest[0] as InvalidationType, - reference: rest[1] as string + reference: rest[1] as string, }; } - + const domain = params.domain; const type = params.type; const reference = params.reference; - if (typeof domain === 'undefined') { throw new AppwriteException('Missing required parameter: "domain"'); } if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } - const apiPath = '/proxy/invalidations'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof reference !== 'undefined') { - payload['reference'] = reference; + apiPayload['reference'] = reference; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -100,7 +113,10 @@ export class Proxy { * @throws {AppwriteException} * @returns {Promise} */ - listRules(params?: { queries?: string[], total?: boolean }): Promise; + listRules(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all the proxy rules. You can use the query params to filter your results. * @@ -110,52 +126,56 @@ export class Proxy { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listRules(queries?: string[], total?: boolean): Promise; listRules( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + queries?: string[], + total?: boolean, + ): Promise; + listRules( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/proxy/rules'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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. @@ -165,7 +185,7 @@ export class Proxy { createAPIRule(params: { domain: string }): Promise; /** * 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. @@ -175,48 +195,45 @@ export class Proxy { */ createAPIRule(domain: string): Promise; createAPIRule( - paramsOrFirst: { domain: string } | string + paramsOrFirst: { domain: string } | string, ): Promise { let params: { domain: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { domain: string }; } else { params = { - domain: paramsOrFirst as string + domain: paramsOrFirst as string, }; } - - const domain = params.domain; + const domain = params.domain; if (typeof domain === 'undefined') { throw new AppwriteException('Missing required parameter: "domain"'); } - const apiPath = '/proxy/rules/api'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -225,10 +242,14 @@ export class Proxy { * @throws {AppwriteException} * @returns {Promise} */ - createFunctionRule(params: { domain: string, functionId: string, branch?: string }): Promise; + createFunctionRule(params: { + domain: string; + functionId: string; + branch?: string; + }): Promise; /** * 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. @@ -238,64 +259,72 @@ export class Proxy { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFunctionRule(domain: string, functionId: string, branch?: string): Promise; createFunctionRule( - paramsOrFirst: { domain: string, functionId: string, branch?: string } | string, - ...rest: [(string)?, (string)?] + domain: string, + functionId: string, + branch?: string, + ): Promise; + createFunctionRule( + paramsOrFirst: + { domain: string; functionId: string; branch?: string } | string, + ...rest: [string?, string?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "functionId"', + ); } - const apiPath = '/proxy/rules/function'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } if (typeof functionId !== 'undefined') { - payload['functionId'] = functionId; + apiPayload['functionId'] = functionId; } if (typeof branch !== 'undefined') { - payload['branch'] = branch; + apiPayload['branch'] = branch; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -306,10 +335,16 @@ export class Proxy { * @throws {AppwriteException} * @returns {Promise} */ - createRedirectRule(params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }): Promise; + createRedirectRule(params: { + domain: string; + url: string; + statusCode: StatusCode; + resourceId: string; + resourceType: ProxyResourceType; + }): Promise; /** * Create a new proxy rule for to redirect from custom domain to another domain. - * + * * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. * * @param {string} domain - Domain name. @@ -321,31 +356,60 @@ export class Proxy { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRedirectRule(domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType): Promise; createRedirectRule( - paramsOrFirst: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType } | string, - ...rest: [(string)?, (StatusCode)?, (string)?, (ProxyResourceType)?] + domain: string, + url: string, + statusCode: StatusCode, + resourceId: string, + resourceType: ProxyResourceType, + ): Promise; + createRedirectRule( + paramsOrFirst: + | { + domain: string; + url: string; + statusCode: StatusCode; + resourceId: string; + resourceType: ProxyResourceType; + } + | string, + ...rest: [string?, StatusCode?, string?, ProxyResourceType?] ): Promise { - let params: { domain: string, url: string, statusCode: 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 }; + 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 + 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"'); } @@ -353,51 +417,51 @@ export class Proxy { throw new AppwriteException('Missing required parameter: "url"'); } if (typeof statusCode === 'undefined') { - throw new AppwriteException('Missing required parameter: "statusCode"'); + throw new AppwriteException( + 'Missing required parameter: "statusCode"', + ); } if (typeof resourceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "resourceId"'); + throw new AppwriteException( + 'Missing required parameter: "resourceId"', + ); } if (typeof resourceType === 'undefined') { - throw new AppwriteException('Missing required parameter: "resourceType"'); + throw new AppwriteException( + 'Missing required parameter: "resourceType"', + ); } - const apiPath = '/proxy/rules/redirect'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof statusCode !== 'undefined') { - payload['statusCode'] = statusCode; + apiPayload['statusCode'] = statusCode; } if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; + apiPayload['resourceId'] = resourceId; } if (typeof resourceType !== 'undefined') { - payload['resourceType'] = resourceType; + apiPayload['resourceType'] = resourceType; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -406,10 +470,14 @@ export class Proxy { * @throws {AppwriteException} * @returns {Promise} */ - createSiteRule(params: { domain: string, siteId: string, branch?: string }): Promise; + createSiteRule(params: { + domain: string; + siteId: string; + branch?: string; + }): Promise; /** * 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. @@ -419,59 +487,65 @@ export class Proxy { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createSiteRule(domain: string, siteId: string, branch?: string): Promise; createSiteRule( - paramsOrFirst: { domain: string, siteId: string, branch?: string } | string, - ...rest: [(string)?, (string)?] + domain: string, + siteId: string, + branch?: string, + ): Promise; + createSiteRule( + paramsOrFirst: + { domain: string; siteId: string; branch?: string } | string, + ...rest: [string?, string?] ): Promise { - 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 }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof domain !== 'undefined') { - payload['domain'] = domain; + apiPayload['domain'] = domain; } if (typeof siteId !== 'undefined') { - payload['siteId'] = siteId; + apiPayload['siteId'] = siteId; } if (typeof branch !== 'undefined') { - payload['branch'] = branch; + apiPayload['branch'] = branch; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -492,39 +566,39 @@ export class Proxy { */ getRule(ruleId: string): Promise; getRule( - paramsOrFirst: { ruleId: string } | string + paramsOrFirst: { ruleId: string } | string, ): Promise { let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { ruleId: string }; } else { params = { - ruleId: paramsOrFirst as string + ruleId: paramsOrFirst as string, }; } - - const ruleId = params.ruleId; + const ruleId = params.ruleId; if (typeof ruleId === 'undefined') { throw new AppwriteException('Missing required parameter: "ruleId"'); } - - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId))); - const payload: Payload = {}; + const apiPath = '/proxy/rules/{ruleId}'.replace( + '{ruleId}', + encodeURIComponent(String(ruleId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -544,40 +618,38 @@ export class Proxy { * @deprecated Use the object parameter style method for a better developer experience. */ deleteRule(ruleId: string): Promise<{}>; - deleteRule( - paramsOrFirst: { ruleId: string } | string - ): Promise<{}> { + deleteRule(paramsOrFirst: { ruleId: string } | string): Promise<{}> { let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { ruleId: string }; } else { params = { - ruleId: paramsOrFirst as string + ruleId: paramsOrFirst as string, }; } - - const ruleId = params.ruleId; + const ruleId = params.ruleId; if (typeof ruleId === 'undefined') { throw new AppwriteException('Missing required parameter: "ruleId"'); } - - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId))); - const payload: Payload = {}; + const apiPath = '/proxy/rules/{ruleId}'.replace( + '{ruleId}', + encodeURIComponent(String(ruleId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -598,39 +670,39 @@ export class Proxy { */ updateRuleStatus(ruleId: string): Promise; updateRuleStatus( - paramsOrFirst: { ruleId: string } | string + paramsOrFirst: { ruleId: string } | string, ): Promise { let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { ruleId: string }; } else { params = { - ruleId: paramsOrFirst as string + ruleId: paramsOrFirst as string, }; } - - const ruleId = params.ruleId; + const ruleId = params.ruleId; if (typeof ruleId === 'undefined') { throw new AppwriteException('Missing required parameter: "ruleId"'); } - - const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', encodeURIComponent(String(ruleId))); - const payload: Payload = {}; + const apiPath = '/proxy/rules/{ruleId}/status'.replace( + '{ruleId}', + encodeURIComponent(String(ruleId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } } diff --git a/src/services/sites.ts b/src/services/sites.ts index f74f2dd..d684521 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -1,15 +1,19 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { + AppwriteException, + Client, + type Payload, + UploadProgress, +} from '../client'; import type { Models } from '../models'; - import { InputFile } from '../inputFile'; import { Framework } from '../enums/framework'; import { BuildRuntime } from '../enums/build-runtime'; import { Adapter } from '../enums/adapter'; +import { ProjectKeyScopes } from '../enums/project-key-scopes'; 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; @@ -26,7 +30,11 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all the project's sites. You can use the query params to filter your results. * @@ -37,52 +45,59 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + list( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/sites'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -111,10 +126,36 @@ export class Sites { * @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. + * @param {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. * @throws {AppwriteException} * @returns {Promise} */ - create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + create(params: { + siteId: string; + name: string; + framework: Framework; + buildRuntime: BuildRuntime; + enabled?: boolean; + logging?: boolean; + timeout?: number; + installCommand?: string; + buildCommand?: string; + startCommand?: string; + outputDirectory?: string; + adapter?: Adapter; + installationId?: string; + fallbackFile?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + }): Promise; /** * Create a new site. * @@ -141,19 +182,150 @@ export class Sites { * @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. + * @param {ProjectKeyScopes[]} scopes - List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. * @throws {AppwriteException} * @returns {Promise} * @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, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; 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, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + siteId: string, + name: string, + framework: Framework, + buildRuntime: BuildRuntime, + enabled?: boolean, + logging?: boolean, + timeout?: number, + installCommand?: string, + buildCommand?: string, + startCommand?: string, + outputDirectory?: string, + adapter?: Adapter, + installationId?: string, + fallbackFile?: string, + providerRepositoryId?: string, + providerBranch?: string, + providerSilentMode?: boolean, + providerRootDirectory?: string, + providerBranches?: string[], + providerPaths?: string[], + buildSpecification?: string, + runtimeSpecification?: string, + deploymentRetention?: number, + scopes?: ProjectKeyScopes[], + ): Promise; + 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; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + } + | string, + ...rest: [ + string?, + Framework?, + BuildRuntime?, + boolean?, + boolean?, + number?, + string?, + string?, + string?, + string?, + Adapter?, + string?, + string?, + string?, + string?, + boolean?, + string?, + string[]?, + string[]?, + string?, + string?, + number?, + ProjectKeyScopes[]?, + ] ): Promise { - let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { + siteId: string; + name: string; + framework: Framework; + buildRuntime: BuildRuntime; + enabled?: boolean; + logging?: boolean; + timeout?: number; + installCommand?: string; + buildCommand?: string; + startCommand?: string; + outputDirectory?: string; + adapter?: Adapter; + installationId?: string; + fallbackFile?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + }; + + 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; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + }; } else { params = { siteId: paramsOrFirst as string, @@ -178,10 +350,11 @@ export class Sites { providerPaths: rest[18] as string[], buildSpecification: rest[19] as string, runtimeSpecification: rest[20] as string, - deploymentRetention: rest[21] as number + deploymentRetention: rest[21] as number, + scopes: rest[22] as ProjectKeyScopes[], }; } - + const siteId = params.siteId; const name = params.name; const framework = params.framework; @@ -205,7 +378,7 @@ export class Sites { const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; - + const scopes = params.scopes; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); } @@ -213,97 +386,98 @@ export class Sites { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof framework === 'undefined') { - throw new AppwriteException('Missing required parameter: "framework"'); + throw new AppwriteException( + 'Missing required parameter: "framework"', + ); } if (typeof buildRuntime === 'undefined') { - throw new AppwriteException('Missing required parameter: "buildRuntime"'); + throw new AppwriteException( + 'Missing required parameter: "buildRuntime"', + ); } - const apiPath = '/sites'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof siteId !== 'undefined') { - payload['siteId'] = siteId; + apiPayload['siteId'] = siteId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof framework !== 'undefined') { - payload['framework'] = framework; + apiPayload['framework'] = framework; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof logging !== 'undefined') { - payload['logging'] = logging; + apiPayload['logging'] = logging; } if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; + apiPayload['timeout'] = timeout; } if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; + apiPayload['installCommand'] = installCommand; } if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; + apiPayload['buildCommand'] = buildCommand; } if (typeof startCommand !== 'undefined') { - payload['startCommand'] = startCommand; + apiPayload['startCommand'] = startCommand; } if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; + apiPayload['outputDirectory'] = outputDirectory; } if (typeof buildRuntime !== 'undefined') { - payload['buildRuntime'] = buildRuntime; + apiPayload['buildRuntime'] = buildRuntime; } if (typeof adapter !== 'undefined') { - payload['adapter'] = adapter; + apiPayload['adapter'] = adapter; } if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; + apiPayload['installationId'] = installationId; } if (typeof fallbackFile !== 'undefined') { - payload['fallbackFile'] = fallbackFile; + apiPayload['fallbackFile'] = fallbackFile; } if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; + apiPayload['providerRepositoryId'] = providerRepositoryId; } if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; + apiPayload['providerBranch'] = providerBranch; } if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; + apiPayload['providerSilentMode'] = providerSilentMode; } if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; + apiPayload['providerRootDirectory'] = providerRootDirectory; } if (typeof providerBranches !== 'undefined') { - payload['providerBranches'] = providerBranches; + apiPayload['providerBranches'] = providerBranches; } if (typeof providerPaths !== 'undefined') { - payload['providerPaths'] = providerPaths; + apiPayload['providerPaths'] = providerPaths; } if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; + apiPayload['buildSpecification'] = buildSpecification; } if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; + apiPayload['runtimeSpecification'] = runtimeSpecification; } if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; + apiPayload['deploymentRetention'] = deploymentRetention; + } + if (typeof scopes !== 'undefined') { + apiPayload['scopes'] = scopes; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -313,22 +487,16 @@ export class Sites { * @returns {Promise} */ listFrameworks(): Promise { - const apiPath = '/sites/frameworks'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -338,7 +506,9 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - listSpecifications(params?: { type?: string }): Promise; + listSpecifications(params?: { + type?: string; + }): Promise; /** * List allowed site specifications for this instance. * @@ -349,39 +519,37 @@ export class Sites { */ listSpecifications(type?: string): Promise; listSpecifications( - paramsOrFirst?: { type?: string } | string + paramsOrFirst?: { type?: string } | string, ): Promise { let params: { type?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { type?: string }; } else { params = { - type: paramsOrFirst as string + type: paramsOrFirst as string, }; } - - const type = params.type; - + const type = params.type; const apiPath = '/sites/specifications'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -401,40 +569,38 @@ export class Sites { * @deprecated Use the object parameter style method for a better developer experience. */ get(siteId: string): Promise; - get( - paramsOrFirst: { siteId: string } | string - ): Promise { + get(paramsOrFirst: { siteId: string } | string): Promise { let params: { siteId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { siteId: string }; } else { params = { - siteId: paramsOrFirst as string + siteId: paramsOrFirst as string, }; } - - const siteId = params.siteId; + const siteId = params.siteId; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -463,10 +629,36 @@ export class Sites { * @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. + * @param {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. * @throws {AppwriteException} * @returns {Promise} */ - update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise; + update(params: { + siteId: string; + name: string; + framework: Framework; + enabled?: boolean; + logging?: boolean; + timeout?: number; + installCommand?: string; + buildCommand?: string; + startCommand?: string; + outputDirectory?: string; + buildRuntime?: BuildRuntime; + adapter?: Adapter; + fallbackFile?: string; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + }): Promise; /** * Update site by its unique ID. * @@ -493,19 +685,150 @@ export class Sites { * @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. + * @param {ProjectKeyScopes[]} scopes - List of scopes allowed for API key auto-generated for every site build and SSR execution. Maximum of 200 scopes are allowed. * @throws {AppwriteException} * @returns {Promise} * @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, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise; 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, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] + siteId: string, + name: string, + framework: Framework, + enabled?: boolean, + logging?: boolean, + timeout?: number, + installCommand?: string, + buildCommand?: string, + startCommand?: string, + outputDirectory?: string, + buildRuntime?: BuildRuntime, + adapter?: Adapter, + fallbackFile?: string, + installationId?: string, + providerRepositoryId?: string, + providerBranch?: string, + providerSilentMode?: boolean, + providerRootDirectory?: string, + providerBranches?: string[], + providerPaths?: string[], + buildSpecification?: string, + runtimeSpecification?: string, + deploymentRetention?: number, + scopes?: ProjectKeyScopes[], + ): Promise; + 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; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + } + | string, + ...rest: [ + string?, + Framework?, + boolean?, + boolean?, + number?, + string?, + string?, + string?, + string?, + BuildRuntime?, + Adapter?, + string?, + string?, + string?, + string?, + boolean?, + string?, + string[]?, + string[]?, + string?, + string?, + number?, + ProjectKeyScopes[]?, + ] ): Promise { - let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { + siteId: string; + name: string; + framework: Framework; + enabled?: boolean; + logging?: boolean; + timeout?: number; + installCommand?: string; + buildCommand?: string; + startCommand?: string; + outputDirectory?: string; + buildRuntime?: BuildRuntime; + adapter?: Adapter; + fallbackFile?: string; + installationId?: string; + providerRepositoryId?: string; + providerBranch?: string; + providerSilentMode?: boolean; + providerRootDirectory?: string; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + }; + + 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; + providerBranches?: string[]; + providerPaths?: string[]; + buildSpecification?: string; + runtimeSpecification?: string; + deploymentRetention?: number; + scopes?: ProjectKeyScopes[]; + }; } else { params = { siteId: paramsOrFirst as string, @@ -530,10 +853,11 @@ export class Sites { providerPaths: rest[18] as string[], buildSpecification: rest[19] as string, runtimeSpecification: rest[20] as string, - deploymentRetention: rest[21] as number + deploymentRetention: rest[21] as number, + scopes: rest[22] as ProjectKeyScopes[], }; } - + const siteId = params.siteId; const name = params.name; const framework = params.framework; @@ -557,7 +881,7 @@ export class Sites { const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; - + const scopes = params.scopes; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); } @@ -565,91 +889,93 @@ export class Sites { throw new AppwriteException('Missing required parameter: "name"'); } if (typeof framework === 'undefined') { - throw new AppwriteException('Missing required parameter: "framework"'); + throw new AppwriteException( + 'Missing required parameter: "framework"', + ); } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof framework !== 'undefined') { - payload['framework'] = framework; + apiPayload['framework'] = framework; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof logging !== 'undefined') { - payload['logging'] = logging; + apiPayload['logging'] = logging; } if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; + apiPayload['timeout'] = timeout; } if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; + apiPayload['installCommand'] = installCommand; } if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; + apiPayload['buildCommand'] = buildCommand; } if (typeof startCommand !== 'undefined') { - payload['startCommand'] = startCommand; + apiPayload['startCommand'] = startCommand; } if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; + apiPayload['outputDirectory'] = outputDirectory; } if (typeof buildRuntime !== 'undefined') { - payload['buildRuntime'] = buildRuntime; + apiPayload['buildRuntime'] = buildRuntime; } if (typeof adapter !== 'undefined') { - payload['adapter'] = adapter; + apiPayload['adapter'] = adapter; } if (typeof fallbackFile !== 'undefined') { - payload['fallbackFile'] = fallbackFile; + apiPayload['fallbackFile'] = fallbackFile; } if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; + apiPayload['installationId'] = installationId; } if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; + apiPayload['providerRepositoryId'] = providerRepositoryId; } if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; + apiPayload['providerBranch'] = providerBranch; } if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; + apiPayload['providerSilentMode'] = providerSilentMode; } if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; + apiPayload['providerRootDirectory'] = providerRootDirectory; } if (typeof providerBranches !== 'undefined') { - payload['providerBranches'] = providerBranches; + apiPayload['providerBranches'] = providerBranches; } if (typeof providerPaths !== 'undefined') { - payload['providerPaths'] = providerPaths; + apiPayload['providerPaths'] = providerPaths; } if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; + apiPayload['buildSpecification'] = buildSpecification; } if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; + apiPayload['runtimeSpecification'] = runtimeSpecification; } if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; + apiPayload['deploymentRetention'] = deploymentRetention; + } + if (typeof scopes !== 'undefined') { + apiPayload['scopes'] = scopes; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -669,40 +995,38 @@ export class Sites { * @deprecated Use the object parameter style method for a better developer experience. */ delete(siteId: string): Promise<{}>; - delete( - paramsOrFirst: { siteId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { siteId: string } | string): Promise<{}> { let params: { siteId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { siteId: string }; } else { params = { - siteId: paramsOrFirst as string + siteId: paramsOrFirst as string, }; } - - const siteId = params.siteId; + const siteId = params.siteId; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -713,7 +1037,10 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - updateSiteDeployment(params: { siteId: string, deploymentId: string }): Promise; + updateSiteDeployment(params: { + siteId: string; + deploymentId: string; + }): Promise; /** * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. * @@ -723,51 +1050,59 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSiteDeployment(siteId: string, deploymentId: string): Promise; updateSiteDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] + siteId: string, + deploymentId: string, + ): Promise; + updateSiteDeployment( + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); } - - const apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/deployment'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; + apiPayload['deploymentId'] = deploymentId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -780,7 +1115,12 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listDeployments(params: { + siteId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all the site's code deployments. You can use the query params to filter your results. * @@ -792,57 +1132,79 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): Promise; listDeployments( - paramsOrFirst: { siteId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + siteId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listDeployments( + paramsOrFirst: + | { + siteId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/deployments'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -857,7 +1219,15 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(params: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise; + createDeployment(params: { + siteId: string; + code: File | InputFile; + installCommand?: string; + buildCommand?: string; + outputDirectory?: string; + activate?: boolean; + onProgress?: (progress: UploadProgress) => void; + }): Promise; /** * 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. * @@ -871,17 +1241,62 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDeployment(siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise; createDeployment( - paramsOrFirst: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File | InputFile)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] + siteId: string, + code: File | InputFile, + installCommand?: string, + buildCommand?: string, + outputDirectory?: string, + activate?: boolean, + onProgress?: (progress: UploadProgress) => void, + ): Promise; + createDeployment( + paramsOrFirst: + | { + siteId: string; + code: File | InputFile; + installCommand?: string; + buildCommand?: string; + outputDirectory?: string; + activate?: boolean; + onProgress?: (progress: UploadProgress) => void; + } + | string, + ...rest: [ + (File | InputFile)?, + string?, + string?, + string?, + boolean?, + ((progress: UploadProgress) => void)?, + ] ): Promise { - let params: { siteId: string, code: File | InputFile, 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 | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + let params: { + siteId: string; + code: File | InputFile; + 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 | InputFile; + installCommand?: string; + buildCommand?: string; + outputDirectory?: string; + activate?: boolean; + }; + onProgress = paramsOrFirst?.onProgress as ( + progress: UploadProgress, + ) => void; } else { params = { siteId: paramsOrFirst as string, @@ -889,56 +1304,57 @@ export class Sites { installCommand: rest[1] as string, buildCommand: rest[2] as string, outputDirectory: rest[3] as string, - activate: rest[4] as boolean + activate: rest[4] as boolean, }; - onProgress = rest[5] as ((progress: UploadProgress) => void); + 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}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/deployments'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; + apiPayload['installCommand'] = installCommand; } if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; + apiPayload['buildCommand'] = buildCommand; } if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; + apiPayload['outputDirectory'] = outputDirectory; } if (typeof code !== 'undefined') { - payload['code'] = code; + apiPayload['code'] = code; } if (typeof activate !== 'undefined') { - payload['activate'] = activate; + apiPayload['activate'] = activate; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', - 'accept': 'application/json', - } + accept: 'application/json', + }; return this.client.chunkedUpload( 'post', uri, apiHeaders, - payload, - onProgress + apiPayload, + onProgress, ); } @@ -950,7 +1366,10 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createDuplicateDeployment(params: { siteId: string, deploymentId: string }): Promise; + createDuplicateDeployment(params: { + siteId: string; + deploymentId: string; + }): Promise; /** * 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. * @@ -960,56 +1379,64 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDuplicateDeployment(siteId: string, deploymentId: string): Promise; createDuplicateDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] + siteId: string, + deploymentId: string, + ): Promise; + createDuplicateDeployment( + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); } - - const apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/deployments/duplicate'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; + apiPayload['deploymentId'] = deploymentId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -1022,10 +1449,18 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createTemplateDeployment(params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise; + createTemplateDeployment(params: { + siteId: string; + repository: string; + owner: string; + rootDirectory: string; + type: TemplateReferenceType; + reference: string; + activate?: boolean; + }): Promise; /** * 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. @@ -1039,15 +1474,60 @@ export class Sites { * @returns {Promise} * @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; createTemplateDeployment( - paramsOrFirst: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] + siteId: string, + repository: string, + owner: string, + rootDirectory: string, + type: TemplateReferenceType, + reference: string, + activate?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1056,10 +1536,10 @@ export class Sites { rootDirectory: rest[2] as string, type: rest[3] as TemplateReferenceType, reference: rest[4] as string, - activate: rest[5] as boolean + activate: rest[5] as boolean, }; } - + const siteId = params.siteId; const repository = params.repository; const owner = params.owner; @@ -1067,65 +1547,67 @@ export class Sites { 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"'); + 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"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "reference"', + ); } - - const apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/deployments/template'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof repository !== 'undefined') { - payload['repository'] = repository; + apiPayload['repository'] = repository; } if (typeof owner !== 'undefined') { - payload['owner'] = owner; + apiPayload['owner'] = owner; } if (typeof rootDirectory !== 'undefined') { - payload['rootDirectory'] = rootDirectory; + apiPayload['rootDirectory'] = rootDirectory; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof reference !== 'undefined') { - payload['reference'] = reference; + apiPayload['reference'] = reference; } if (typeof activate !== 'undefined') { - payload['activate'] = activate; + apiPayload['activate'] = activate; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -1135,10 +1617,15 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - createVcsDeployment(params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise; + createVcsDeployment(params: { + siteId: string; + type: VCSReferenceType; + reference: string; + activate?: boolean; + }): Promise; /** * 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. @@ -1149,29 +1636,54 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createVcsDeployment(siteId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise; createVcsDeployment( - paramsOrFirst: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] + siteId: string, + type: VCSReferenceType, + reference: string, + activate?: boolean, + ): Promise; + createVcsDeployment( + paramsOrFirst: + | { + siteId: string; + type: VCSReferenceType; + reference: string; + activate?: boolean; + } + | string, + ...rest: [VCSReferenceType?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); } @@ -1179,34 +1691,33 @@ export class Sites { throw new AppwriteException('Missing required parameter: "type"'); } if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); + throw new AppwriteException( + 'Missing required parameter: "reference"', + ); } - - const apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/deployments/vcs'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof reference !== 'undefined') { - payload['reference'] = reference; + apiPayload['reference'] = reference; } if (typeof activate !== 'undefined') { - payload['activate'] = activate; + apiPayload['activate'] = activate; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1217,7 +1728,10 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getDeployment(params: { siteId: string, deploymentId: string }): Promise; + getDeployment(params: { + siteId: string; + deploymentId: string; + }): Promise; /** * Get a site deployment by its unique ID. * @@ -1227,47 +1741,57 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeployment(siteId: string, deploymentId: string): Promise; getDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] + siteId: string, + deploymentId: string, + ): Promise; + getDeployment( + 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1278,7 +1802,10 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteDeployment(params: { siteId: string, deploymentId: string }): Promise<{}>; + deleteDeployment(params: { + siteId: string; + deploymentId: string; + }): Promise<{}>; /** * Delete a site deployment by its unique ID. * @@ -1290,45 +1817,52 @@ export class Sites { */ deleteDeployment(siteId: string, deploymentId: string): Promise<{}>; deleteDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1341,7 +1875,12 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }): Promise; + getDeploymentDownload(params: { + siteId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + }): Promise; /** * 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. * @@ -1353,57 +1892,88 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string): Promise; getDeploymentDownload( - paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string } | string, - ...rest: [(string)?, (DeploymentDownloadType)?, (string)?] + siteId: string, + deploymentId: string, + type?: DeploymentDownloadType, + token?: string, + ): Promise; + getDeploymentDownload( + paramsOrFirst: + | { + siteId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + } + | string, + ...rest: [string?, DeploymentDownloadType?, string?] ): Promise { - let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string, type?: DeploymentDownloadType, token?: string }; + let params: { + siteId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + siteId: string; + deploymentId: string; + type?: DeploymentDownloadType; + token?: string; + }; } else { params = { siteId: paramsOrFirst as string, deploymentId: rest[0] as string, type: rest[1] as DeploymentDownloadType, - token: rest[2] as string + token: rest[2] as string, }; } - + const siteId = params.siteId; const deploymentId = params.deploymentId; const type = params.type; const token = params.token; - 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}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/download' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof token !== 'undefined') { - payload['token'] = token; + apiPayload['token'] = token; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': '*/*', - } + accept: '*/*', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } @@ -1415,7 +1985,10 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - updateDeploymentStatus(params: { siteId: string, deploymentId: string }): Promise; + updateDeploymentStatus(params: { + siteId: string; + deploymentId: string; + }): Promise; /** * 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. * @@ -1425,48 +1998,58 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateDeploymentStatus(siteId: string, deploymentId: string): Promise; updateDeploymentStatus( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] + siteId: string, + deploymentId: string, + ): Promise; + updateDeploymentStatus( + 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{deploymentId}', encodeURIComponent(String(deploymentId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "deploymentId"', + ); + } + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/status' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace( + '{deploymentId}', + encodeURIComponent(String(deploymentId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1478,7 +2061,11 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise; + listLogs(params: { + siteId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all site logs. You can use the query params to filter your results. * @@ -1489,52 +2076,61 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listLogs(siteId: string, queries?: string[], total?: boolean): Promise; listLogs( - paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + siteId: string, + queries?: string[], + total?: boolean, + ): Promise; + listLogs( + paramsOrFirst: + { siteId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/logs'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1545,7 +2141,10 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getLog(params: { siteId: string, logId: string }): Promise; + getLog(params: { + siteId: string; + logId: string; + }): Promise; /** * Get a site request log by its unique ID. * @@ -1557,45 +2156,44 @@ export class Sites { */ getLog(siteId: string, logId: string): Promise; getLog( - paramsOrFirst: { siteId: string, logId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{logId}', encodeURIComponent(String(logId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/logs/{logId}' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace('{logId}', encodeURIComponent(String(logId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1606,7 +2204,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteLog(params: { siteId: string, logId: string }): Promise<{}>; + deleteLog(params: { siteId: string; logId: string }): Promise<{}>; /** * Delete a site log by its unique ID. * @@ -1618,46 +2216,45 @@ export class Sites { */ deleteLog(siteId: string, logId: string): Promise<{}>; deleteLog( - paramsOrFirst: { siteId: string, logId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{logId}', encodeURIComponent(String(logId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/logs/{logId}' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace('{logId}', encodeURIComponent(String(logId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1669,7 +2266,11 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - listVariables(params: { siteId: string, queries?: string[], total?: boolean }): Promise; + listVariables(params: { + siteId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all variables of a specific site. * @@ -1680,52 +2281,61 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(siteId: string, queries?: string[], total?: boolean): Promise; listVariables( - paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + siteId: string, + queries?: string[], + total?: boolean, + ): Promise; + listVariables( + paramsOrFirst: + { siteId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/variables'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1733,55 +2343,92 @@ export class Sites { * * @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.key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} */ - createVariable(params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise; + createVariable(params: { + siteId: string; + variableId: string; + key: string; + value: string; + secret?: boolean; + }): Promise; /** * 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} key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} * @deprecated Use the object parameter style method for a better developer experience. */ - createVariable(siteId: string, variableId: string, key: string, value: string, secret?: boolean): Promise; createVariable( - paramsOrFirst: { siteId: string, variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] + siteId: string, + variableId: string, + key: string, + value: string, + secret?: boolean, + ): Promise; + createVariable( + paramsOrFirst: + | { + siteId: string; + variableId: string; + key: string; + value: string; + secret?: boolean; + } + | string, + ...rest: [string?, string?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -1789,35 +2436,32 @@ export class Sites { if (typeof value === 'undefined') { throw new AppwriteException('Missing required parameter: "value"'); } - - const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', encodeURIComponent(String(siteId))); - const payload: Payload = {}; + const apiPath = '/sites/{siteId}/variables'.replace( + '{siteId}', + encodeURIComponent(String(siteId)), + ); + const apiPayload: Payload = {}; if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; + apiPayload['variableId'] = variableId; } if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1828,7 +2472,10 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise} */ - getVariable(params: { siteId: string, variableId: string }): Promise; + getVariable(params: { + siteId: string; + variableId: string; + }): Promise; /** * Get a variable by its unique ID. * @@ -1840,45 +2487,49 @@ export class Sites { */ getVariable(siteId: string, variableId: string): Promise; getVariable( - paramsOrFirst: { siteId: string, variableId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); + } + const apiPath = '/sites/{siteId}/variables/{variableId}' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace('{variableId}', encodeURIComponent(String(variableId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1886,82 +2537,115 @@ export class Sites { * * @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.key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} */ - updateVariable(params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise; + updateVariable(params: { + siteId: string; + variableId: string; + key?: string; + value?: string; + secret?: boolean; + }): Promise; /** * 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} key - Variable key. Letters, digits and underscores only, must not start with a digit. 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} * @deprecated Use the object parameter style method for a better developer experience. */ - updateVariable(siteId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise; updateVariable( - paramsOrFirst: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] + siteId: string, + variableId: string, + key?: string, + value?: string, + secret?: boolean, + ): Promise; + updateVariable( + paramsOrFirst: + | { + siteId: string; + variableId: string; + key?: string; + value?: string; + secret?: boolean; + } + | string, + ...rest: [string?, string?, string?, boolean?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); + } + const apiPath = '/sites/{siteId}/variables/{variableId}' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace('{variableId}', encodeURIComponent(String(variableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1972,7 +2656,7 @@ export class Sites { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteVariable(params: { siteId: string, variableId: string }): Promise<{}>; + deleteVariable(params: { siteId: string; variableId: string }): Promise<{}>; /** * Delete a variable by its unique ID. * @@ -1984,44 +2668,48 @@ export class Sites { */ deleteVariable(siteId: string, variableId: string): Promise<{}>; deleteVariable( - paramsOrFirst: { siteId: string, variableId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(siteId))).replace('{variableId}', encodeURIComponent(String(variableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "variableId"', + ); + } + const apiPath = '/sites/{siteId}/variables/{variableId}' + .replace('{siteId}', encodeURIComponent(String(siteId))) + .replace('{variableId}', encodeURIComponent(String(variableId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/storage.ts b/src/services/storage.ts index 8424bfa..6d1d65f 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -1,12 +1,15 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { + AppwriteException, + Client, + type Payload, + UploadProgress, +} from '../client'; import type { Models } from '../models'; - import { InputFile } from '../inputFile'; import { Compression } from '../enums/compression'; import { ImageGravity } from '../enums/image-gravity'; import { ImageFormat } from '../enums/image-format'; - export class Storage { client: Client; @@ -23,7 +26,11 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listBuckets(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all the storage buckets. You can use the query params to filter your results. * @@ -34,52 +41,59 @@ export class Storage { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listBuckets(queries?: string[], search?: string, total?: boolean): Promise; listBuckets( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listBuckets( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/storage/buckets'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -99,7 +113,19 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * Create a new storage bucket. * @@ -118,15 +144,80 @@ export class Storage { * @returns {Promise} * @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; 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)?] + bucketId: string, + name: string, + permissions?: string[], + fileSecurity?: boolean, + enabled?: boolean, + maximumFileSize?: number, + allowedFileExtensions?: string[], + compression?: Compression, + encryption?: boolean, + antivirus?: boolean, + transformations?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -139,10 +230,10 @@ export class Storage { compression: rest[6] as Compression, encryption: rest[7] as boolean, antivirus: rest[8] as boolean, - transformations: rest[9] as boolean + transformations: rest[9] as boolean, }; } - + const bucketId = params.bucketId; const name = params.name; const permissions = params.permissions; @@ -154,63 +245,58 @@ export class Storage { const encryption = params.encryption; const antivirus = params.antivirus; const transformations = params.transformations; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + 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 = {}; + const apiPayload: Payload = {}; if (typeof bucketId !== 'undefined') { - payload['bucketId'] = bucketId; + apiPayload['bucketId'] = bucketId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof fileSecurity !== 'undefined') { - payload['fileSecurity'] = fileSecurity; + apiPayload['fileSecurity'] = fileSecurity; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; + apiPayload['maximumFileSize'] = maximumFileSize; } if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; + apiPayload['allowedFileExtensions'] = allowedFileExtensions; } if (typeof compression !== 'undefined') { - payload['compression'] = compression; + apiPayload['compression'] = compression; } if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; + apiPayload['encryption'] = encryption; } if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; + apiPayload['antivirus'] = antivirus; } if (typeof transformations !== 'undefined') { - payload['transformations'] = transformations; + apiPayload['transformations'] = transformations; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -231,39 +317,41 @@ export class Storage { */ getBucket(bucketId: string): Promise; getBucket( - paramsOrFirst: { bucketId: string } | string + paramsOrFirst: { bucketId: string } | string, ): Promise { let params: { bucketId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { bucketId: string }; } else { params = { - bucketId: paramsOrFirst as string + bucketId: paramsOrFirst as string, }; } - - const bucketId = params.bucketId; + const bucketId = params.bucketId; if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}'.replace( + '{bucketId}', + encodeURIComponent(String(bucketId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -283,7 +371,19 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - 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; + 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; /** * Update a storage bucket by its unique ID. * @@ -302,15 +402,80 @@ export class Storage { * @returns {Promise} * @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; 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)?] + bucketId: string, + name: string, + permissions?: string[], + fileSecurity?: boolean, + enabled?: boolean, + maximumFileSize?: number, + allowedFileExtensions?: string[], + compression?: Compression, + encryption?: boolean, + antivirus?: boolean, + transformations?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -323,10 +488,10 @@ export class Storage { compression: rest[6] as Compression, encryption: rest[7] as boolean, antivirus: rest[8] as boolean, - transformations: rest[9] as boolean + transformations: rest[9] as boolean, }; } - + const bucketId = params.bucketId; const name = params.name; const permissions = params.permissions; @@ -338,60 +503,58 @@ export class Storage { const encryption = params.encryption; const antivirus = params.antivirus; const transformations = params.transformations; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + 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}', encodeURIComponent(String(bucketId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}'.replace( + '{bucketId}', + encodeURIComponent(String(bucketId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof fileSecurity !== 'undefined') { - payload['fileSecurity'] = fileSecurity; + apiPayload['fileSecurity'] = fileSecurity; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; + apiPayload['maximumFileSize'] = maximumFileSize; } if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; + apiPayload['allowedFileExtensions'] = allowedFileExtensions; } if (typeof compression !== 'undefined') { - payload['compression'] = compression; + apiPayload['compression'] = compression; } if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; + apiPayload['encryption'] = encryption; } if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; + apiPayload['antivirus'] = antivirus; } if (typeof transformations !== 'undefined') { - payload['transformations'] = transformations; + apiPayload['transformations'] = transformations; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -411,40 +574,40 @@ export class Storage { * @deprecated Use the object parameter style method for a better developer experience. */ deleteBucket(bucketId: string): Promise<{}>; - deleteBucket( - paramsOrFirst: { bucketId: string } | string - ): Promise<{}> { + deleteBucket(paramsOrFirst: { bucketId: string } | string): Promise<{}> { let params: { bucketId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { bucketId: string }; } else { params = { - bucketId: paramsOrFirst as string + bucketId: paramsOrFirst as string, }; } - - const bucketId = params.bucketId; + const bucketId = params.bucketId; if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}'.replace( + '{bucketId}', + encodeURIComponent(String(bucketId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -457,7 +620,12 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - listFiles(params: { bucketId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listFiles(params: { + bucketId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all the user files. You can use the query params to filter your results. * @@ -469,68 +637,92 @@ export class Storage { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise; listFiles( - paramsOrFirst: { bucketId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + bucketId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listFiles( + paramsOrFirst: + | { + bucketId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - let params: { bucketId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, queries?: string[], search?: string, total?: boolean }; + let params: { + bucketId: string; + queries?: string[]; + search?: string; + total?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + queries?: string[]; + search?: string; + total?: boolean; + }; } else { params = { bucketId: paramsOrFirst as string, queries: rest[0] as string[], search: rest[1] as string, - total: rest[2] as boolean + total: rest[2] as boolean, }; } - + const bucketId = params.bucketId; const queries = params.queries; const search = params.search; const total = params.total; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } - - const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', encodeURIComponent(String(bucketId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files'.replace( + '{bucketId}', + encodeURIComponent(String(bucketId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. - * + * * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. - * + * * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. - * + * * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - * + * * * @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 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. @@ -540,16 +732,23 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - createFile(params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void }): Promise; + createFile(params: { + bucketId: string; + fileId: string; + file: File | InputFile; + permissions?: string[]; + folder?: string; + onProgress?: (progress: UploadProgress) => void; + }): Promise; /** * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. - * + * * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. - * + * * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. - * + * * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - * + * * * @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 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. @@ -560,36 +759,77 @@ export class Storage { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFile(bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void): Promise; createFile( - paramsOrFirst: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(string)?, (File | InputFile)?, (string[])?, (string)?,((progress: UploadProgress) => void)?] + bucketId: string, + fileId: string, + file: File | InputFile, + permissions?: string[], + folder?: string, + onProgress?: (progress: UploadProgress) => void, + ): Promise; + createFile( + paramsOrFirst: + | { + bucketId: string; + fileId: string; + file: File | InputFile; + permissions?: string[]; + folder?: string; + onProgress?: (progress: UploadProgress) => void; + } + | string, + ...rest: [ + string?, + (File | InputFile)?, + string[]?, + string?, + ((progress: UploadProgress) => void)?, + ] ): Promise { - let params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string }; - let onProgress: ((progress: UploadProgress) => void); - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], folder?: string }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + let params: { + bucketId: string; + fileId: string; + file: File | InputFile; + permissions?: string[]; + folder?: string; + }; + let onProgress: (progress: UploadProgress) => void; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + fileId: string; + file: File | InputFile; + permissions?: string[]; + folder?: string; + }; + onProgress = paramsOrFirst?.onProgress as ( + progress: UploadProgress, + ) => void; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, file: rest[1] as File | InputFile, permissions: rest[2] as string[], - folder: rest[3] as string + folder: rest[3] as string, }; - onProgress = rest[4] as ((progress: UploadProgress) => void); + onProgress = rest[4] as (progress: UploadProgress) => void; } - + const bucketId = params.bucketId; const fileId = params.fileId; const file = params.file; const permissions = params.permissions; const folder = params.folder; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } if (typeof fileId === 'undefined') { throw new AppwriteException('Missing required parameter: "fileId"'); @@ -597,35 +837,37 @@ export class Storage { if (typeof file === 'undefined') { throw new AppwriteException('Missing required parameter: "file"'); } - - const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', encodeURIComponent(String(bucketId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files'.replace( + '{bucketId}', + encodeURIComponent(String(bucketId)), + ); + const apiPayload: Payload = {}; if (typeof fileId !== 'undefined') { - payload['fileId'] = fileId; + apiPayload['fileId'] = fileId; } if (typeof file !== 'undefined') { - payload['file'] = file; + apiPayload['file'] = file; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof folder !== 'undefined') { - payload['folder'] = folder; + apiPayload['folder'] = folder; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', - 'accept': 'application/json', - } + accept: 'application/json', + }; return this.client.chunkedUpload( 'post', uri, apiHeaders, - payload, - onProgress + apiPayload, + onProgress, ); } @@ -637,7 +879,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFile(params: { bucketId: string, fileId: string }): Promise; + getFile(params: { bucketId: string; fileId: string }): Promise; /** * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. * @@ -649,45 +891,49 @@ export class Storage { */ getFile(bucketId: string, fileId: string): Promise; getFile( - paramsOrFirst: { bucketId: string, fileId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { bucketId: string; fileId: string } | string, + ...rest: [string?] ): Promise { - let params: { bucketId: string, fileId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; + let params: { bucketId: string; fileId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + fileId: string; + }; } else { params = { bucketId: paramsOrFirst as string, - fileId: rest[0] as string + fileId: rest[0] as string, }; } - + const bucketId = params.bucketId; const fileId = params.fileId; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } if (typeof fileId === 'undefined') { throw new AppwriteException('Missing required parameter: "fileId"'); } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -700,7 +946,12 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - updateFile(params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }): Promise; + updateFile(params: { + bucketId: string; + fileId: string; + name?: string; + permissions?: string[]; + }): Promise; /** * Update a file by its unique ID. Only users with write permissions have access to update this resource. * @@ -712,58 +963,81 @@ export class Storage { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise; updateFile( - paramsOrFirst: { bucketId: string, fileId: string, name?: string, permissions?: string[] } | string, - ...rest: [(string)?, (string)?, (string[])?] + bucketId: string, + fileId: string, + name?: string, + permissions?: string[], + ): Promise; + updateFile( + paramsOrFirst: + | { + bucketId: string; + fileId: string; + name?: string; + permissions?: string[]; + } + | string, + ...rest: [string?, string?, string[]?] ): Promise { - let params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, name?: string, permissions?: string[] }; + let params: { + bucketId: string; + fileId: string; + name?: string; + permissions?: string[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + fileId: string; + name?: string; + permissions?: string[]; + }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, name: rest[1] as string, - permissions: rest[2] as string[] + permissions: rest[2] as string[], }; } - + const bucketId = params.bucketId; const fileId = params.fileId; const name = params.name; const permissions = params.permissions; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } if (typeof fileId === 'undefined') { throw new AppwriteException('Missing required parameter: "fileId"'); } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -774,7 +1048,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteFile(params: { bucketId: string, fileId: string }): Promise<{}>; + deleteFile(params: { bucketId: string; fileId: string }): Promise<{}>; /** * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. * @@ -786,45 +1060,49 @@ export class Storage { */ deleteFile(bucketId: string, fileId: string): Promise<{}>; deleteFile( - paramsOrFirst: { bucketId: string, fileId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { bucketId: string; fileId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { bucketId: string, fileId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; + let params: { bucketId: string; fileId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + fileId: string; + }; } else { params = { bucketId: paramsOrFirst as string, - fileId: rest[0] as string + fileId: rest[0] as string, }; } - + const bucketId = params.bucketId; const fileId = params.fileId; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } if (typeof fileId === 'undefined') { throw new AppwriteException('Missing required parameter: "fileId"'); } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -836,7 +1114,11 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFileDownload(params: { bucketId: string, fileId: string, token?: string }): Promise; + getFileDownload(params: { + bucketId: string; + fileId: string; + token?: string; + }): Promise; /** * Get a file 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. * @@ -847,52 +1129,67 @@ export class Storage { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getFileDownload(bucketId: string, fileId: string, token?: string): Promise; getFileDownload( - paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string, - ...rest: [(string)?, (string)?] + bucketId: string, + fileId: string, + token?: string, + ): Promise; + getFileDownload( + paramsOrFirst: + { bucketId: string; fileId: string; token?: string } | string, + ...rest: [string?, string?] ): Promise { - let params: { bucketId: string, fileId: string, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string }; + let params: { bucketId: string; fileId: string; token?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + fileId: string; + token?: string; + }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, - token: rest[1] as string + token: rest[1] as string, }; } - + const bucketId = params.bucketId; const fileId = params.fileId; const token = params.token; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } if (typeof fileId === 'undefined') { throw new AppwriteException('Missing required parameter: "fileId"'); } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; if (typeof token !== 'undefined') { - payload['token'] = token; + apiPayload['token'] = token; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': '*/*', - } + accept: '*/*', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } @@ -916,7 +1213,22 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFilePreview(params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }): Promise; + getFilePreview(params: { + bucketId: string; + fileId: string; + width?: number; + height?: number; + gravity?: ImageGravity; + quality?: number; + borderWidth?: number; + borderColor?: string; + borderRadius?: number; + opacity?: number; + rotation?: number; + background?: string; + output?: ImageFormat; + token?: string; + }): Promise; /** * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. * @@ -938,15 +1250,95 @@ export class Storage { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): Promise; getFilePreview( - paramsOrFirst: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string } | string, - ...rest: [(string)?, (number)?, (number)?, (ImageGravity)?, (number)?, (number)?, (string)?, (number)?, (number)?, (number)?, (string)?, (ImageFormat)?, (string)?] + bucketId: string, + fileId: string, + width?: number, + height?: number, + gravity?: ImageGravity, + quality?: number, + borderWidth?: number, + borderColor?: string, + borderRadius?: number, + opacity?: number, + rotation?: number, + background?: string, + output?: ImageFormat, + token?: string, + ): Promise; + getFilePreview( + paramsOrFirst: + | { + bucketId: string; + fileId: string; + width?: number; + height?: number; + gravity?: ImageGravity; + quality?: number; + borderWidth?: number; + borderColor?: string; + borderRadius?: number; + opacity?: number; + rotation?: number; + background?: string; + output?: ImageFormat; + token?: string; + } + | string, + ...rest: [ + string?, + number?, + number?, + ImageGravity?, + number?, + number?, + string?, + number?, + number?, + number?, + string?, + ImageFormat?, + string?, + ] ): Promise { - let params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }; + let params: { + bucketId: string; + fileId: string; + width?: number; + height?: number; + gravity?: ImageGravity; + quality?: number; + borderWidth?: number; + borderColor?: string; + borderRadius?: number; + opacity?: number; + rotation?: number; + background?: string; + output?: ImageFormat; + token?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + fileId: string; + width?: number; + height?: number; + gravity?: ImageGravity; + quality?: number; + borderWidth?: number; + borderColor?: string; + borderRadius?: number; + opacity?: number; + rotation?: number; + background?: string; + output?: ImageFormat; + token?: string; + }; } else { params = { bucketId: paramsOrFirst as string, @@ -962,10 +1354,10 @@ export class Storage { rotation: rest[9] as number, background: rest[10] as string, output: rest[11] as ImageFormat, - token: rest[12] as string + token: rest[12] as string, }; } - + const bucketId = params.bucketId; const fileId = params.fileId; const width = params.width; @@ -980,65 +1372,67 @@ export class Storage { const background = params.background; const output = params.output; const token = params.token; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } if (typeof fileId === 'undefined') { throw new AppwriteException('Missing required parameter: "fileId"'); } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; if (typeof width !== 'undefined') { - payload['width'] = width; + apiPayload['width'] = width; } if (typeof height !== 'undefined') { - payload['height'] = height; + apiPayload['height'] = height; } if (typeof gravity !== 'undefined') { - payload['gravity'] = gravity; + apiPayload['gravity'] = gravity; } if (typeof quality !== 'undefined') { - payload['quality'] = quality; + apiPayload['quality'] = quality; } if (typeof borderWidth !== 'undefined') { - payload['borderWidth'] = borderWidth; + apiPayload['borderWidth'] = borderWidth; } if (typeof borderColor !== 'undefined') { - payload['borderColor'] = borderColor; + apiPayload['borderColor'] = borderColor; } if (typeof borderRadius !== 'undefined') { - payload['borderRadius'] = borderRadius; + apiPayload['borderRadius'] = borderRadius; } if (typeof opacity !== 'undefined') { - payload['opacity'] = opacity; + apiPayload['opacity'] = opacity; } if (typeof rotation !== 'undefined') { - payload['rotation'] = rotation; + apiPayload['rotation'] = rotation; } if (typeof background !== 'undefined') { - payload['background'] = background; + apiPayload['background'] = background; } if (typeof output !== 'undefined') { - payload['output'] = output; + apiPayload['output'] = output; } if (typeof token !== 'undefined') { - payload['token'] = token; + apiPayload['token'] = token; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'image/*', - } + accept: 'image/*', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } @@ -1051,7 +1445,11 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - getFileView(params: { bucketId: string, fileId: string, token?: string }): Promise; + getFileView(params: { + bucketId: string; + fileId: string; + token?: string; + }): Promise; /** * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. * @@ -1062,52 +1460,67 @@ export class Storage { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getFileView(bucketId: string, fileId: string, token?: string): Promise; getFileView( - paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string, - ...rest: [(string)?, (string)?] + bucketId: string, + fileId: string, + token?: string, + ): Promise; + getFileView( + paramsOrFirst: + { bucketId: string; fileId: string; token?: string } | string, + ...rest: [string?, string?] ): Promise { - let params: { bucketId: string, fileId: string, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string }; + let params: { bucketId: string; fileId: string; token?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + bucketId: string; + fileId: string; + token?: string; + }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, - token: rest[1] as string + token: rest[1] as string, }; } - + const bucketId = params.bucketId; const fileId = params.fileId; const token = params.token; - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); + throw new AppwriteException( + 'Missing required parameter: "bucketId"', + ); } if (typeof fileId === 'undefined') { throw new AppwriteException('Missing required parameter: "fileId"'); } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; if (typeof token !== 'undefined') { - payload['token'] = token; + apiPayload['token'] = token; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': '*/*', - } + accept: '*/*', + }; return this.client.call( 'get', uri, apiHeaders, - payload, - 'arrayBuffer' + apiPayload, + 'arrayBuffer', ); } } diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index ab832a4..c24744d 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -1,12 +1,10 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } 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; @@ -23,7 +21,11 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + list(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * @@ -34,57 +36,64 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + list( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/tablesdb'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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. @@ -95,10 +104,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }): Promise; + create(params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }): Promise; /** * 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. @@ -110,15 +126,49 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string): Promise; create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (number)?, (string)?] + databaseId: string, + name: string, + enabled?: boolean, + specification?: string, + replicas?: number, + syncMode?: string, + ): Promise; + create( + paramsOrFirst: + | { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + } + | string, + ...rest: [string?, boolean?, string?, number?, string?] ): Promise { - let params: { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; + let params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -126,58 +176,53 @@ export class TablesDB { enabled: rest[1] as boolean, specification: rest[2] as string, replicas: rest[3] as number, - syncMode: rest[4] as string + syncMode: rest[4] as string, }; } - + const databaseId = params.databaseId; const name = params.name; const enabled = params.enabled; const specification = params.specification; const replicas = params.replicas; const syncMode = params.syncMode; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/tablesdb'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof databaseId !== 'undefined') { - payload['databaseId'] = databaseId; + apiPayload['databaseId'] = databaseId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof specification !== 'undefined') { - payload['specification'] = specification; + apiPayload['specification'] = specification; } if (typeof replicas !== 'undefined') { - payload['replicas'] = replicas; + apiPayload['replicas'] = replicas; } if (typeof syncMode !== 'undefined') { - payload['syncMode'] = syncMode; + apiPayload['syncMode'] = syncMode; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -187,22 +232,16 @@ export class TablesDB { * @returns {Promise} */ listSpecifications(): Promise { - const apiPath = '/tablesdb/specifications'; - const payload: Payload = {}; + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -212,7 +251,9 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listTransactions(params?: { queries?: string[] }): Promise; + listTransactions(params?: { + queries?: string[]; + }): Promise; /** * List transactions across all databases. * @@ -223,39 +264,37 @@ export class TablesDB { */ listTransactions(queries?: string[]): Promise; listTransactions( - paramsOrFirst?: { queries?: string[] } | string[] + paramsOrFirst?: { queries?: string[] } | string[], ): Promise { let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { queries?: string[] }; } else { params = { - queries: paramsOrFirst as string[] + queries: paramsOrFirst as string[], }; } - - const queries = params.queries; - + const queries = params.queries; const apiPath = '/tablesdb/transactions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -276,40 +315,38 @@ export class TablesDB { */ createTransaction(ttl?: number): Promise; createTransaction( - paramsOrFirst?: { ttl?: number } | number + paramsOrFirst?: { ttl?: number } | number, ): Promise { let params: { ttl?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { params = (paramsOrFirst || {}) as { ttl?: number }; } else { params = { - ttl: paramsOrFirst as number + ttl: paramsOrFirst as number, }; } - - const ttl = params.ttl; - + const ttl = params.ttl; const apiPath = '/tablesdb/transactions'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; + apiPayload['ttl'] = ttl; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -319,7 +356,9 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getTransaction(params: { transactionId: string }): Promise; + getTransaction(params: { + transactionId: string; + }): Promise; /** * Get a transaction by its unique ID. * @@ -330,39 +369,41 @@ export class TablesDB { */ getTransaction(transactionId: string): Promise; getTransaction( - paramsOrFirst: { transactionId: string } | string + paramsOrFirst: { transactionId: string } | string, ): Promise { let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { transactionId: string }; } else { params = { - transactionId: paramsOrFirst as string + transactionId: paramsOrFirst as string, }; } - - const transactionId = params.transactionId; + const transactionId = params.transactionId; if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -374,7 +415,11 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise; + updateTransaction(params: { + transactionId: string; + commit?: boolean; + rollback?: boolean; + }): Promise; /** * Update a transaction, to either commit or roll back its operations. * @@ -385,53 +430,69 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise; updateTransaction( - paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, - ...rest: [(boolean)?, (boolean)?] + transactionId: string, + commit?: boolean, + rollback?: boolean, + ): Promise; + updateTransaction( + paramsOrFirst: + | { transactionId: string; commit?: boolean; rollback?: boolean } + | string, + ...rest: [boolean?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; if (typeof commit !== 'undefined') { - payload['commit'] = commit; + apiPayload['commit'] = commit; } if (typeof rollback !== 'undefined') { - payload['rollback'] = rollback; + apiPayload['rollback'] = rollback; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -452,39 +513,41 @@ export class TablesDB { */ deleteTransaction(transactionId: string): Promise<{}>; deleteTransaction( - paramsOrFirst: { transactionId: string } | string + paramsOrFirst: { transactionId: string } | string, ): Promise<{}> { let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { transactionId: string }; } else { params = { - transactionId: paramsOrFirst as string + transactionId: paramsOrFirst as string, }; } - - const transactionId = params.transactionId; + const transactionId = params.transactionId; if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -495,7 +558,10 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise; + createOperations(params: { + transactionId: string; + operations?: object[]; + }): Promise; /** * Create multiple operations in a single transaction. * @@ -505,48 +571,58 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createOperations(transactionId: string, operations?: object[]): Promise; createOperations( - paramsOrFirst: { transactionId: string, operations?: object[] } | string, - ...rest: [(object[])?] + transactionId: string, + operations?: object[], + ): Promise; + createOperations( + paramsOrFirst: + { transactionId: string; operations?: object[] } | string, + ...rest: [object[]?] ): Promise { - let params: { transactionId: string, operations?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; + 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[] + 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}', encodeURIComponent(String(transactionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "transactionId"', + ); + } + const apiPath = + '/tablesdb/transactions/{transactionId}/operations'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; if (typeof operations !== 'undefined') { - payload['operations'] = operations; + apiPayload['operations'] = operations; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -567,39 +643,41 @@ export class TablesDB { */ get(databaseId: string): Promise; get( - paramsOrFirst: { databaseId: string } | string + paramsOrFirst: { databaseId: string } | string, ): Promise { let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string + databaseId: paramsOrFirst as string, }; } - - const databaseId = params.databaseId; + const databaseId = params.databaseId; if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -614,7 +692,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }): Promise; + update(params: { + databaseId: string; + name?: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }): Promise; /** * Update a database by its unique ID. * @@ -628,15 +713,49 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string): Promise; update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (number)?, (string)?] + databaseId: string, + name?: string, + enabled?: boolean, + specification?: string, + replicas?: number, + syncMode?: string, + ): Promise; + update( + paramsOrFirst: + | { + databaseId: string; + name?: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + } + | string, + ...rest: [string?, boolean?, string?, number?, string?] ): Promise { - let params: { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean, specification?: string, replicas?: number, syncMode?: string }; + let params: { + databaseId: string; + name?: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name?: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -644,52 +763,50 @@ export class TablesDB { enabled: rest[1] as boolean, specification: rest[2] as string, replicas: rest[3] as number, - syncMode: rest[4] as string + syncMode: rest[4] as string, }; } - + const databaseId = params.databaseId; const name = params.name; const enabled = params.enabled; const specification = params.specification; const replicas = params.replicas; const syncMode = params.syncMode; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof specification !== 'undefined') { - payload['specification'] = specification; + apiPayload['specification'] = specification; } if (typeof replicas !== 'undefined') { - payload['replicas'] = replicas; + apiPayload['replicas'] = replicas; } if (typeof syncMode !== 'undefined') { - payload['syncMode'] = syncMode; + apiPayload['syncMode'] = syncMode; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -709,53 +826,56 @@ export class TablesDB { * @deprecated Use the object parameter style method for a better developer experience. */ delete(databaseId: string): Promise<{}>; - delete( - paramsOrFirst: { databaseId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { databaseId: string } | string): Promise<{}> { let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string + databaseId: paramsOrFirst as string, }; } - - const databaseId = params.databaseId; + const databaseId = params.databaseId; if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** - * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation by a failover that did not finish also accepts this call as a repair, provided `targetReplicaId` names the member to promote. + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. * * @param {string} params.databaseId - Database ID. * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. * @throws {AppwriteException} * @returns {Promise} */ - createFailover(params: { databaseId: string, targetReplicaId?: string }): Promise; + createFailover(params: { + databaseId: string; + targetReplicaId?: string; + }): Promise; /** - * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation by a failover that did not finish also accepts this call as a repair, provided `targetReplicaId` names the member to promote. + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. * * @param {string} databaseId - Database ID. * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. @@ -763,48 +883,57 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFailover(databaseId: string, targetReplicaId?: string): Promise; createFailover( - paramsOrFirst: { databaseId: string, targetReplicaId?: string } | string, - ...rest: [(string)?] + databaseId: string, + targetReplicaId?: string, + ): Promise; + createFailover( + paramsOrFirst: + { databaseId: string; targetReplicaId?: string } | string, + ...rest: [string?] ): Promise { - let params: { databaseId: string, targetReplicaId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, targetReplicaId?: string }; + let params: { databaseId: string; targetReplicaId?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetReplicaId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, - targetReplicaId: rest[0] as string + targetReplicaId: rest[0] as string, }; } - + const databaseId = params.databaseId; const targetReplicaId = params.targetReplicaId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}/failovers'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/failovers'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof targetReplicaId !== 'undefined') { - payload['targetReplicaId'] = targetReplicaId; + apiPayload['targetReplicaId'] = targetReplicaId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -814,7 +943,9 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listMigrations(params: { databaseId: string }): Promise; + listMigrations(params: { + databaseId: string; + }): Promise; /** * List the dedicated migrations for a TablesDB database. A database has at most one in-flight migration. * @@ -825,39 +956,41 @@ export class TablesDB { */ listMigrations(databaseId: string): Promise; listMigrations( - paramsOrFirst: { databaseId: string } | string + paramsOrFirst: { databaseId: string } | string, ): Promise { let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string + databaseId: paramsOrFirst as string, }; } - - const databaseId = params.databaseId; + const databaseId = params.databaseId; if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}/migrations'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/migrations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -869,7 +1002,11 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createMigration(params: { databaseId: string, specification: string, autoCutover?: boolean }): Promise; + createMigration(params: { + databaseId: string; + specification: string; + autoCutover?: boolean; + }): Promise; /** * Start migrating a serverless TablesDB database onto a dedicated MySQL compute. Data is copied to the target while the source stays live, with a brief read-only window during cutover. * @@ -880,56 +1017,78 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMigration(databaseId: string, specification: string, autoCutover?: boolean): Promise; createMigration( - paramsOrFirst: { databaseId: string, specification: string, autoCutover?: boolean } | string, - ...rest: [(string)?, (boolean)?] + databaseId: string, + specification: string, + autoCutover?: boolean, + ): Promise; + createMigration( + paramsOrFirst: + | { + databaseId: string; + specification: string; + autoCutover?: boolean; + } + | string, + ...rest: [string?, boolean?] ): Promise { - let params: { databaseId: string, specification: string, autoCutover?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, specification: string, autoCutover?: boolean }; + let params: { + databaseId: string; + specification: string; + autoCutover?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + specification: string; + autoCutover?: boolean; + }; } else { params = { databaseId: paramsOrFirst as string, specification: rest[0] as string, - autoCutover: rest[1] as boolean + autoCutover: rest[1] as boolean, }; } - + const databaseId = params.databaseId; const specification = params.specification; const autoCutover = params.autoCutover; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof specification === 'undefined') { - throw new AppwriteException('Missing required parameter: "specification"'); + throw new AppwriteException( + 'Missing required parameter: "specification"', + ); } - - const apiPath = '/tablesdb/{databaseId}/migrations'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/migrations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof specification !== 'undefined') { - payload['specification'] = specification; + apiPayload['specification'] = specification; } if (typeof autoCutover !== 'undefined') { - payload['autoCutover'] = autoCutover; + apiPayload['autoCutover'] = autoCutover; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -940,7 +1099,10 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getMigration(params: { databaseId: string, migrationId: string }): Promise; + getMigration(params: { + databaseId: string; + migrationId: string; + }): Promise; /** * Get a single dedicated migration for a TablesDB database by its ID. * @@ -950,47 +1112,56 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getMigration(databaseId: string, migrationId: string): Promise; getMigration( - paramsOrFirst: { databaseId: string, migrationId: string } | string, - ...rest: [(string)?] + databaseId: string, + migrationId: string, + ): Promise; + getMigration( + paramsOrFirst: { databaseId: string; migrationId: string } | string, + ...rest: [string?] ): Promise { - let params: { databaseId: string, migrationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, migrationId: string }; + let params: { databaseId: string; migrationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + migrationId: string; + }; } else { params = { databaseId: paramsOrFirst as string, - migrationId: rest[0] as string + migrationId: rest[0] as string, }; } - + const databaseId = params.databaseId; const migrationId = params.migrationId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof migrationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "migrationId"'); - } - - const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{migrationId}', encodeURIComponent(String(migrationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "migrationId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{migrationId}', encodeURIComponent(String(migrationId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1001,7 +1172,10 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteMigration(params: { databaseId: string, migrationId: string }): Promise<{}>; + deleteMigration(params: { + databaseId: string; + migrationId: string; + }): Promise<{}>; /** * Abort an in-flight TablesDB dedicated migration. Only allowed before cutover; once the migration has cut over it cannot be aborted. * @@ -1013,46 +1187,52 @@ export class TablesDB { */ deleteMigration(databaseId: string, migrationId: string): Promise<{}>; deleteMigration( - paramsOrFirst: { databaseId: string, migrationId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { databaseId: string; migrationId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { databaseId: string, migrationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, migrationId: string }; + let params: { databaseId: string; migrationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + migrationId: string; + }; } else { params = { databaseId: paramsOrFirst as string, - migrationId: rest[0] as string + migrationId: rest[0] as string, }; } - + const databaseId = params.databaseId; const migrationId = params.migrationId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof migrationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "migrationId"'); - } - - const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{migrationId}', encodeURIComponent(String(migrationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "migrationId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{migrationId}', encodeURIComponent(String(migrationId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1063,7 +1243,10 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - cutoverMigration(params: { databaseId: string, migrationId: string }): Promise; + cutoverMigration(params: { + databaseId: string; + migrationId: string; + }): Promise; /** * Cut a verified TablesDB migration over to its dedicated compute. Only applies to a migration created with `autoCutover` disabled, which waits at `ready_to_cutover` until this is called. The routing flip happens shortly after this returns, with a brief read-only window. One call buys one attempt: a cutover that fails a check returns the migration to `verifying` and parks it again, so call this once more to retry. * @@ -1073,48 +1256,61 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - cutoverMigration(databaseId: string, migrationId: string): Promise; cutoverMigration( - paramsOrFirst: { databaseId: string, migrationId: string } | string, - ...rest: [(string)?] + databaseId: string, + migrationId: string, + ): Promise; + cutoverMigration( + paramsOrFirst: { databaseId: string; migrationId: string } | string, + ...rest: [string?] ): Promise { - let params: { databaseId: string, migrationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, migrationId: string }; + let params: { databaseId: string; migrationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + migrationId: string; + }; } else { params = { databaseId: paramsOrFirst as string, - migrationId: rest[0] as string + migrationId: rest[0] as string, }; } - + const databaseId = params.databaseId; const migrationId = params.migrationId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof migrationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "migrationId"'); - } - - const apiPath = '/tablesdb/{databaseId}/migrations/{migrationId}/cutover'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{migrationId}', encodeURIComponent(String(migrationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "migrationId"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/migrations/{migrationId}/cutover' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{migrationId}', + encodeURIComponent(String(migrationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1127,7 +1323,12 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listOperations(params: { databaseId: string, status?: string, limit?: number, offset?: number }): Promise; + listOperations(params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }): Promise; /** * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. * @@ -1139,57 +1340,81 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listOperations(databaseId: string, status?: string, limit?: number, offset?: number): Promise; listOperations( - paramsOrFirst: { databaseId: string, status?: string, limit?: number, offset?: number } | string, - ...rest: [(string)?, (number)?, (number)?] + databaseId: string, + status?: string, + limit?: number, + offset?: number, + ): Promise; + listOperations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, number?, number?] ): Promise { - let params: { databaseId: string, status?: string, limit?: number, offset?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, status?: string, limit?: number, offset?: number }; + let params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; } else { params = { databaseId: paramsOrFirst as string, status: rest[0] as string, limit: rest[1] as number, - offset: rest[2] as number + offset: rest[2] as number, }; } - + const databaseId = params.databaseId; const status = params.status; const limit = params.limit; const offset = params.offset; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}/operations'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/operations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof status !== 'undefined') { - payload['status'] = status; + apiPayload['status'] = status; } if (typeof limit !== 'undefined') { - payload['limit'] = limit; + apiPayload['limit'] = limit; } if (typeof offset !== 'undefined') { - payload['offset'] = offset; + apiPayload['offset'] = offset; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1199,7 +1424,9 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getReplicas(params: { databaseId: string }): Promise; + getReplicas(params: { + databaseId: string; + }): Promise; /** * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. * @@ -1210,39 +1437,41 @@ export class TablesDB { */ getReplicas(databaseId: string): Promise; getReplicas( - paramsOrFirst: { databaseId: string } | string + paramsOrFirst: { databaseId: string } | string, ): Promise { let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string + databaseId: paramsOrFirst as string, }; } - - const databaseId = params.databaseId; + const databaseId = params.databaseId; if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}/replicas'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/replicas'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1263,39 +1492,41 @@ export class TablesDB { */ getStatus(databaseId: string): Promise; getStatus( - paramsOrFirst: { databaseId: string } | string + paramsOrFirst: { databaseId: string } | string, ): Promise { let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { databaseId: string }; } else { params = { - databaseId: paramsOrFirst as string + databaseId: paramsOrFirst as string, }; } - - const databaseId = params.databaseId; + const databaseId = params.databaseId; if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}/status'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/status'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1308,7 +1539,12 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listTables(params: { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -1320,57 +1556,81 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTables(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise; listTables( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + databaseId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listTables( + paramsOrFirst: + | { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } - - const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1387,7 +1647,16 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise; + createTable(params: { + databaseId: string; + tableId: string; + name: string; + permissions?: string[]; + rowSecurity?: boolean; + enabled?: boolean; + columns?: object[]; + indexes?: object[]; + }): Promise; /** * 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. * @@ -1403,15 +1672,65 @@ export class TablesDB { * @returns {Promise} * @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; 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[])?] + databaseId: string, + tableId: string, + name: string, + permissions?: string[], + rowSecurity?: boolean, + enabled?: boolean, + columns?: object[], + indexes?: object[], + ): Promise; + 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 { - 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[] }; + 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, @@ -1421,10 +1740,10 @@ export class TablesDB { rowSecurity: rest[3] as boolean, enabled: rest[4] as boolean, columns: rest[5] as object[], - indexes: rest[6] as object[] + indexes: rest[6] as object[], }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const name = params.name; @@ -1433,54 +1752,54 @@ export class TablesDB { const enabled = params.enabled; const columns = params.columns; const indexes = params.indexes; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; if (typeof tableId !== 'undefined') { - payload['tableId'] = tableId; + apiPayload['tableId'] = tableId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; + apiPayload['rowSecurity'] = rowSecurity; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof columns !== 'undefined') { - payload['columns'] = columns; + apiPayload['columns'] = columns; } if (typeof indexes !== 'undefined') { - payload['indexes'] = indexes; + apiPayload['indexes'] = indexes; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -1491,7 +1810,10 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getTable(params: { databaseId: string, tableId: string }): Promise; + getTable(params: { + databaseId: string; + tableId: string; + }): Promise; /** * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. * @@ -1503,45 +1825,51 @@ export class TablesDB { */ getTable(databaseId: string, tableId: string): Promise; getTable( - paramsOrFirst: { databaseId: string, tableId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + tableId: rest[0] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1557,7 +1885,15 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise; + updateTable(params: { + databaseId: string; + tableId: string; + name?: string; + permissions?: string[]; + rowSecurity?: boolean; + enabled?: boolean; + purge?: boolean; + }): Promise; /** * Update a table by its unique ID. * @@ -1572,15 +1908,53 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise; updateTable( - paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] + databaseId: string, + tableId: string, + name?: string, + permissions?: string[], + rowSecurity?: boolean, + enabled?: boolean, + purge?: boolean, + ): Promise; + updateTable( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + name?: string; + permissions?: string[]; + rowSecurity?: boolean; + enabled?: boolean; + purge?: boolean; + } + | string, + ...rest: [string?, string?, string[]?, boolean?, boolean?, boolean?] ): Promise { - let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, 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 }; + 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, @@ -1589,10 +1963,10 @@ export class TablesDB { permissions: rest[2] as string[], rowSecurity: rest[3] as boolean, enabled: rest[4] as boolean, - purge: rest[5] as boolean + purge: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const name = params.name; @@ -1600,45 +1974,44 @@ export class TablesDB { const rowSecurity = params.rowSecurity; const enabled = params.enabled; const purge = params.purge; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; + apiPayload['rowSecurity'] = rowSecurity; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof purge !== 'undefined') { - payload['purge'] = purge; + apiPayload['purge'] = purge; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1649,7 +2022,7 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTable(params: { databaseId: string, tableId: string }): 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. * @@ -1661,45 +2034,51 @@ export class TablesDB { */ deleteTable(databaseId: string, tableId: string): Promise<{}>; deleteTable( - paramsOrFirst: { databaseId: string, tableId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + tableId: rest[0] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1712,7 +2091,12 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; + listColumns(params: { + databaseId: string; + tableId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List columns in the table. * @@ -1724,62 +2108,87 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listColumns(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise; listColumns( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] + databaseId: string, + tableId: string, + queries?: string[], + total?: boolean, + ): Promise; + listColumns( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + queries?: string[]; + total?: boolean; + } + | string, + ...rest: [string?, string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Create a bigint column. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. @@ -1792,10 +2201,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise; + createBigIntColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + min?: number | bigint; + max?: number | bigint; + xdefault?: number | bigint; + array?: boolean; + }): Promise; /** * Create a bigint column. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -1809,15 +2227,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + min?: number | bigint, + max?: number | bigint, + xdefault?: number | bigint, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -1827,10 +2295,10 @@ export class TablesDB { min: rest[3] as number | bigint, max: rest[4] as number | bigint, xdefault: rest[5] as number | bigint, - array: rest[6] as boolean + array: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -1839,59 +2307,60 @@ export class TablesDB { const max = params.max; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -1904,10 +2373,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise; + updateBigIntColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number | bigint; + min?: number | bigint; + max?: number | bigint; + newKey?: string; + }): Promise; /** * Update a bigint column. Changing the `default` value will not update already existing rows. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -1921,15 +2399,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: number | bigint, + min?: number | bigint, + max?: number | bigint, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -1939,10 +2467,10 @@ export class TablesDB { xdefault: rest[3] as number | bigint, min: rest[4] as number | bigint, max: rest[5] as number | bigint, - newKey: rest[6] as string + newKey: rest[6] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -1951,59 +2479,64 @@ export class TablesDB { const min = params.min; const max = params.max; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -2014,10 +2547,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise; + createBooleanColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: boolean; + array?: boolean; + }): Promise; /** * 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). @@ -2029,15 +2569,49 @@ export class TablesDB { * @returns {Promise} * @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; createBooleanColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: boolean, + array?: boolean, + ): Promise; + createBooleanColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: boolean; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, boolean?, boolean?] ): Promise { - 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 }; + 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, @@ -2045,58 +2619,60 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as boolean, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2111,7 +2687,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise; + updateBooleanColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: boolean; + newKey?: string; + }): Promise; /** * Update a boolean column. Changing the `default` value will not update already existing rows. * @@ -2125,15 +2708,49 @@ export class TablesDB { * @returns {Promise} * @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; updateBooleanColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: boolean, + newKey?: string, + ): Promise; + updateBooleanColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: boolean; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, boolean?, string?] ): Promise { - 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 }; + 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, @@ -2141,58 +2758,63 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as boolean, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2207,7 +2829,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createDatetimeColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create a date time column according to the ISO 8601 standard. * @@ -2221,15 +2850,49 @@ export class TablesDB { * @returns {Promise} * @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; createDatetimeColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createDatetimeColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -2237,58 +2900,60 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2303,7 +2968,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateDatetimeColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update a date time column. Changing the `default` value will not update already existing rows. * @@ -2317,15 +2989,49 @@ export class TablesDB { * @returns {Promise} * @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; updateDatetimeColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateDatetimeColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -2333,63 +3039,68 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create an email column. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. @@ -2400,10 +3111,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createEmailColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create an email column. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -2415,15 +3133,49 @@ export class TablesDB { * @returns {Promise} * @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; createEmailColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createEmailColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -2431,63 +3183,64 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -2498,10 +3251,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateEmailColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an email column. Changing the `default` value will not update already existing rows. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -2513,15 +3273,49 @@ export class TablesDB { * @returns {Promise} * @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; updateEmailColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateEmailColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -2529,58 +3323,63 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2596,7 +3395,15 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise; + createEnumColumn(params: { + databaseId: string; + tableId: string; + key: string; + elements: string[]; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. * @@ -2611,15 +3418,53 @@ export class TablesDB { * @returns {Promise} * @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; createEnumColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + elements: string[], + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2628,10 +3473,10 @@ export class TablesDB { elements: rest[2] as string[], required: rest[3] as boolean, xdefault: rest[4] as string, - array: rest[5] as boolean + array: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -2639,59 +3484,62 @@ export class TablesDB { const required = params.required; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof elements !== 'undefined') { - payload['elements'] = elements; + apiPayload['elements'] = elements; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -2703,10 +3551,18 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise; + updateEnumColumn(params: { + databaseId: string; + tableId: string; + key: string; + elements: string[]; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an enum column. Changing the `default` value will not update already existing rows. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -2719,15 +3575,53 @@ export class TablesDB { * @returns {Promise} * @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; updateEnumColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + elements: string[], + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2736,10 +3630,10 @@ export class TablesDB { elements: rest[2] as string[], required: rest[3] as boolean, xdefault: rest[4] as string, - newKey: rest[5] as string + newKey: rest[5] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -2747,59 +3641,66 @@ export class TablesDB { const required = params.required; const xdefault = params.xdefault; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + throw new AppwriteException( + 'Missing required parameter: "elements"', + ); } if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof elements !== 'undefined') { - payload['elements'] = elements; + apiPayload['elements'] = elements; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create a float column. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. @@ -2812,10 +3713,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise; + createFloatColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + min?: number; + max?: number; + xdefault?: number; + array?: boolean; + }): Promise; /** * Create a float column. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -2829,15 +3739,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + min?: number, + max?: number, + xdefault?: number, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -2847,10 +3807,10 @@ export class TablesDB { min: rest[3] as number, max: rest[4] as number, xdefault: rest[5] as number, - array: rest[6] as boolean + array: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -2859,59 +3819,60 @@ export class TablesDB { const max = params.max; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -2924,10 +3885,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise; + updateFloatColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number; + min?: number; + max?: number; + newKey?: string; + }): Promise; /** * Update a float column. Changing the `default` value will not update already existing rows. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -2941,15 +3911,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: number, + min?: number, + max?: number, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -2959,10 +3979,10 @@ export class TablesDB { xdefault: rest[3] as number, min: rest[4] as number, max: rest[5] as number, - newKey: rest[6] as string + newKey: rest[6] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -2971,59 +3991,64 @@ export class TablesDB { const min = params.min; const max = params.max; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create an integer column. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. @@ -3036,10 +4061,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise; + createIntegerColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + min?: number | bigint; + max?: number | bigint; + xdefault?: number | bigint; + array?: boolean; + }): Promise; /** * Create an integer column. Optionally, minimum and maximum values can be provided. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -3053,15 +4087,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + min?: number | bigint, + max?: number | bigint, + xdefault?: number | bigint, + array?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -3071,10 +4155,10 @@ export class TablesDB { min: rest[3] as number | bigint, max: rest[4] as number | bigint, xdefault: rest[5] as number | bigint, - array: rest[6] as boolean + array: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -3083,59 +4167,61 @@ export class TablesDB { const max = params.max; const xdefault = params.xdefault; const array = params.array; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/integer' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -3148,10 +4234,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise; + updateIntegerColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number | bigint; + min?: number | bigint; + max?: number | bigint; + newKey?: string; + }): Promise; /** * Update an integer column. Changing the `default` value will not update already existing rows. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -3165,15 +4260,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: number | bigint, + min?: number | bigint, + max?: number | bigint, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -3183,10 +4328,10 @@ export class TablesDB { xdefault: rest[3] as number | bigint, min: rest[4] as number | bigint, max: rest[5] as number | bigint, - newKey: rest[6] as string + newKey: rest[6] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -3195,59 +4340,64 @@ export class TablesDB { const min = params.min; const max = params.max; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create IP address column. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. @@ -3258,10 +4408,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createIpColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create IP address column. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -3273,15 +4430,49 @@ export class TablesDB { * @returns {Promise} * @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; createIpColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createIpColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -3289,63 +4480,64 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -3356,10 +4548,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateIpColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an ip column. Changing the `default` value will not update already existing rows. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -3371,15 +4570,49 @@ export class TablesDB { * @returns {Promise} * @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; updateIpColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateIpColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -3387,58 +4620,63 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3452,7 +4690,13 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] }): Promise; + createLineColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + }): Promise; /** * Create a geometric line column. * @@ -3465,69 +4709,100 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: any[][], + ): Promise; + createLineColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?] ): Promise { - 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[][] }; + 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[][] + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3542,7 +4817,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string }): Promise; + updateLineColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + }): Promise; /** * Update a line column. Changing the `default` value will not update already existing rows. * @@ -3556,15 +4838,49 @@ export class TablesDB { * @returns {Promise} * @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; updateLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: any[][], + newKey?: string, + ): Promise; + updateLineColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?, string?] ): Promise { - 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 }; + 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, @@ -3572,60 +4888,63 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as any[][], - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -3637,10 +4956,18 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createLongtextColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -3653,15 +4980,53 @@ export class TablesDB { * @returns {Promise} * @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; createLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -3670,10 +5035,10 @@ export class TablesDB { required: rest[2] as boolean, xdefault: rest[3] as string, array: rest[4] as boolean, - encrypt: rest[5] as boolean + encrypt: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -3681,56 +5046,58 @@ export class TablesDB { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -3741,10 +5108,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateLongtextColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * 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). @@ -3756,15 +5130,49 @@ export class TablesDB { * @returns {Promise} * @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; updateLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateLongtextColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -3772,63 +5180,68 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -3840,10 +5253,18 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createMediumtextColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -3856,15 +5277,53 @@ export class TablesDB { * @returns {Promise} * @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; createMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -3873,10 +5332,10 @@ export class TablesDB { required: rest[2] as boolean, xdefault: rest[3] as string, array: rest[4] as boolean, - encrypt: rest[5] as boolean + encrypt: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -3884,56 +5343,58 @@ export class TablesDB { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -3944,10 +5405,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateMediumtextColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * 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). @@ -3959,15 +5427,49 @@ export class TablesDB { * @returns {Promise} * @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; updateMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateMediumtextColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -3975,58 +5477,63 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4040,7 +5547,13 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] }): Promise; + createPointColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + }): Promise; /** * Create a geometric point column. * @@ -4053,69 +5566,100 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[]): Promise; createPointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number[])?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: number[], + ): Promise; + createPointColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + } + | string, + ...rest: [string?, string?, boolean?, number[]?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[] }; + let params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + }; } 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[] + xdefault: rest[3] as number[], }; } - + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4130,7 +5674,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string }): Promise; + updatePointColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + }): Promise; /** * Update a point column. Changing the `default` value will not update already existing rows. * @@ -4144,15 +5695,49 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string): Promise; updatePointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number[])?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: number[], + newKey?: string, + ): Promise; + updatePointColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, number[]?, string?] ): Promise { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number[], newKey?: string }; + let params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: number[]; + newKey?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -4160,55 +5745,58 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as number[], - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -4222,7 +5810,13 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] }): Promise; + createPolygonColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + }): Promise; /** * Create a geometric polygon column. * @@ -4235,69 +5829,101 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][]): Promise; createPolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: any[][], + ): Promise; + createPolygonColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?] ): Promise { - 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[][] }; + 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[][] + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -4312,7 +5938,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string }): Promise; + updatePolygonColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + }): Promise; /** * Update a polygon column. Changing the `default` value will not update already existing rows. * @@ -4326,15 +5959,49 @@ export class TablesDB { * @returns {Promise} * @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; updatePolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[][], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[][])?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: any[][], + newKey?: string, + ): Promise; + updatePolygonColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: any[][]; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, any[][]?, string?] ): Promise { - 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 }; + 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, @@ -4342,60 +6009,63 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as any[][], - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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. @@ -4408,10 +6078,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise; + createRelationshipColumn(params: { + databaseId: string; + tableId: string; + relatedTableId: string; + type: RelationshipType; + twoWay?: boolean; + key?: string; + twoWayKey?: string; + onDelete?: RelationMutate; + }): Promise; /** * 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. @@ -4425,15 +6104,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + relatedTableId: string, + type: RelationshipType, + twoWay?: boolean, + key?: string, + twoWayKey?: string, + onDelete?: RelationMutate, + ): Promise; + 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 { - 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 }; + 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, @@ -4443,10 +6172,10 @@ export class TablesDB { twoWay: rest[3] as boolean, key: rest[4] as string, twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate + onDelete: rest[6] as RelationMutate, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const relatedTableId = params.relatedTableId; @@ -4455,59 +6184,61 @@ export class TablesDB { const key = params.key; const twoWayKey = params.twoWayKey; const onDelete = params.onDelete; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof relatedTableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedTableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof relatedTableId !== 'undefined') { - payload['relatedTableId'] = relatedTableId; + apiPayload['relatedTableId'] = relatedTableId; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; + apiPayload['twoWay'] = twoWay; } if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; + apiPayload['twoWayKey'] = twoWayKey; } if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; + apiPayload['onDelete'] = onDelete; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -4521,10 +6252,19 @@ export class TablesDB { * @returns {Promise} * @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; + createStringColumn(params: { + databaseId: string; + tableId: string; + key: string; + size: number; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -4538,15 +6278,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + size: number, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -4556,10 +6346,10 @@ export class TablesDB { required: rest[3] as boolean, xdefault: rest[4] as string, array: rest[5] as boolean, - encrypt: rest[6] as boolean + encrypt: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -4568,12 +6358,15 @@ export class TablesDB { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -4582,48 +6375,46 @@ export class TablesDB { 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -4636,10 +6427,18 @@ export class TablesDB { * @returns {Promise} * @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; + updateStringColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + size?: number; + newKey?: string; + }): Promise; /** * 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). @@ -4652,15 +6451,53 @@ export class TablesDB { * @returns {Promise} * @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; updateStringColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + size?: number, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -4669,10 +6506,10 @@ export class TablesDB { required: rest[2] as boolean, xdefault: rest[3] as string, size: rest[4] as number, - newKey: rest[5] as string + newKey: rest[5] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -4680,56 +6517,61 @@ export class TablesDB { const xdefault = params.xdefault; const size = params.size; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -4741,10 +6583,18 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createTextColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -4757,15 +6607,53 @@ export class TablesDB { * @returns {Promise} * @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; createTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -4774,10 +6662,10 @@ export class TablesDB { required: rest[2] as boolean, xdefault: rest[3] as string, array: rest[4] as boolean, - encrypt: rest[5] as boolean + encrypt: rest[5] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -4785,56 +6673,57 @@ export class TablesDB { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -4845,10 +6734,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateTextColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * 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). @@ -4860,15 +6756,49 @@ export class TablesDB { * @returns {Promise} * @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; updateTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateTextColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -4876,63 +6806,68 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * Create a URL column. - * + * * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. @@ -4943,10 +6878,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise; + createUrlColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + }): Promise; /** * Create a URL column. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -4958,15 +6900,49 @@ export class TablesDB { * @returns {Promise} * @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; createUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + array?: boolean, + ): Promise; + createUrlColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + array?: boolean; + } + | string, + ...rest: [string?, string?, boolean?, string?, boolean?] ): Promise { - 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 }; + 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, @@ -4974,63 +6950,64 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - array: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -5041,10 +7018,17 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise; + updateUrlColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + }): Promise; /** * Update an url column. Changing the `default` value will not update already existing rows. - * + * * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. @@ -5056,15 +7040,49 @@ export class TablesDB { * @returns {Promise} * @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; updateUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + newKey?: string, + ): Promise; + updateUrlColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + newKey?: string; + } + | string, + ...rest: [string?, string?, boolean?, string?, string?] ): Promise { - 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 }; + 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, @@ -5072,63 +7090,68 @@ export class TablesDB { key: rest[1] as string, required: rest[2] as boolean, xdefault: rest[3] as string, - newKey: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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). @@ -5141,10 +7164,19 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise; + createVarcharColumn(params: { + databaseId: string; + tableId: string; + key: string; + size: number; + required: boolean; + xdefault?: string; + array?: boolean; + encrypt?: boolean; + }): Promise; /** * 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). @@ -5158,15 +7190,65 @@ export class TablesDB { * @returns {Promise} * @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; 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)?] + databaseId: string, + tableId: string, + key: string, + size: number, + required: boolean, + xdefault?: string, + array?: boolean, + encrypt?: boolean, + ): Promise; + 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 { - 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 }; + 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, @@ -5176,10 +7258,10 @@ export class TablesDB { required: rest[3] as boolean, xdefault: rest[4] as string, array: rest[5] as boolean, - encrypt: rest[6] as boolean + encrypt: rest[6] as boolean, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -5188,12 +7270,15 @@ export class TablesDB { const xdefault = params.xdefault; const array = params.array; const encrypt = params.encrypt; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -5202,48 +7287,47 @@ export class TablesDB { 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "required"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof array !== 'undefined') { - payload['array'] = array; + apiPayload['array'] = array; } if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; + apiPayload['encrypt'] = encrypt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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). @@ -5255,10 +7339,18 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateVarcharColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise; + updateVarcharColumn(params: { + databaseId: string; + tableId: string; + key: string; + required: boolean; + xdefault?: string; + size?: number; + newKey?: string; + }): Promise; /** * 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). @@ -5271,15 +7363,53 @@ export class TablesDB { * @returns {Promise} * @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; updateVarcharColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + databaseId: string, + tableId: string, + key: string, + required: boolean, + xdefault?: string, + size?: number, + newKey?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -5288,10 +7418,10 @@ export class TablesDB { required: rest[2] as boolean, xdefault: rest[3] as string, size: rest[4] as number, - newKey: rest[5] as string + newKey: rest[5] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -5299,51 +7429,56 @@ export class TablesDB { const xdefault = params.xdefault; const size = params.size; const newKey = params.newKey; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "xdefault"', + ); + } + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof required !== 'undefined') { - payload['required'] = required; + apiPayload['required'] = required; } if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; + apiPayload['default'] = xdefault; } if (typeof size !== 'undefined') { - payload['size'] = size; + apiPayload['size'] = size; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5355,7 +7490,22 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getColumn(params: { databaseId: string, tableId: string, key: string }): Promise; + 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. * @@ -5366,52 +7516,87 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getColumn(databaseId: string, tableId: string, key: string): Promise; getColumn( - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5423,7 +7608,11 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + deleteColumn(params: { + databaseId: string; + tableId: string; + key: string; + }): Promise<{}>; /** * Deletes a column. * @@ -5436,55 +7625,64 @@ export class TablesDB { */ deleteColumn(databaseId: string, tableId: string, key: string): Promise<{}>; deleteColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** * 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. @@ -5494,10 +7692,16 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateRelationshipColumn(params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; + updateRelationshipColumn(params: { + databaseId: string; + tableId: string; + key: string; + onDelete?: RelationMutate; + newKey?: string; + }): Promise; /** * 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. @@ -5508,63 +7712,94 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRelationshipColumn(databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; updateRelationshipColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + databaseId: string, + tableId: string, + key: string, + onDelete?: RelationMutate, + newKey?: string, + ): Promise; + updateRelationshipColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + key: string; + onDelete?: RelationMutate; + newKey?: string; + } + | string, + ...rest: [string?, string?, RelationMutate?, string?] ): Promise { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; + apiPayload['onDelete'] = onDelete; } if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; + apiPayload['newKey'] = newKey; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -5577,7 +7812,12 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise; + listIndexes(params: { + databaseId: string; + tableId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List indexes on the table. * @@ -5589,57 +7829,82 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIndexes(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise; listIndexes( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] + databaseId: string, + tableId: string, + queries?: string[], + total?: boolean, + ): Promise; + listIndexes( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + queries?: string[]; + total?: boolean; + } + | string, + ...rest: [string?, string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5656,7 +7921,15 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createIndex(params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise; + createIndex(params: { + databaseId: string; + tableId: string; + key: string; + type: TablesDBIndexType; + columns: string[]; + orders?: OrderBy[]; + lengths?: number[]; + }): Promise; /** * 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`. @@ -5672,15 +7945,60 @@ export class TablesDB { * @returns {Promise} * @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; createIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (TablesDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?] + databaseId: string, + tableId: string, + key: string, + type: TablesDBIndexType, + columns: string[], + orders?: OrderBy[], + lengths?: number[], + ): Promise; + 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 { - 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[] }; + 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, @@ -5689,10 +8007,10 @@ export class TablesDB { type: rest[2] as TablesDBIndexType, columns: rest[3] as string[], orders: rest[4] as OrderBy[], - lengths: rest[5] as number[] + lengths: rest[5] as number[], }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const key = params.key; @@ -5700,12 +8018,15 @@ export class TablesDB { const columns = params.columns; const orders = params.orders; const lengths = params.lengths; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); @@ -5714,40 +8035,38 @@ export class TablesDB { 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "columns"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof key !== 'undefined') { - payload['key'] = key; + apiPayload['key'] = key; } if (typeof type !== 'undefined') { - payload['type'] = type; + apiPayload['type'] = type; } if (typeof columns !== 'undefined') { - payload['columns'] = columns; + apiPayload['columns'] = columns; } if (typeof orders !== 'undefined') { - payload['orders'] = orders; + apiPayload['orders'] = orders; } if (typeof lengths !== 'undefined') { - payload['lengths'] = lengths; + apiPayload['lengths'] = lengths; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -5759,7 +8078,11 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getIndex(params: { databaseId: string, tableId: string, key: string }): Promise; + getIndex(params: { + databaseId: string; + tableId: string; + key: string; + }): Promise; /** * Get index by ID. * @@ -5770,52 +8093,65 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getIndex(databaseId: string, tableId: string, key: string): Promise; getIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] + databaseId: string, + tableId: string, + key: string, + ): Promise; + getIndex( + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5827,7 +8163,11 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteIndex(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + deleteIndex(params: { + databaseId: string; + tableId: string; + key: string; + }): Promise<{}>; /** * Delete an index. * @@ -5840,50 +8180,59 @@ export class TablesDB { */ deleteIndex(databaseId: string, tableId: string, key: string): Promise<{}>; deleteIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] + 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{key}', encodeURIComponent(String(key))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -5898,7 +8247,14 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; + listRows(params: { + databaseId: string; + tableId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + }): Promise>; /** * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * @@ -5912,15 +8268,49 @@ export class TablesDB { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listRows( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] + databaseId: string, + tableId: string, + queries?: string[], + transactionId?: string, + total?: boolean, + ttl?: number, + ): Promise>; + listRows( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + } + | string, + ...rest: [string?, string[]?, string?, boolean?, number?] ): Promise> { - 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 }; + 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, @@ -5928,51 +8318,50 @@ export class TablesDB { queries: rest[1] as string[], transactionId: rest[2] as string, total: rest[3] as boolean, - ttl: rest[4] as number + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; + apiPayload['ttl'] = ttl; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -5987,7 +8376,16 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - createRow(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string }): Promise; + createRow(params: { + databaseId: string; + tableId: string; + rowId: string; + data: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Omit; + permissions?: string[]; + transactionId?: string; + }): Promise; /** * 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. * @@ -6001,38 +8399,93 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createRow(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string): Promise; createRow( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial & Record : Partial & Omit, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial & Record : Partial & Omit)?, (string[])?, (string)?] + databaseId: string, + tableId: string, + rowId: string, + data: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Omit, + permissions?: string[], + transactionId?: string, + ): Promise; + createRow( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rowId: string; + data: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Omit; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Row extends Models.DefaultRow + ? Partial & Record + : Partial & Omit)?, + string[]?, + string?, + ] ): Promise { - let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial & Record : Partial & Omit, 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 & Record : Partial & Omit, permissions?: string[], transactionId?: string }; + let params: { + databaseId: string; + tableId: string; + rowId: string; + data: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Omit; + 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 & Record + : Partial & Omit; + 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 & Record : Partial & Omit, + data: rest[2] as Row extends Models.DefaultRow + ? Partial & Record + : Partial & Omit, permissions: rest[3] as string[], - transactionId: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof rowId === 'undefined') { throw new AppwriteException('Missing required parameter: "rowId"'); @@ -6040,35 +8493,31 @@ export class TablesDB { if (typeof data === 'undefined') { throw new AppwriteException('Missing required parameter: "data"'); } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof rowId !== 'undefined') { - payload['rowId'] = rowId; + apiPayload['rowId'] = rowId; } if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -6081,7 +8530,12 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - createRows(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise>; + createRows(params: { + databaseId: string; + tableId: string; + rows: object[]; + 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. * @@ -6093,66 +8547,91 @@ export class TablesDB { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createRows(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise>; createRows( - paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] + databaseId: string, + tableId: string, + rows: object[], + transactionId?: string, + ): Promise>; + createRows( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rows: object[]; + transactionId?: string; + } + | string, + ...rest: [string?, object[]?, string?] ): Promise> { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof rows !== 'undefined') { - payload['rows'] = rows; + apiPayload['rows'] = rows; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** * 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. @@ -6161,10 +8640,15 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - upsertRows(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise>; + upsertRows(params: { + databaseId: string; + tableId: string; + rows: object[]; + transactionId?: string; + }): Promise>; /** * 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. @@ -6174,61 +8658,86 @@ export class TablesDB { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertRows(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise>; upsertRows( - paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] + databaseId: string, + tableId: string, + rows: object[], + transactionId?: string, + ): Promise>; + upsertRows( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rows: object[]; + transactionId?: string; + } + | string, + ...rest: [string?, object[]?, string?] ): Promise> { - 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 }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof rows !== 'undefined') { - payload['rows'] = rows; + apiPayload['rows'] = rows; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -6242,7 +8751,13 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - updateRows(params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise>; + updateRows(params: { + databaseId: string; + tableId: string; + data?: object; + queries?: string[]; + transactionId?: string; + }): Promise>; /** * 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. * @@ -6255,63 +8770,92 @@ export class TablesDB { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRows(databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string): Promise>; updateRows( - paramsOrFirst: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (object)?, (string[])?, (string)?] + databaseId: string, + tableId: string, + data?: object, + queries?: string[], + transactionId?: string, + ): Promise>; + updateRows( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + data?: object; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, object?, string[]?, string?] ): Promise> { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6324,7 +8868,12 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise>} */ - deleteRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise>; + deleteRows(params: { + databaseId: string; + tableId: string; + queries?: string[]; + transactionId?: string; + }): Promise>; /** * Bulk delete rows using queries, if no queries are passed then all rows are deleted. * @@ -6336,58 +8885,83 @@ export class TablesDB { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise>; deleteRows( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] + databaseId: string, + tableId: string, + queries?: string[], + transactionId?: string, + ): Promise>; + deleteRows( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string[]?, string?] ): Promise> { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); + } + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -6401,7 +8975,13 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - getRow(params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }): Promise; + getRow(params: { + databaseId: string; + tableId: string; + rowId: string; + queries?: string[]; + transactionId?: string; + }): Promise; /** * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. * @@ -6414,62 +8994,92 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getRow(databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string): Promise; getRow( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?] + databaseId: string, + tableId: string, + rowId: string, + queries?: string[], + transactionId?: string, + ): Promise; + getRow( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rowId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string[]?, string?] ): Promise { - let params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }; + let params: { + databaseId: string; + tableId: string; + rowId: string; + queries?: string[]; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + tableId: string; + rowId: string; + queries?: string[]; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, rowId: rest[1] as string, queries: rest[2] as string[], - transactionId: rest[3] as string + transactionId: rest[3] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const rowId = params.rowId; const queries = params.queries; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof rowId === 'undefined') { throw new AppwriteException('Missing required parameter: "rowId"'); } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{rowId}', encodeURIComponent(String(rowId))); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -6484,7 +9094,16 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - upsertRow(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + upsertRow(params: { + databaseId: string; + tableId: string; + rowId: string; + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; /** * Create or update a 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. * @@ -6498,68 +9117,123 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertRow(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string): Promise; upsertRow( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>)?, (string[])?, (string)?] + databaseId: string, + tableId: string, + rowId: string, + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + upsertRow( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rowId: string; + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>)?, + string[]?, + string?, + ] ): Promise { - let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, 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 & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; + let params: { + databaseId: string; + tableId: string; + rowId: string; + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record : Partial & Partial>, + data: rest[2] as Row extends Models.DefaultRow + ? Partial & Record + : Partial & + Partial>, permissions: rest[3] as string[], - transactionId: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof rowId === 'undefined') { throw new AppwriteException('Missing required parameter: "rowId"'); } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{rowId}', encodeURIComponent(String(rowId))); + const apiPayload: Payload = {}; if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -6574,7 +9248,16 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - updateRow(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string }): Promise; + updateRow(params: { + databaseId: string; + tableId: string; + rowId: string; + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; /** * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -6588,68 +9271,123 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRow(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string): Promise; updateRow( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>)?, (string[])?, (string)?] + databaseId: string, + tableId: string, + rowId: string, + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + updateRow( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rowId: string; + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>)?, + string[]?, + string?, + ] ): Promise { - let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial & Record : Partial & Partial>, 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 & Record : Partial & Partial>, permissions?: string[], transactionId?: string }; + let params: { + databaseId: string; + tableId: string; + rowId: string; + data?: Row extends Models.DefaultRow + ? Partial & Record + : Partial & Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record : Partial & Partial>, + data: rest[2] as Row extends Models.DefaultRow + ? Partial & Record + : Partial & + Partial>, permissions: rest[3] as string[], - transactionId: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof rowId === 'undefined') { throw new AppwriteException('Missing required parameter: "rowId"'); } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{rowId}', encodeURIComponent(String(rowId))); + const apiPayload: Payload = {}; if (typeof data !== 'undefined') { - payload['data'] = data; + apiPayload['data'] = data; } if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; + apiPayload['permissions'] = permissions; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6662,7 +9400,12 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteRow(params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }): Promise<{}>; + deleteRow(params: { + databaseId: string; + tableId: string; + rowId: string; + transactionId?: string; + }): Promise<{}>; /** * Delete a row by its unique ID. * @@ -6674,57 +9417,83 @@ export class TablesDB { * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteRow(databaseId: string, tableId: string, rowId: string, transactionId?: string): Promise<{}>; deleteRow( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + databaseId: string, + tableId: string, + rowId: string, + transactionId?: string, + ): Promise<{}>; + deleteRow( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rowId: string; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?] ): Promise<{}> { - let params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, transactionId?: string }; + let params: { + databaseId: string; + tableId: string; + rowId: string; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + tableId: string; + rowId: string; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, rowId: rest[1] as string, - transactionId: rest[2] as string + transactionId: rest[2] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const rowId = params.rowId; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof rowId === 'undefined') { throw new AppwriteException('Missing required parameter: "rowId"'); } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))); - const payload: Payload = {}; + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{rowId}', encodeURIComponent(String(rowId))); + const apiPayload: Payload = {}; if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -6740,7 +9509,15 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - decrementRowColumn(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }): Promise; + decrementRowColumn(params: { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + min?: number; + transactionId?: string; + }): Promise; /** * Decrement a specific column of a row by a given value. * @@ -6755,15 +9532,53 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - decrementRowColumn(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string): Promise; decrementRowColumn( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + databaseId: string, + tableId: string, + rowId: string, + column: string, + value?: number, + min?: number, + transactionId?: string, + ): Promise; + decrementRowColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + min?: number; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?, number?, number?, string?] ): Promise { - let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }; + let params: { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + min?: number; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + min?: number; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -6772,10 +9587,10 @@ export class TablesDB { column: rest[2] as string, value: rest[3] as number, min: rest[4] as number, - transactionId: rest[5] as string + transactionId: rest[5] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const rowId = params.rowId; @@ -6783,12 +9598,15 @@ export class TablesDB { const value = params.value; const min = params.min; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof rowId === 'undefined') { throw new AppwriteException('Missing required parameter: "rowId"'); @@ -6796,32 +9614,31 @@ export class TablesDB { if (typeof column === 'undefined') { throw new AppwriteException('Missing required parameter: "column"'); } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))).replace('{column}', encodeURIComponent(String(column))); - const payload: Payload = {}; + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{rowId}', encodeURIComponent(String(rowId))) + .replace('{column}', encodeURIComponent(String(column))); + const apiPayload: Payload = {}; if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof min !== 'undefined') { - payload['min'] = min; + apiPayload['min'] = min; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -6837,7 +9654,15 @@ export class TablesDB { * @throws {AppwriteException} * @returns {Promise} */ - incrementRowColumn(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }): Promise; + incrementRowColumn(params: { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + max?: number; + transactionId?: string; + }): Promise; /** * Increment a specific column of a row by a given value. * @@ -6852,15 +9677,53 @@ export class TablesDB { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - incrementRowColumn(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string): Promise; incrementRowColumn( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + databaseId: string, + tableId: string, + rowId: string, + column: string, + value?: number, + max?: number, + transactionId?: string, + ): Promise; + incrementRowColumn( + paramsOrFirst: + | { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + max?: number; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?, number?, number?, string?] ): Promise { - let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }; + let params: { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + max?: number; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + tableId: string; + rowId: string; + column: string; + value?: number; + max?: number; + transactionId?: string; + }; } else { params = { databaseId: paramsOrFirst as string, @@ -6869,10 +9732,10 @@ export class TablesDB { column: rest[2] as string, value: rest[3] as number, max: rest[4] as number, - transactionId: rest[5] as string + transactionId: rest[5] as string, }; } - + const databaseId = params.databaseId; const tableId = params.tableId; const rowId = params.rowId; @@ -6880,12 +9743,15 @@ export class TablesDB { const value = params.value; const max = params.max; const transactionId = params.transactionId; - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); } if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); + throw new AppwriteException( + 'Missing required parameter: "tableId"', + ); } if (typeof rowId === 'undefined') { throw new AppwriteException('Missing required parameter: "rowId"'); @@ -6893,31 +9759,30 @@ export class TablesDB { if (typeof column === 'undefined') { throw new AppwriteException('Missing required parameter: "column"'); } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', encodeURIComponent(String(databaseId))).replace('{tableId}', encodeURIComponent(String(tableId))).replace('{rowId}', encodeURIComponent(String(rowId))).replace('{column}', encodeURIComponent(String(column))); - const payload: Payload = {}; + const apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace('{tableId}', encodeURIComponent(String(tableId))) + .replace('{rowId}', encodeURIComponent(String(rowId))) + .replace('{column}', encodeURIComponent(String(column))); + const apiPayload: Payload = {}; if (typeof value !== 'undefined') { - payload['value'] = value; + apiPayload['value'] = value; } if (typeof max !== 'undefined') { - payload['max'] = max; + apiPayload['max'] = max; } if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + apiPayload['transactionId'] = transactionId; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } } diff --git a/src/services/teams.ts b/src/services/teams.ts index a194b2a..f2ea276 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Teams { client: Client; @@ -19,7 +17,13 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; + list< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise>; /** * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. * @@ -30,52 +34,59 @@ export class Teams { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise>; list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise>; + list( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise> { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/teams'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -87,7 +98,13 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - create(params: { teamId: string, name: string, roles?: string[] }): Promise>; + create< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + teamId: string; + name: string; + roles?: string[]; + }): Promise>; /** * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. * @@ -98,59 +115,65 @@ export class Teams { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(teamId: string, name: string, roles?: string[]): Promise>; create( - paramsOrFirst: { teamId: string, name: string, roles?: string[] } | string, - ...rest: [(string)?, (string[])?] + teamId: string, + name: string, + roles?: string[], + ): Promise>; + create( + paramsOrFirst: + { teamId: string; name: string; roles?: string[] } | string, + ...rest: [string?, string[]?] ): Promise> { - let params: { teamId: string, name: string, roles?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, name: string, roles?: string[] }; + let params: { teamId: string; name: string; roles?: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + name: string; + roles?: string[]; + }; } else { params = { teamId: paramsOrFirst as string, name: rest[0] as string, - roles: rest[1] as string[] + roles: rest[1] as string[], }; } - + const teamId = params.teamId; const name = params.name; const roles = params.roles; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - const apiPath = '/teams'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; + apiPayload['teamId'] = teamId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof roles !== 'undefined') { - payload['roles'] = roles; + apiPayload['roles'] = roles; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -160,7 +183,9 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - get(params: { teamId: string }): Promise>; + get< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { teamId: string }): Promise>; /** * Get a team by its ID. All team members have read access for this resource. * @@ -169,41 +194,43 @@ export class Teams { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - get(teamId: string): Promise>; get( - paramsOrFirst: { teamId: string } | string + teamId: string, + ): Promise>; + get( + paramsOrFirst: { teamId: string } | string, ): Promise> { let params: { teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { teamId: string }; } else { params = { - teamId: paramsOrFirst as string + teamId: paramsOrFirst as string, }; } - - const teamId = params.teamId; + const teamId = params.teamId; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - - const apiPath = '/teams/{teamId}'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -214,7 +241,12 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(params: { teamId: string, name: string }): Promise>; + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + teamId: string; + name: string; + }): Promise>; /** * Update the team's name by its unique ID. * @@ -224,51 +256,55 @@ export class Teams { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateName(teamId: string, name: string): Promise>; - updateName( - paramsOrFirst: { teamId: string, name: string } | string, - ...rest: [(string)?] + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(teamId: string, name: string): Promise>; + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { teamId: string; name: string } | string, + ...rest: [string?] ): Promise> { - let params: { teamId: string, name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, name: string }; + let params: { teamId: string; name: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { teamId: string; name: string }; } else { params = { teamId: paramsOrFirst as string, - name: rest[0] as string + name: rest[0] as string, }; } - + const teamId = params.teamId; const name = params.name; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } - - const apiPath = '/teams/{teamId}'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -288,40 +324,38 @@ export class Teams { * @deprecated Use the object parameter style method for a better developer experience. */ delete(teamId: string): Promise<{}>; - delete( - paramsOrFirst: { teamId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { teamId: string } | string): Promise<{}> { let params: { teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { teamId: string }; } else { params = { - teamId: paramsOrFirst as string + teamId: paramsOrFirst as string, }; } - - const teamId = params.teamId; + const teamId = params.teamId; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - - const apiPath = '/teams/{teamId}'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -333,7 +367,11 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - listInstallations(params: { teamId: string, queries?: string[], total?: boolean }): Promise; + listInstallations(params: { + teamId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List app installations on a team. Any team member can read installations. * @@ -344,52 +382,61 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listInstallations(teamId: string, queries?: string[], total?: boolean): Promise; listInstallations( - paramsOrFirst: { teamId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + teamId: string, + queries?: string[], + total?: boolean, + ): Promise; + listInstallations( + paramsOrFirst: + { teamId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - let params: { teamId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], total?: boolean }; + let params: { teamId: string; queries?: string[]; total?: boolean }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + queries?: string[]; + total?: boolean; + }; } else { params = { teamId: paramsOrFirst as string, queries: rest[0] as string[], - total: rest[1] as boolean + total: rest[1] as boolean, }; } - + const teamId = params.teamId; const queries = params.queries; const total = params.total; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - - const apiPath = '/teams/{teamId}/installations'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/installations'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -401,7 +448,11 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - createInstallation(params: { teamId: string, appId: string, authorizationDetails?: string }): Promise; + createInstallation(params: { + teamId: string; + appId: string; + authorizationDetails?: string; + }): Promise; /** * Install an app on a team. When authenticated as a user, only team members with the owner role can install apps. Requests using an API key or in admin mode can install apps on any team. The installation is granted the scopes the app currently requests. * @@ -412,56 +463,70 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createInstallation(teamId: string, appId: string, authorizationDetails?: string): Promise; createInstallation( - paramsOrFirst: { teamId: string, appId: string, authorizationDetails?: string } | string, - ...rest: [(string)?, (string)?] + teamId: string, + appId: string, + authorizationDetails?: string, + ): Promise; + createInstallation( + paramsOrFirst: + | { teamId: string; appId: string; authorizationDetails?: string } + | string, + ...rest: [string?, string?] ): Promise { - let params: { teamId: string, appId: string, authorizationDetails?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, appId: string, authorizationDetails?: string }; + let params: { + teamId: string; + appId: string; + authorizationDetails?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + appId: string; + authorizationDetails?: string; + }; } else { params = { teamId: paramsOrFirst as string, appId: rest[0] as string, - authorizationDetails: rest[1] as string + authorizationDetails: rest[1] as string, }; } - + const teamId = params.teamId; const appId = params.appId; const authorizationDetails = params.authorizationDetails; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof appId === 'undefined') { throw new AppwriteException('Missing required parameter: "appId"'); } - - const apiPath = '/teams/{teamId}/installations'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/installations'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; if (typeof appId !== 'undefined') { - payload['appId'] = appId; + apiPayload['appId'] = appId; } if (typeof authorizationDetails !== 'undefined') { - payload['authorizationDetails'] = authorizationDetails; + apiPayload['authorizationDetails'] = authorizationDetails; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -472,7 +537,10 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - getInstallation(params: { teamId: string, installationId: string }): Promise; + getInstallation(params: { + teamId: string; + installationId: string; + }): Promise; /** * Get an app installation on a team by its unique ID. Any team member can read installations. * @@ -482,47 +550,57 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getInstallation(teamId: string, installationId: string): Promise; getInstallation( - paramsOrFirst: { teamId: string, installationId: string } | string, - ...rest: [(string)?] + teamId: string, + installationId: string, + ): Promise; + getInstallation( + paramsOrFirst: { teamId: string; installationId: string } | string, + ...rest: [string?] ): Promise { - let params: { teamId: string, installationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, installationId: string }; + let params: { teamId: string; installationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + installationId: string; + }; } else { params = { teamId: paramsOrFirst as string, - installationId: rest[0] as string + installationId: rest[0] as string, }; } - + const teamId = params.teamId; const installationId = params.installationId; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); - } - - const apiPath = '/teams/{teamId}/installations/{installationId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); + } + const apiPath = '/teams/{teamId}/installations/{installationId}' + .replace('{teamId}', encodeURIComponent(String(teamId))) + .replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -534,7 +612,11 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - updateInstallation(params: { teamId: string, installationId: string, authorizationDetails?: string }): Promise; + updateInstallation(params: { + teamId: string; + installationId: string; + authorizationDetails?: string; + }): Promise; /** * Update an app installation on a team. Only team members with the owner role can update installations. The installation's granted scopes are refreshed to the scopes the app currently requests; previously issued installation access tokens are revoked. * @@ -545,53 +627,75 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateInstallation(teamId: string, installationId: string, authorizationDetails?: string): Promise; updateInstallation( - paramsOrFirst: { teamId: string, installationId: string, authorizationDetails?: string } | string, - ...rest: [(string)?, (string)?] + teamId: string, + installationId: string, + authorizationDetails?: string, + ): Promise; + updateInstallation( + paramsOrFirst: + | { + teamId: string; + installationId: string; + authorizationDetails?: string; + } + | string, + ...rest: [string?, string?] ): Promise { - let params: { teamId: string, installationId: string, authorizationDetails?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, installationId: string, authorizationDetails?: string }; + let params: { + teamId: string; + installationId: string; + authorizationDetails?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + installationId: string; + authorizationDetails?: string; + }; } else { params = { teamId: paramsOrFirst as string, installationId: rest[0] as string, - authorizationDetails: rest[1] as string + authorizationDetails: rest[1] as string, }; } - + const teamId = params.teamId; const installationId = params.installationId; const authorizationDetails = params.authorizationDetails; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); - } - - const apiPath = '/teams/{teamId}/installations/{installationId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); + } + const apiPath = '/teams/{teamId}/installations/{installationId}' + .replace('{teamId}', encodeURIComponent(String(teamId))) + .replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; if (typeof authorizationDetails !== 'undefined') { - payload['authorizationDetails'] = authorizationDetails; + apiPayload['authorizationDetails'] = authorizationDetails; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -602,7 +706,10 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteInstallation(params: { teamId: string, installationId: string }): Promise<{}>; + deleteInstallation(params: { + teamId: string; + installationId: string; + }): Promise<{}>; /** * Uninstall an app from a team by its installation ID. Only team members with the owner role can remove installations. Previously issued installation access tokens are revoked. * @@ -614,46 +721,53 @@ export class Teams { */ deleteInstallation(teamId: string, installationId: string): Promise<{}>; deleteInstallation( - paramsOrFirst: { teamId: string, installationId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { teamId: string; installationId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { teamId: string, installationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, installationId: string }; + let params: { teamId: string; installationId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + installationId: string; + }; } else { params = { teamId: paramsOrFirst as string, - installationId: rest[0] as string + installationId: rest[0] as string, }; } - + const teamId = params.teamId; const installationId = params.installationId; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); - } - - const apiPath = '/teams/{teamId}/installations/{installationId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{installationId}', encodeURIComponent(String(installationId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "installationId"', + ); + } + const apiPath = '/teams/{teamId}/installations/{installationId}' + .replace('{teamId}', encodeURIComponent(String(teamId))) + .replace( + '{installationId}', + encodeURIComponent(String(installationId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -666,7 +780,12 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - listMemberships(params: { teamId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listMemberships(params: { + teamId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. * @@ -678,68 +797,90 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMemberships(teamId: string, queries?: string[], search?: string, total?: boolean): Promise; listMemberships( - paramsOrFirst: { teamId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + teamId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listMemberships( + paramsOrFirst: + | { + teamId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - let params: { teamId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], search?: string, total?: boolean }; + let params: { + teamId: string; + queries?: string[]; + search?: string; + total?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + queries?: string[]; + search?: string; + total?: boolean; + }; } else { params = { teamId: paramsOrFirst as string, queries: rest[0] as string[], search: rest[1] as string, - total: rest[2] as boolean + total: rest[2] as boolean, }; } - + const teamId = params.teamId; const queries = params.queries; const search = params.search; const total = params.total; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - - const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/memberships'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. - * + * * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. - * - * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. - * + * + * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + * * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - * + * * * @param {string} params.teamId - Team ID. * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. @@ -751,16 +892,24 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - createMembership(params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise; + createMembership(params: { + teamId: string; + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + }): Promise; /** * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. - * + * * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. - * - * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. - * + * + * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + * * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - * + * * * @param {string} teamId - Team ID. * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. @@ -773,15 +922,53 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise; createMembership( - paramsOrFirst: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string, - ...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (string)?] + teamId: string, + roles: string[], + email?: string, + userId?: string, + phone?: string, + url?: string, + name?: string, + ): Promise; + createMembership( + paramsOrFirst: + | { + teamId: string; + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + } + | string, + ...rest: [string[]?, string?, string?, string?, string?, string?] ): Promise { - let params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + let params: { + teamId: string; + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + roles: string[]; + email?: string; + userId?: string; + phone?: string; + url?: string; + name?: string; + }; } else { params = { teamId: paramsOrFirst as string, @@ -790,10 +977,10 @@ export class Teams { userId: rest[2] as string, phone: rest[3] as string, url: rest[4] as string, - name: rest[5] as string + name: rest[5] as string, }; } - + const teamId = params.teamId; const roles = params.roles; const email = params.email; @@ -801,48 +988,44 @@ export class Teams { const phone = params.phone; const url = params.url; const name = params.name; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof roles === 'undefined') { throw new AppwriteException('Missing required parameter: "roles"'); } - - const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/memberships'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof phone !== 'undefined') { - payload['phone'] = phone; + apiPayload['phone'] = phone; } if (typeof roles !== 'undefined') { - payload['roles'] = roles; + apiPayload['roles'] = roles; } if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -853,7 +1036,10 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - getMembership(params: { teamId: string, membershipId: string }): Promise; + getMembership(params: { + teamId: string; + membershipId: string; + }): Promise; /** * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. * @@ -863,52 +1049,62 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getMembership(teamId: string, membershipId: string): Promise; getMembership( - paramsOrFirst: { teamId: string, membershipId: string } | string, - ...rest: [(string)?] + teamId: string, + membershipId: string, + ): Promise; + getMembership( + paramsOrFirst: { teamId: string; membershipId: string } | string, + ...rest: [string?] ): Promise { - let params: { teamId: string, membershipId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string }; + let params: { teamId: string; membershipId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + membershipId: string; + }; } else { params = { teamId: paramsOrFirst as string, - membershipId: rest[0] as string + membershipId: rest[0] as string, }; } - + const teamId = params.teamId; const membershipId = params.membershipId; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "membershipId"', + ); + } + const apiPath = '/teams/{teamId}/memberships/{membershipId}' + .replace('{teamId}', encodeURIComponent(String(teamId))) + .replace( + '{membershipId}', + encodeURIComponent(String(membershipId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - * + * * * @param {string} params.teamId - Team ID. * @param {string} params.membershipId - Membership ID. @@ -916,10 +1112,14 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - updateMembership(params: { teamId: string, membershipId: string, roles: string[] }): Promise; + updateMembership(params: { + teamId: string; + membershipId: string; + roles: string[]; + }): Promise; /** * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - * + * * * @param {string} teamId - Team ID. * @param {string} membershipId - Membership ID. @@ -928,56 +1128,69 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMembership(teamId: string, membershipId: string, roles: string[]): Promise; updateMembership( - paramsOrFirst: { teamId: string, membershipId: string, roles: string[] } | string, - ...rest: [(string)?, (string[])?] + teamId: string, + membershipId: string, + roles: string[], + ): Promise; + updateMembership( + paramsOrFirst: + { teamId: string; membershipId: string; roles: string[] } | string, + ...rest: [string?, string[]?] ): Promise { - let params: { teamId: string, membershipId: string, roles: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: string[] }; + let params: { teamId: string; membershipId: string; roles: string[] }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + membershipId: string; + roles: string[]; + }; } else { params = { teamId: paramsOrFirst as string, membershipId: rest[0] as string, - roles: rest[1] as string[] + roles: rest[1] as string[], }; } - + const teamId = params.teamId; const membershipId = params.membershipId; const roles = params.roles; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); + throw new AppwriteException( + 'Missing required parameter: "membershipId"', + ); } if (typeof roles === 'undefined') { throw new AppwriteException('Missing required parameter: "roles"'); } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/memberships/{membershipId}' + .replace('{teamId}', encodeURIComponent(String(teamId))) + .replace( + '{membershipId}', + encodeURIComponent(String(membershipId)), + ); + const apiPayload: Payload = {}; if (typeof roles !== 'undefined') { - payload['roles'] = roles; + apiPayload['roles'] = roles; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -988,7 +1201,10 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteMembership(params: { teamId: string, membershipId: string }): Promise<{}>; + deleteMembership(params: { + teamId: string; + membershipId: string; + }): Promise<{}>; /** * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. * @@ -1000,52 +1216,59 @@ export class Teams { */ deleteMembership(teamId: string, membershipId: string): Promise<{}>; deleteMembership( - paramsOrFirst: { teamId: string, membershipId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { teamId: string; membershipId: string } | string, + ...rest: [string?] ): Promise<{}> { - let params: { teamId: string, membershipId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string }; + let params: { teamId: string; membershipId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + membershipId: string; + }; } else { params = { teamId: paramsOrFirst as string, - membershipId: rest[0] as string + membershipId: rest[0] as string, }; } - + const teamId = params.teamId; const membershipId = params.membershipId; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "membershipId"', + ); + } + const apiPath = '/teams/{teamId}/memberships/{membershipId}' + .replace('{teamId}', encodeURIComponent(String(teamId))) + .replace( + '{membershipId}', + encodeURIComponent(String(membershipId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. - * + * * If the request is successful, a session for the user is automatically created. - * + * * * @param {string} params.teamId - Team ID. * @param {string} params.membershipId - Membership ID. @@ -1054,12 +1277,17 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - updateMembershipStatus(params: { teamId: string, membershipId: string, userId: string, secret: string }): Promise; + updateMembershipStatus(params: { + teamId: string; + membershipId: string; + userId: string; + secret: string; + }): Promise; /** * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. - * + * * If the request is successful, a session for the user is automatically created. - * + * * * @param {string} teamId - Team ID. * @param {string} membershipId - Membership ID. @@ -1069,34 +1297,61 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise; updateMembershipStatus( - paramsOrFirst: { teamId: string, membershipId: string, userId: string, secret: string } | string, - ...rest: [(string)?, (string)?, (string)?] + teamId: string, + membershipId: string, + userId: string, + secret: string, + ): Promise; + updateMembershipStatus( + paramsOrFirst: + | { + teamId: string; + membershipId: string; + userId: string; + secret: string; + } + | string, + ...rest: [string?, string?, string?] ): Promise { - let params: { teamId: string, membershipId: string, userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, userId: string, secret: string }; + let params: { + teamId: string; + membershipId: string; + userId: string; + secret: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + teamId: string; + membershipId: string; + userId: string; + secret: string; + }; } else { params = { teamId: paramsOrFirst as string, membershipId: rest[0] as string, userId: rest[1] as string, - secret: rest[2] as string + secret: rest[2] as string, }; } - + const teamId = params.teamId; const membershipId = params.membershipId; const userId = params.userId; const secret = params.secret; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); + throw new AppwriteException( + 'Missing required parameter: "membershipId"', + ); } if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); @@ -1104,29 +1359,28 @@ export class Teams { if (typeof secret === 'undefined') { throw new AppwriteException('Missing required parameter: "secret"'); } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', encodeURIComponent(String(teamId))).replace('{membershipId}', encodeURIComponent(String(membershipId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/memberships/{membershipId}/status' + .replace('{teamId}', encodeURIComponent(String(teamId))) + .replace( + '{membershipId}', + encodeURIComponent(String(membershipId)), + ); + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1136,7 +1390,9 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(params: { teamId: string }): Promise; + getPrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { teamId: string }): Promise; /** * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). * @@ -1145,41 +1401,43 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPrefs(teamId: string): Promise; - getPrefs( - paramsOrFirst: { teamId: string } | string - ): Promise { + getPrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(teamId: string): Promise; + getPrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(paramsOrFirst: { teamId: string } | string): Promise { let params: { teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { teamId: string }; } else { params = { - teamId: paramsOrFirst as string + teamId: paramsOrFirst as string, }; } - - const teamId = params.teamId; + const teamId = params.teamId; if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } - - const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/prefs'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1190,7 +1448,9 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(params: { teamId: string, prefs: object }): Promise; + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { teamId: string; prefs: object }): Promise; /** * Update the team's 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 an error if exceeded. * @@ -1200,50 +1460,54 @@ export class Teams { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePrefs(teamId: string, prefs: object): Promise; - updatePrefs( - paramsOrFirst: { teamId: string, prefs: object } | string, - ...rest: [(object)?] + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(teamId: string, prefs: object): Promise; + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { teamId: string; prefs: object } | string, + ...rest: [object?] ): Promise { - let params: { teamId: string, prefs: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, prefs: object }; + let params: { teamId: string; prefs: object }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { teamId: string; prefs: object }; } else { params = { teamId: paramsOrFirst as string, - prefs: rest[0] as object + prefs: rest[0] as object, }; } - + const teamId = params.teamId; const prefs = params.prefs; - if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } if (typeof prefs === 'undefined') { throw new AppwriteException('Missing required parameter: "prefs"'); } - - const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', encodeURIComponent(String(teamId))); - const payload: Payload = {}; + const apiPath = '/teams/{teamId}/prefs'.replace( + '{teamId}', + encodeURIComponent(String(teamId)), + ); + const apiPayload: Payload = {}; if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; + apiPayload['prefs'] = prefs; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } } diff --git a/src/services/tokens.ts b/src/services/tokens.ts index f5b9cb0..fcd24db 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Tokens { client: Client; @@ -20,7 +18,12 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise} */ - list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise; + list(params: { + bucketId: string; + fileId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. * @@ -32,57 +35,80 @@ export class Tokens { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise; list( - paramsOrFirst: { bucketId: string, fileId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] + bucketId: string, + fileId: string, + queries?: string[], + total?: boolean, + ): Promise; + list( + paramsOrFirst: + | { + bucketId: string; + fileId: string; + queries?: string[]; + total?: boolean; + } + | string, + ...rest: [string?, string[]?, boolean?] ): Promise { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -94,7 +120,11 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise} */ - createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise; + createFileToken(params: { + bucketId: string; + fileId: string; + expire?: string; + }): Promise; /** * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. * @@ -105,53 +135,63 @@ export class Tokens { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createFileToken(bucketId: string, fileId: string, expire?: string): Promise; createFileToken( - paramsOrFirst: { bucketId: string, fileId: string, expire?: string } | string, - ...rest: [(string)?, (string)?] + bucketId: string, + fileId: string, + expire?: string, + ): Promise; + createFileToken( + paramsOrFirst: + { bucketId: string; fileId: string; expire?: string } | string, + ...rest: [string?, string?] ): Promise { - 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 }; + 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 + 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"'); + 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}', encodeURIComponent(String(bucketId))).replace('{fileId}', encodeURIComponent(String(fileId))); - const payload: Payload = {}; + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replace('{bucketId}', encodeURIComponent(String(bucketId))) + .replace('{fileId}', encodeURIComponent(String(fileId))); + const apiPayload: Payload = {}; if (typeof expire !== 'undefined') { - payload['expire'] = expire; + apiPayload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -172,39 +212,41 @@ export class Tokens { */ get(tokenId: string): Promise; get( - paramsOrFirst: { tokenId: string } | string + paramsOrFirst: { tokenId: string } | string, ): Promise { let params: { tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { tokenId: string }; } else { params = { - tokenId: paramsOrFirst as string + tokenId: paramsOrFirst as string, }; } - - const tokenId = params.tokenId; + const tokenId = params.tokenId; if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); + throw new AppwriteException( + 'Missing required parameter: "tokenId"', + ); } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', encodeURIComponent(String(tokenId))); - const payload: Payload = {}; + const apiPath = '/tokens/{tokenId}'.replace( + '{tokenId}', + encodeURIComponent(String(tokenId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -215,7 +257,10 @@ export class Tokens { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { tokenId: string, expire?: string }): Promise; + update(params: { + tokenId: string; + expire?: string; + }): Promise; /** * Update a token by its unique ID. Use this endpoint to update a token's expiry date. * @@ -227,46 +272,51 @@ export class Tokens { */ update(tokenId: string, expire?: string): Promise; update( - paramsOrFirst: { tokenId: string, expire?: string } | string, - ...rest: [(string)?] + paramsOrFirst: { tokenId: string; expire?: string } | string, + ...rest: [string?] ): Promise { - let params: { tokenId: string, expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { tokenId: string, expire?: string }; + 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 + expire: rest[0] as string, }; } - + const tokenId = params.tokenId; const expire = params.expire; - if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); + throw new AppwriteException( + 'Missing required parameter: "tokenId"', + ); } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', encodeURIComponent(String(tokenId))); - const payload: Payload = {}; + const apiPath = '/tokens/{tokenId}'.replace( + '{tokenId}', + encodeURIComponent(String(tokenId)), + ); + const apiPayload: Payload = {}; if (typeof expire !== 'undefined') { - payload['expire'] = expire; + apiPayload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -286,39 +336,39 @@ export class Tokens { * @deprecated Use the object parameter style method for a better developer experience. */ delete(tokenId: string): Promise<{}>; - delete( - paramsOrFirst: { tokenId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { tokenId: string } | string): Promise<{}> { let params: { tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { tokenId: string }; } else { params = { - tokenId: paramsOrFirst as string + tokenId: paramsOrFirst as string, }; } - - const tokenId = params.tokenId; + const tokenId = params.tokenId; if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); + throw new AppwriteException( + 'Missing required parameter: "tokenId"', + ); } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', encodeURIComponent(String(tokenId))); - const payload: Payload = {}; + const apiPath = '/tokens/{tokenId}'.replace( + '{tokenId}', + encodeURIComponent(String(tokenId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } } diff --git a/src/services/users.ts b/src/services/users.ts index a79375f..be306a8 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -1,11 +1,9 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, 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; @@ -22,7 +20,13 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise>; + list< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise>; /** * Get a list of all the project's users. You can use the query params to filter your results. * @@ -33,52 +37,59 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - list(queries?: string[], search?: string, total?: boolean): Promise>; list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise>; + list( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise> { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/users'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -92,7 +103,15 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - create(params: { userId: string, email?: string, phone?: string, password?: string, name?: string }): Promise>; + create< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email?: string; + phone?: string; + password?: string; + name?: string; + }): Promise>; /** * Create a new user. * @@ -105,66 +124,89 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise>; create( - paramsOrFirst: { userId: string, email?: string, phone?: string, password?: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?] + userId: string, + email?: string, + phone?: string, + password?: string, + name?: string, + ): Promise>; + create( + paramsOrFirst: + | { + userId: string; + email?: string; + phone?: string; + password?: string; + name?: string; + } + | string, + ...rest: [string?, string?, string?, string?] ): Promise> { - 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 }; + 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 + 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 = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof phone !== 'undefined') { - payload['phone'] = phone; + apiPayload['phone'] = phone; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -177,7 +219,14 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createArgon2User(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createArgon2User< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + password: string; + name?: string; + }): Promise>; /** * 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. * @@ -189,29 +238,53 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createArgon2User(userId: string, email: string, password: string, name?: string): Promise>; - createArgon2User( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + createArgon2User< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + email: string, + password: string, + name?: string, + ): Promise>; + createArgon2User< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: + | { userId: string; email: string; password: string; name?: string } + | string, + ...rest: [string?, string?, string?] ): Promise> { - 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 }; + 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 + 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"'); } @@ -219,37 +292,33 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/users/argon2'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -262,7 +331,14 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createBcryptUser(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createBcryptUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + password: string; + name?: string; + }): Promise>; /** * 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. * @@ -274,29 +350,53 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createBcryptUser(userId: string, email: string, password: string, name?: string): Promise>; - createBcryptUser( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + createBcryptUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + email: string, + password: string, + name?: string, + ): Promise>; + createBcryptUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: + | { userId: string; email: string; password: string; name?: string } + | string, + ...rest: [string?, string?, string?] ): Promise> { - 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 }; + 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 + 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"'); } @@ -304,37 +404,33 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/users/bcrypt'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -346,7 +442,11 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise; + listIdentities(params?: { + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get identities for all users. * @@ -357,52 +457,59 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listIdentities(queries?: string[], search?: string, total?: boolean): Promise; listIdentities( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listIdentities( + paramsOrFirst?: + { queries?: string[]; search?: string; total?: boolean } | string[], + ...rest: [string?, boolean?] ): Promise { - 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 }; + 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 + total: rest[1] as boolean, }; } - + const queries = params.queries; const search = params.search; const total = params.total; - - const apiPath = '/users/identities'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -423,39 +530,41 @@ export class Users { */ deleteIdentity(identityId: string): Promise<{}>; deleteIdentity( - paramsOrFirst: { identityId: string } | string + paramsOrFirst: { identityId: string } | string, ): Promise<{}> { let params: { identityId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { identityId: string }; } else { params = { - identityId: paramsOrFirst as string + identityId: paramsOrFirst as string, }; } - - const identityId = params.identityId; + const identityId = params.identityId; if (typeof identityId === 'undefined') { - throw new AppwriteException('Missing required parameter: "identityId"'); + throw new AppwriteException( + 'Missing required parameter: "identityId"', + ); } - - const apiPath = '/users/identities/{identityId}'.replace('{identityId}', encodeURIComponent(String(identityId))); - const payload: Payload = {}; + const apiPath = '/users/identities/{identityId}'.replace( + '{identityId}', + encodeURIComponent(String(identityId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -468,7 +577,14 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createMD5User(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createMD5User< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + password: string; + name?: string; + }): Promise>; /** * 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. * @@ -480,29 +596,53 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createMD5User(userId: string, email: string, password: string, name?: string): Promise>; - createMD5User( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + createMD5User< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + email: string, + password: string, + name?: string, + ): Promise>; + createMD5User< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: + | { userId: string; email: string; password: string; name?: string } + | string, + ...rest: [string?, string?, string?] ): Promise> { - 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 }; + 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 + 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"'); } @@ -510,37 +650,33 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/users/md5'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -553,7 +689,14 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createPHPassUser(params: { userId: string, email: string, password: string, name?: string }): Promise>; + createPHPassUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + password: string; + name?: string; + }): Promise>; /** * 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. * @@ -565,29 +708,53 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createPHPassUser(userId: string, email: string, password: string, name?: string): Promise>; - createPHPassUser( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] + createPHPassUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + email: string, + password: string, + name?: string, + ): Promise>; + createPHPassUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: + | { userId: string; email: string; password: string; name?: string } + | string, + ...rest: [string?, string?, string?] ): Promise> { - 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 }; + 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 + 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"'); } @@ -595,37 +762,33 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/users/phpass'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -643,7 +806,19 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptUser(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise>; + 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>; /** * 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. * @@ -660,15 +835,74 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createScryptUser(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise>; - createScryptUser( - 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)?] + 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>; + 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> { - 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 }; + 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, @@ -679,10 +913,10 @@ export class Users { passwordMemory: rest[4] as number, passwordParallel: rest[5] as number, passwordLength: rest[6] as number, - name: rest[7] as string + name: rest[7] as string, }; } - + const userId = params.userId; const email = params.email; const password = params.password; @@ -692,7 +926,6 @@ export class Users { const passwordParallel = params.passwordParallel; const passwordLength = params.passwordLength; const name = params.name; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -700,67 +933,73 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } if (typeof passwordSalt === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); + throw new AppwriteException( + 'Missing required parameter: "passwordSalt"', + ); } if (typeof passwordCpu === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordCpu"'); + throw new AppwriteException( + 'Missing required parameter: "passwordCpu"', + ); } if (typeof passwordMemory === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordMemory"'); + throw new AppwriteException( + 'Missing required parameter: "passwordMemory"', + ); } if (typeof passwordParallel === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordParallel"'); + throw new AppwriteException( + 'Missing required parameter: "passwordParallel"', + ); } if (typeof passwordLength === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordLength"'); + throw new AppwriteException( + 'Missing required parameter: "passwordLength"', + ); } - const apiPath = '/users/scrypt'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof passwordSalt !== 'undefined') { - payload['passwordSalt'] = passwordSalt; + apiPayload['passwordSalt'] = passwordSalt; } if (typeof passwordCpu !== 'undefined') { - payload['passwordCpu'] = passwordCpu; + apiPayload['passwordCpu'] = passwordCpu; } if (typeof passwordMemory !== 'undefined') { - payload['passwordMemory'] = passwordMemory; + apiPayload['passwordMemory'] = passwordMemory; } if (typeof passwordParallel !== 'undefined') { - payload['passwordParallel'] = passwordParallel; + apiPayload['passwordParallel'] = passwordParallel; } if (typeof passwordLength !== 'undefined') { - payload['passwordLength'] = passwordLength; + apiPayload['passwordLength'] = passwordLength; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -776,7 +1015,17 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptModifiedUser(params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }): Promise>; + createScryptModifiedUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + password: string; + passwordSalt: string; + passwordSaltSeparator: string; + passwordSignerKey: string; + name?: string; + }): Promise>; /** * 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. * @@ -791,15 +1040,57 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createScryptModifiedUser(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise>; - createScryptModifiedUser( - paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + createScryptModifiedUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + email: string, + password: string, + passwordSalt: string, + passwordSaltSeparator: string, + passwordSignerKey: string, + name?: string, + ): Promise>; + 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> { - 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 }; + 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, @@ -808,10 +1099,10 @@ export class Users { passwordSalt: rest[2] as string, passwordSaltSeparator: rest[3] as string, passwordSignerKey: rest[4] as string, - name: rest[5] as string + name: rest[5] as string, }; } - + const userId = params.userId; const email = params.email; const password = params.password; @@ -819,7 +1110,6 @@ export class Users { const passwordSaltSeparator = params.passwordSaltSeparator; const passwordSignerKey = params.passwordSignerKey; const name = params.name; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -827,55 +1117,57 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } if (typeof passwordSalt === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); + throw new AppwriteException( + 'Missing required parameter: "passwordSalt"', + ); } if (typeof passwordSaltSeparator === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"'); + throw new AppwriteException( + 'Missing required parameter: "passwordSaltSeparator"', + ); } if (typeof passwordSignerKey === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSignerKey"'); + throw new AppwriteException( + 'Missing required parameter: "passwordSignerKey"', + ); } - const apiPath = '/users/scrypt-modified'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof passwordSalt !== 'undefined') { - payload['passwordSalt'] = passwordSalt; + apiPayload['passwordSalt'] = passwordSalt; } if (typeof passwordSaltSeparator !== 'undefined') { - payload['passwordSaltSeparator'] = passwordSaltSeparator; + apiPayload['passwordSaltSeparator'] = passwordSaltSeparator; } if (typeof passwordSignerKey !== 'undefined') { - payload['passwordSignerKey'] = passwordSignerKey; + apiPayload['passwordSignerKey'] = passwordSignerKey; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -889,7 +1181,15 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createSHAUser(params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }): Promise>; + createSHAUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + password: string; + passwordVersion?: PasswordHash; + name?: string; + }): Promise>; /** * 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. * @@ -902,31 +1202,64 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - createSHAUser(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise>; - createSHAUser( - paramsOrFirst: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string } | string, - ...rest: [(string)?, (string)?, (PasswordHash)?, (string)?] + createSHAUser< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + email: string, + password: string, + passwordVersion?: PasswordHash, + name?: string, + ): Promise>; + 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> { - 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 }; + 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 + 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"'); } @@ -934,40 +1267,36 @@ export class Users { throw new AppwriteException('Missing required parameter: "email"'); } if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - const apiPath = '/users/sha'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof userId !== 'undefined') { - payload['userId'] = userId; + apiPayload['userId'] = userId; } if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } if (typeof passwordVersion !== 'undefined') { - payload['passwordVersion'] = passwordVersion; + apiPayload['passwordVersion'] = passwordVersion; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -977,7 +1306,9 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - get(params: { userId: string }): Promise>; + get< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { userId: string }): Promise>; /** * Get a user by its unique ID. * @@ -986,41 +1317,43 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - get(userId: string): Promise>; get( - paramsOrFirst: { userId: string } | string + userId: string, + ): Promise>; + get( + paramsOrFirst: { userId: string } | string, ): Promise> { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1040,40 +1373,38 @@ export class Users { * @deprecated Use the object parameter style method for a better developer experience. */ delete(userId: string): Promise<{}>; - delete( - paramsOrFirst: { userId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { userId: string } | string): Promise<{}> { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1084,7 +1415,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(params: { userId: string, email: string }): Promise>; + updateEmail< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + email: string; + }): Promise>; /** * Update the user email by its unique ID. * @@ -1094,66 +1430,75 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmail(userId: string, email: string): Promise>; - updateEmail( - paramsOrFirst: { userId: string, email: string } | string, - ...rest: [(string)?] + updateEmail< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, email: string): Promise>; + updateEmail< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; email: string } | string, + ...rest: [string?] ): Promise> { - let params: { userId: string, email: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/email'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof email !== 'undefined') { - payload['email'] = email; + apiPayload['email'] = email; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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>} */ - updateImpersonator(params: { userId: string, impersonator: boolean }): Promise>; + updateImpersonator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + impersonator: boolean; + }): Promise>; /** * 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. @@ -1161,125 +1506,147 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateImpersonator(userId: string, impersonator: boolean): Promise>; - updateImpersonator( - paramsOrFirst: { userId: string, impersonator: boolean } | string, - ...rest: [(boolean)?] + updateImpersonator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, impersonator: boolean): Promise>; + updateImpersonator< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; impersonator: boolean } | string, + ...rest: [boolean?] ): Promise> { - let params: { userId: string, impersonator: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, impersonator: boolean }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "impersonator"', + ); } - - const apiPath = '/users/{userId}/impersonator'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/impersonator'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof impersonator !== 'undefined') { - payload['impersonator'] = impersonator; + apiPayload['impersonator'] = impersonator; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** * 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 {string} params.sessionId - Session ID. Use the string 'recent()' to use the most recent session, which is also the default. * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. * @throws {AppwriteException} * @returns {Promise} */ - createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise; + createJWT(params: { + userId: string; + sessionId?: string; + duration?: number; + }): Promise; /** * 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 {string} sessionId - Session ID. Use the string 'recent()' to use the most recent session, which is also the default. * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createJWT(userId: string, sessionId?: string, duration?: number): Promise; createJWT( - paramsOrFirst: { userId: string, sessionId?: string, duration?: number } | string, - ...rest: [(string)?, (number)?] + userId: string, + sessionId?: string, + duration?: number, + ): Promise; + createJWT( + paramsOrFirst: + { userId: string; sessionId?: string; duration?: number } | string, + ...rest: [string?, number?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/jwts'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof sessionId !== 'undefined') { - payload['sessionId'] = sessionId; + apiPayload['sessionId'] = sessionId; } if (typeof duration !== 'undefined') { - payload['duration'] = duration; + apiPayload['duration'] = duration; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** - * Update the user labels by its unique ID. - * + * 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. @@ -1287,10 +1654,15 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateLabels(params: { userId: string, labels: string[] }): Promise>; + updateLabels< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + labels: string[]; + }): Promise>; /** - * Update the user labels by its unique ID. - * + * 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. @@ -1299,51 +1671,58 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateLabels(userId: string, labels: string[]): Promise>; - updateLabels( - paramsOrFirst: { userId: string, labels: string[] } | string, - ...rest: [(string[])?] + updateLabels< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, labels: string[]): Promise>; + updateLabels< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; labels: string[] } | string, + ...rest: [string[]?] ): Promise> { - let params: { userId: string, labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, labels: string[] }; + 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[] + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/labels'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof labels !== 'undefined') { - payload['labels'] = labels; + apiPayload['labels'] = labels; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -1355,7 +1734,11 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise; + listLogs(params: { + userId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * Get the user activity logs list by its unique ID. * @@ -1366,52 +1749,61 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listLogs(userId: string, queries?: string[], total?: boolean): Promise; listLogs( - paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + userId: string, + queries?: string[], + total?: boolean, + ): Promise; + listLogs( + paramsOrFirst: + { userId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/logs'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1424,7 +1816,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise; + listMemberships(params: { + userId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; /** * Get the user membership list by its unique ID. * @@ -1436,57 +1833,79 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listMemberships(userId: string, queries?: string[], search?: string, total?: boolean): Promise; listMemberships( - paramsOrFirst: { userId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] + userId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listMemberships( + paramsOrFirst: + | { + userId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/memberships'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof search !== 'undefined') { - payload['search'] = search; + apiPayload['search'] = search; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1498,7 +1917,12 @@ export class Users { * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead. */ - updateMfa(params: { userId: string, mfa: boolean }): Promise>; + updateMfa< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + mfa: boolean; + }): Promise>; /** * Enable or disable MFA on a user account. * @@ -1508,51 +1932,55 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMfa(userId: string, mfa: boolean): Promise>; - updateMfa( - paramsOrFirst: { userId: string, mfa: boolean } | string, - ...rest: [(boolean)?] + updateMfa< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, mfa: boolean): Promise>; + updateMfa< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; mfa: boolean } | string, + ...rest: [boolean?] ): Promise> { - let params: { userId: string, mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; + apiPayload['mfa'] = mfa; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1563,7 +1991,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateMFA(params: { userId: string, mfa: boolean }): Promise>; + updateMFA< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + mfa: boolean; + }): Promise>; /** * Enable or disable MFA on a user account. * @@ -1573,51 +2006,55 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateMFA(userId: string, mfa: boolean): Promise>; - updateMFA( - paramsOrFirst: { userId: string, mfa: boolean } | string, - ...rest: [(boolean)?] + updateMFA< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, mfa: boolean): Promise>; + updateMFA< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; mfa: boolean } | string, + ...rest: [boolean?] ): Promise> { - let params: { userId: string, mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; + apiPayload['mfa'] = mfa; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -1629,7 +2066,10 @@ export class Users { * @returns {Promise<{}>} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead. */ - deleteMfaAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + deleteMfaAuthenticator(params: { + userId: string; + type: AuthenticatorType; + }): Promise<{}>; /** * Delete an authenticator app. * @@ -1639,47 +2079,52 @@ export class Users { * @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)?] + 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 }; + 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 + 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}', encodeURIComponent(String(userId))).replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/authenticators/{type}' + .replace('{userId}', encodeURIComponent(String(userId))) + .replace('{type}', encodeURIComponent(String(type))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1690,7 +2135,10 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteMFAAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + deleteMFAAuthenticator(params: { + userId: string; + type: AuthenticatorType; + }): Promise<{}>; /** * Delete an authenticator app. * @@ -1700,47 +2148,52 @@ export class Users { * @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)?] + 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 }; + 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 + 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}', encodeURIComponent(String(userId))).replace('{type}', encodeURIComponent(String(type))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/authenticators/{type}' + .replace('{userId}', encodeURIComponent(String(userId))) + .replace('{type}', encodeURIComponent(String(type))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -1751,7 +2204,10 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - getMFAChallenge(params: { userId: string, challengeId: string }): Promise; + getMFAChallenge(params: { + userId: string; + challengeId: string; + }): Promise; /** * Get a custom MFA challenge for a user, including the code to be delivered through your own channel. * @@ -1761,47 +2217,54 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getMFAChallenge(userId: string, challengeId: string): Promise; getMFAChallenge( - paramsOrFirst: { userId: string, challengeId: string } | string, - ...rest: [(string)?] + userId: string, + challengeId: string, + ): Promise; + getMFAChallenge( + paramsOrFirst: { userId: string; challengeId: string } | string, + ...rest: [string?] ): Promise { - let params: { userId: string, challengeId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, challengeId: string }; + let params: { userId: string; challengeId: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + userId: string; + challengeId: string; + }; } else { params = { userId: paramsOrFirst as string, - challengeId: rest[0] as string + challengeId: rest[0] as string, }; } - + const userId = params.userId; const challengeId = params.challengeId; - if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } if (typeof challengeId === 'undefined') { - throw new AppwriteException('Missing required parameter: "challengeId"'); - } - - const apiPath = '/users/{userId}/mfa/challenges/{challengeId}'.replace('{userId}', encodeURIComponent(String(userId))).replace('{challengeId}', encodeURIComponent(String(challengeId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "challengeId"', + ); + } + const apiPath = '/users/{userId}/mfa/challenges/{challengeId}' + .replace('{userId}', encodeURIComponent(String(userId))) + .replace('{challengeId}', encodeURIComponent(String(challengeId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1823,39 +2286,39 @@ export class Users { */ listMfaFactors(userId: string): Promise; listMfaFactors( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/factors'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1876,39 +2339,39 @@ export class Users { */ listMFAFactors(userId: string): Promise; listMFAFactors( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/factors'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1919,7 +2382,9 @@ export class Users { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead. */ - getMfaRecoveryCodes(params: { userId: string }): Promise; + getMfaRecoveryCodes(params: { + userId: string; + }): Promise; /** * 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. * @@ -1930,39 +2395,39 @@ export class Users { */ getMfaRecoveryCodes(userId: string): Promise; getMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -1972,7 +2437,9 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - getMFARecoveryCodes(params: { userId: string }): Promise; + getMFARecoveryCodes(params: { + userId: string; + }): Promise; /** * 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. * @@ -1983,39 +2450,39 @@ export class Users { */ getMFARecoveryCodes(userId: string): Promise; getMFARecoveryCodes( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -2026,7 +2493,9 @@ export class Users { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead. */ - updateMfaRecoveryCodes(params: { userId: string }): Promise; + updateMfaRecoveryCodes(params: { + userId: string; + }): Promise; /** * 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. * @@ -2037,40 +2506,40 @@ export class Users { */ updateMfaRecoveryCodes(userId: string): Promise; updateMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -2080,7 +2549,9 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - updateMFARecoveryCodes(params: { userId: string }): Promise; + updateMFARecoveryCodes(params: { + userId: string; + }): Promise; /** * 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. * @@ -2091,40 +2562,40 @@ export class Users { */ updateMFARecoveryCodes(userId: string): Promise; updateMFARecoveryCodes( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** @@ -2135,7 +2606,9 @@ export class Users { * @returns {Promise} * @deprecated This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead. */ - createMfaRecoveryCodes(params: { userId: string }): Promise; + createMfaRecoveryCodes(params: { + userId: string; + }): Promise; /** * 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. * @@ -2146,40 +2619,40 @@ export class Users { */ createMfaRecoveryCodes(userId: string): Promise; createMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2189,7 +2662,9 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createMFARecoveryCodes(params: { userId: string }): Promise; + createMFARecoveryCodes(params: { + userId: string; + }): Promise; /** * 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. * @@ -2200,40 +2675,40 @@ export class Users { */ createMFARecoveryCodes(userId: string): Promise; createMFARecoveryCodes( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2244,7 +2719,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(params: { userId: string, name: string }): Promise>; + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + name: string; + }): Promise>; /** * Update the user name by its unique ID. * @@ -2254,51 +2734,55 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateName(userId: string, name: string): Promise>; - updateName( - paramsOrFirst: { userId: string, name: string } | string, - ...rest: [(string)?] + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, name: string): Promise>; + updateName< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; name: string } | string, + ...rest: [string?] ): Promise> { - let params: { userId: string, name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, name: string }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/name'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2309,7 +2793,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(params: { userId: string, password: string }): Promise>; + updatePassword< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + password: string; + }): Promise>; /** * Update the user password by its unique ID. * @@ -2319,51 +2808,60 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePassword(userId: string, password: string): Promise>; - updatePassword( - paramsOrFirst: { userId: string, password: string } | string, - ...rest: [(string)?] + updatePassword< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, password: string): Promise>; + updatePassword< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; password: string } | string, + ...rest: [string?] ): Promise> { - let params: { userId: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, password: string }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "password"', + ); } - - const apiPath = '/users/{userId}/password'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/password'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof password !== 'undefined') { - payload['password'] = password; + apiPayload['password'] = password; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2374,7 +2872,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(params: { userId: string, number: string }): Promise>; + updatePhone< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + number: string; + }): Promise>; /** * Update the user phone by its unique ID. * @@ -2384,51 +2887,58 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePhone(userId: string, number: string): Promise>; - updatePhone( - paramsOrFirst: { userId: string, number: string } | string, - ...rest: [(string)?] + updatePhone< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, number: string): Promise>; + updatePhone< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; number: string } | string, + ...rest: [string?] ): Promise> { - let params: { userId: string, number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, number: string }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/phone'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof number !== 'undefined') { - payload['number'] = number; + apiPayload['number'] = number; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2438,7 +2948,9 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(params: { userId: string }): Promise; + getPrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { userId: string }): Promise; /** * Get the user preferences by its unique ID. * @@ -2447,41 +2959,43 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPrefs(userId: string): Promise; - getPrefs( - paramsOrFirst: { userId: string } | string - ): Promise { + getPrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string): Promise; + getPrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(paramsOrFirst: { userId: string } | string): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/prefs'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/prefs'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -2492,7 +3006,9 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(params: { userId: string, prefs: object }): Promise; + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { userId: string; prefs: object }): Promise; /** * 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. * @@ -2502,51 +3018,55 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePrefs(userId: string, prefs: object): Promise; - updatePrefs( - paramsOrFirst: { userId: string, prefs: object } | string, - ...rest: [(object)?] + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, prefs: object): Promise; + updatePrefs< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; prefs: object } | string, + ...rest: [object?] ): Promise { - let params: { userId: string, prefs: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, prefs: object }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/prefs'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; + apiPayload['prefs'] = prefs; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2557,7 +3077,10 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listSessions(params: { userId: string, total?: boolean }): Promise; + listSessions(params: { + userId: string; + total?: boolean; + }): Promise; /** * Get the user sessions list by its unique ID. * @@ -2569,50 +3092,53 @@ export class Users { */ listSessions(userId: string, total?: boolean): Promise; listSessions( - paramsOrFirst: { userId: string, total?: boolean } | string, - ...rest: [(boolean)?] + paramsOrFirst: { userId: string; total?: boolean } | string, + ...rest: [boolean?] ): Promise { - let params: { userId: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, total?: boolean }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/sessions'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** * 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. @@ -2622,7 +3148,7 @@ export class Users { createSession(params: { userId: string }): Promise; /** * 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. @@ -2632,40 +3158,40 @@ export class Users { */ createSession(userId: string): Promise; createSession( - paramsOrFirst: { userId: string } | string + paramsOrFirst: { userId: string } | string, ): Promise { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/sessions'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -2685,40 +3211,38 @@ export class Users { * @deprecated Use the object parameter style method for a better developer experience. */ deleteSessions(userId: string): Promise<{}>; - deleteSessions( - paramsOrFirst: { userId: string } | string - ): Promise<{}> { + deleteSessions(paramsOrFirst: { userId: string } | string): Promise<{}> { let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { userId: string }; } else { params = { - userId: paramsOrFirst as string + userId: paramsOrFirst as string, }; } - - const userId = params.userId; + const userId = params.userId; if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/sessions'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -2729,7 +3253,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSession(params: { userId: string, sessionId: string }): Promise<{}>; + deleteSession(params: { userId: string; sessionId: string }): Promise<{}>; /** * Delete a user sessions by its unique ID. * @@ -2741,45 +3265,49 @@ export class Users { */ deleteSession(userId: string, sessionId: string): Promise<{}>; deleteSession( - paramsOrFirst: { userId: string, sessionId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(userId))).replace('{sessionId}', encodeURIComponent(String(sessionId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "sessionId"', + ); + } + const apiPath = '/users/{userId}/sessions/{sessionId}' + .replace('{userId}', encodeURIComponent(String(userId))) + .replace('{sessionId}', encodeURIComponent(String(sessionId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -2790,7 +3318,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateStatus(params: { userId: string, status: boolean }): Promise>; + updateStatus< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + status: boolean; + }): Promise>; /** * 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. * @@ -2800,51 +3333,58 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateStatus(userId: string, status: boolean): Promise>; - updateStatus( - paramsOrFirst: { userId: string, status: boolean } | string, - ...rest: [(boolean)?] + updateStatus< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(userId: string, status: boolean): Promise>; + updateStatus< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; status: boolean } | string, + ...rest: [boolean?] ): Promise> { - let params: { userId: string, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, status: boolean }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/status'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof status !== 'undefined') { - payload['status'] = status; + apiPayload['status'] = status; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -2856,7 +3396,11 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise; + listTargets(params: { + userId: string; + queries?: string[]; + total?: boolean; + }): Promise; /** * List the messaging targets that are associated with a user. * @@ -2867,52 +3411,61 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listTargets(userId: string, queries?: string[], total?: boolean): Promise; listTargets( - paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] + userId: string, + queries?: string[], + total?: boolean, + ): Promise; + listTargets( + paramsOrFirst: + { userId: string; queries?: string[]; total?: boolean } | string, + ...rest: [string[]?, boolean?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/targets'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -2927,7 +3480,14 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createTarget(params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }): Promise; + createTarget(params: { + userId: string; + targetId: string; + providerType: MessagingProviderType; + identifier: string; + providerId?: string; + name?: string; + }): Promise; /** * Create a messaging target. * @@ -2941,15 +3501,49 @@ export class Users { * @returns {Promise} * @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; createTarget( - paramsOrFirst: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string } | string, - ...rest: [(string)?, (MessagingProviderType)?, (string)?, (string)?, (string)?] + userId: string, + targetId: string, + providerType: MessagingProviderType, + identifier: string, + providerId?: string, + name?: string, + ): Promise; + createTarget( + paramsOrFirst: + | { + userId: string; + targetId: string; + providerType: MessagingProviderType; + identifier: string; + providerId?: string; + name?: string; + } + | string, + ...rest: [string?, MessagingProviderType?, string?, string?, string?] ): Promise { - 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 }; + 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, @@ -2957,61 +3551,63 @@ export class Users { providerType: rest[1] as MessagingProviderType, identifier: rest[2] as string, providerId: rest[3] as string, - name: rest[4] 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"'); + throw new AppwriteException( + 'Missing required parameter: "targetId"', + ); } if (typeof providerType === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerType"'); + throw new AppwriteException( + 'Missing required parameter: "providerType"', + ); } if (typeof identifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "identifier"'); + throw new AppwriteException( + 'Missing required parameter: "identifier"', + ); } - - const apiPath = '/users/{userId}/targets'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/targets'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof targetId !== 'undefined') { - payload['targetId'] = targetId; + apiPayload['targetId'] = targetId; } if (typeof providerType !== 'undefined') { - payload['providerType'] = providerType; + apiPayload['providerType'] = providerType; } if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; + apiPayload['identifier'] = identifier; } if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3022,7 +3618,10 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - getTarget(params: { userId: string, targetId: string }): Promise; + getTarget(params: { + userId: string; + targetId: string; + }): Promise; /** * Get a user's push notification target by ID. * @@ -3034,45 +3633,49 @@ export class Users { */ getTarget(userId: string, targetId: string): Promise; getTarget( - paramsOrFirst: { userId: string, targetId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(userId))).replace('{targetId}', encodeURIComponent(String(targetId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "targetId"', + ); + } + const apiPath = '/users/{userId}/targets/{targetId}' + .replace('{userId}', encodeURIComponent(String(userId))) + .replace('{targetId}', encodeURIComponent(String(targetId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -3086,7 +3689,13 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - updateTarget(params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }): Promise; + updateTarget(params: { + userId: string; + targetId: string; + identifier?: string; + providerId?: string; + name?: string; + }): Promise; /** * Update a messaging target. * @@ -3099,63 +3708,90 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise; updateTarget( - paramsOrFirst: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?] + userId: string, + targetId: string, + identifier?: string, + providerId?: string, + name?: string, + ): Promise; + updateTarget( + paramsOrFirst: + | { + userId: string; + targetId: string; + identifier?: string; + providerId?: string; + name?: string; + } + | string, + ...rest: [string?, string?, string?, string?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(userId))).replace('{targetId}', encodeURIComponent(String(targetId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "targetId"', + ); + } + const apiPath = '/users/{userId}/targets/{targetId}' + .replace('{userId}', encodeURIComponent(String(userId))) + .replace('{targetId}', encodeURIComponent(String(targetId))); + const apiPayload: Payload = {}; if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; + apiPayload['identifier'] = identifier; } if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; + apiPayload['providerId'] = providerId; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3166,7 +3802,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteTarget(params: { userId: string, targetId: string }): Promise<{}>; + deleteTarget(params: { userId: string; targetId: string }): Promise<{}>; /** * Delete a messaging target. * @@ -3178,50 +3814,54 @@ export class Users { */ deleteTarget(userId: string, targetId: string): Promise<{}>; deleteTarget( - paramsOrFirst: { userId: string, targetId: string } | string, - ...rest: [(string)?] + 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 }; + 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 + 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}', encodeURIComponent(String(userId))).replace('{targetId}', encodeURIComponent(String(targetId))); - const payload: Payload = {}; + throw new AppwriteException( + 'Missing required parameter: "targetId"', + ); + } + const apiPath = '/users/{userId}/targets/{targetId}' + .replace('{userId}', encodeURIComponent(String(userId))) + .replace('{targetId}', encodeURIComponent(String(targetId))); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** * 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 @@ -3229,10 +3869,14 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - createToken(params: { userId: string, length?: number, expire?: number }): Promise; + createToken(params: { + userId: string; + length?: number; + expire?: number; + }): Promise; /** * 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 @@ -3241,53 +3885,62 @@ export class Users { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createToken(userId: string, length?: number, expire?: number): Promise; createToken( - paramsOrFirst: { userId: string, length?: number, expire?: number } | string, - ...rest: [(number)?, (number)?] + userId: string, + length?: number, + expire?: number, + ): Promise; + createToken( + paramsOrFirst: + { userId: string; length?: number; expire?: number } | string, + ...rest: [number?, number?] ): Promise { - 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 }; + 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 + 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}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/tokens'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof length !== 'undefined') { - payload['length'] = length; + apiPayload['length'] = length; } if (typeof expire !== 'undefined') { - payload['expire'] = expire; + apiPayload['expire'] = expire; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** @@ -3298,7 +3951,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateEmailVerification(params: { userId: string, emailVerification: boolean }): Promise>; + updateEmailVerification< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + emailVerification: boolean; + }): Promise>; /** * Update the user email verification status by its unique ID. * @@ -3308,51 +3966,63 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateEmailVerification(userId: string, emailVerification: boolean): Promise>; - updateEmailVerification( - paramsOrFirst: { userId: string, emailVerification: boolean } | string, - ...rest: [(boolean)?] + updateEmailVerification< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + emailVerification: boolean, + ): Promise>; + updateEmailVerification< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; emailVerification: boolean } | string, + ...rest: [boolean?] ): Promise> { - let params: { userId: string, emailVerification: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, emailVerification: boolean }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "emailVerification"', + ); } - - const apiPath = '/users/{userId}/verification'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/verification'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof emailVerification !== 'undefined') { - payload['emailVerification'] = emailVerification; + apiPayload['emailVerification'] = emailVerification; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } /** @@ -3363,7 +4033,12 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updatePhoneVerification(params: { userId: string, phoneVerification: boolean }): Promise>; + updatePhoneVerification< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + userId: string; + phoneVerification: boolean; + }): Promise>; /** * Update the user phone verification status by its unique ID. * @@ -3373,50 +4048,62 @@ export class Users { * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePhoneVerification(userId: string, phoneVerification: boolean): Promise>; - updatePhoneVerification( - paramsOrFirst: { userId: string, phoneVerification: boolean } | string, - ...rest: [(boolean)?] + updatePhoneVerification< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + userId: string, + phoneVerification: boolean, + ): Promise>; + updatePhoneVerification< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: { userId: string; phoneVerification: boolean } | string, + ...rest: [boolean?] ): Promise> { - let params: { userId: string, phoneVerification: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, phoneVerification: boolean }; + 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 + 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"'); + throw new AppwriteException( + 'Missing required parameter: "phoneVerification"', + ); } - - const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', encodeURIComponent(String(userId))); - const payload: Payload = {}; + const apiPath = '/users/{userId}/verification/phone'.replace( + '{userId}', + encodeURIComponent(String(userId)), + ); + const apiPayload: Payload = {}; if (typeof phoneVerification !== 'undefined') { - payload['phoneVerification'] = phoneVerification; + apiPayload['phoneVerification'] = phoneVerification; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } } diff --git a/src/services/vectors-db.ts b/src/services/vectors-db.ts new file mode 100644 index 0000000..97ac1dd --- /dev/null +++ b/src/services/vectors-db.ts @@ -0,0 +1,3616 @@ +import { AppwriteException, Client, type Payload } from '../client'; +import type { Models } from '../models'; + +import { VectorsDBIndexType } from '../enums/vectors-db-index-type'; +import { OrderBy } from '../enums/order-by'; +export class VectorsDB { + client: Client; + + 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 {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { + queries?: string[]; + total?: boolean; + }): Promise; + /** + * 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 {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise; + list( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] + ): Promise { + let params: { queries?: string[]; total?: boolean }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + queries?: string[]; + total?: boolean; + }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean, + }; + } + + const queries = params.queries; + const total = params.total; + const apiPath = '/vectorsdb'; + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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. + * @param {string} params.specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }): Promise; + /** + * 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. + * @param {string} specification - Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. + * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create( + databaseId: string, + name: string, + enabled?: boolean, + specification?: string, + replicas?: number, + syncMode?: string, + ): Promise; + create( + paramsOrFirst: + | { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + } + | string, + ...rest: [string?, boolean?, string?, number?, string?] + ): Promise { + let params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/vectorsdb'; + const apiPayload: Payload = {}; + if (typeof databaseId !== 'undefined') { + apiPayload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. + * + * @throws {AppwriteException} + * @returns {Promise} + */ + listSpecifications(): Promise { + const apiPath = '/vectorsdb/specifications'; + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * List transactions across all databases. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @throws {AppwriteException} + * @returns {Promise} + */ + listTransactions(params?: { + queries?: string[]; + }): Promise; + /** + * List transactions across all databases. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTransactions(queries?: string[]): Promise; + listTransactions( + paramsOrFirst?: { queries?: string[] } | string[], + ): Promise { + let params: { queries?: string[] }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[], + }; + } + + const queries = params.queries; + const apiPath = '/vectorsdb/transactions'; + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create a new transaction. + * + * @param {number} params.ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise} + */ + createTransaction(params?: { ttl?: number }): Promise; + /** + * Create a new transaction. + * + * @param {number} ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTransaction(ttl?: number): Promise; + createTransaction( + paramsOrFirst?: { ttl?: number } | number, + ): Promise { + let params: { ttl?: number }; + + if ( + !paramsOrFirst || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { ttl?: number }; + } else { + params = { + ttl: paramsOrFirst as number, + }; + } + + const ttl = params.ttl; + const apiPath = '/vectorsdb/transactions'; + const apiPayload: Payload = {}; + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get a transaction by its unique ID. + * + * @param {string} params.transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getTransaction(params: { + transactionId: string; + }): Promise; + /** + * Get 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. + */ + getTransaction(transactionId: string): Promise; + getTransaction( + 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 = '/vectorsdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} params.transactionId - Transaction ID. + * @param {boolean} params.commit - Commit transaction? + * @param {boolean} params.rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise} + */ + updateTransaction(params: { + transactionId: string; + commit?: boolean; + rollback?: boolean; + }): Promise; + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} transactionId - Transaction ID. + * @param {boolean} commit - Commit transaction? + * @param {boolean} rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTransaction( + transactionId: string, + commit?: boolean, + rollback?: boolean, + ): Promise; + updateTransaction( + paramsOrFirst: + | { transactionId: string; commit?: boolean; rollback?: boolean } + | string, + ...rest: [boolean?, boolean?] + ): Promise { + 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 = '/vectorsdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + if (typeof commit !== 'undefined') { + apiPayload['commit'] = commit; + } + if (typeof rollback !== 'undefined') { + apiPayload['rollback'] = rollback; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * 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 = '/vectorsdb/transactions/{transactionId}'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + createOperations(params: { + transactionId: string; + operations?: object[]; + }): Promise; + /** + * Create multiple operations in a single transaction. + * + * @param {string} transactionId - Transaction ID. + * @param {object[]} operations - Array of staged operations. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createOperations( + transactionId: string, + operations?: object[], + ): Promise; + createOperations( + paramsOrFirst: + { transactionId: string; operations?: object[] } | string, + ...rest: [object[]?] + ): Promise { + 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 = + '/vectorsdb/transactions/{transactionId}/operations'.replace( + '{transactionId}', + encodeURIComponent(String(transactionId)), + ); + const apiPayload: Payload = {}; + if (typeof operations !== 'undefined') { + apiPayload['operations'] = operations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + get(params: { databaseId: string }): Promise; + /** + * 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise; + get( + 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 = '/vectorsdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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. + * @param {string} params.specification - Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. + * @param {number} params.replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + * @param {string} params.syncMode - Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }): Promise; + /** + * 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. + * @param {string} specification - Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. + * @param {number} replicas - Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. + * @param {string} syncMode - Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update( + databaseId: string, + name: string, + enabled?: boolean, + specification?: string, + replicas?: number, + syncMode?: string, + ): Promise; + update( + paramsOrFirst: + | { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + } + | string, + ...rest: [string?, boolean?, string?, number?, string?] + ): Promise { + let params: { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + name: string; + enabled?: boolean; + specification?: string; + replicas?: number; + syncMode?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + specification: rest[2] as string, + replicas: rest[3] as number, + syncMode: rest[4] as string, + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + const specification = params.specification; + const replicas = params.replicas; + const syncMode = params.syncMode; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/vectorsdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + if (typeof specification !== 'undefined') { + apiPayload['specification'] = specification; + } + if (typeof replicas !== 'undefined') { + apiPayload['replicas'] = replicas; + } + if (typeof syncMode !== 'undefined') { + apiPayload['syncMode'] = syncMode; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * 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 = '/vectorsdb/{databaseId}'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * 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. + * @throws {AppwriteException} + * @returns {Promise} + */ + listCollections(params: { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + }): Promise; + /** + * 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[]} 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. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listCollections( + databaseId: string, + queries?: string[], + search?: string, + total?: boolean, + ): Promise; + listCollections( + paramsOrFirst: + | { + databaseId: string; + queries?: string[]; + search?: string; + total?: boolean; + } + | string, + ...rest: [string[]?, string?, boolean?] + ): Promise { + 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 = '/vectorsdb/{databaseId}/collections'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof search !== 'undefined') { + apiPayload['search'] = search; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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 {number} params.dimension - Embedding dimension. + * @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. + * @throws {AppwriteException} + * @returns {Promise} + */ + createCollection(params: { + databaseId: string; + collectionId: string; + name: string; + dimension: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + }): Promise; + /** + * 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#documentsDBCreateCollection) 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 {number} dimension - Embedding dimension. + * @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. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createCollection( + databaseId: string, + collectionId: string, + name: string, + dimension: number, + permissions?: string[], + documentSecurity?: boolean, + enabled?: boolean, + ): Promise; + createCollection( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + name: string; + dimension: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, number?, string[]?, boolean?, boolean?] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + name: string; + dimension: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + name: string; + dimension: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + name: rest[1] as string, + dimension: rest[2] as number, + permissions: rest[3] as string[], + documentSecurity: rest[4] as boolean, + enabled: rest[5] as boolean, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const name = params.name; + const dimension = params.dimension; + const permissions = params.permissions; + const documentSecurity = params.documentSecurity; + const enabled = params.enabled; + 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"'); + } + if (typeof dimension === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "dimension"', + ); + } + const apiPath = '/vectorsdb/{databaseId}/collections'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof collectionId !== 'undefined') { + apiPayload['collectionId'] = collectionId; + } + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof dimension !== 'undefined') { + apiPayload['dimension'] = dimension; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + apiPayload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + getCollection(params: { + databaseId: string; + collectionId: string; + }): Promise; + /** + * 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getCollection( + databaseId: string, + collectionId: string, + ): Promise; + getCollection( + 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 = '/vectorsdb/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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 {number} params.dimension - Embedding dimensions. + * @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. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateCollection(params: { + databaseId: string; + collectionId: string; + name: string; + dimension?: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + }): Promise; + /** + * 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 {number} dimension - Embedding dimensions. + * @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. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateCollection( + databaseId: string, + collectionId: string, + name: string, + dimension?: number, + permissions?: string[], + documentSecurity?: boolean, + enabled?: boolean, + ): Promise; + updateCollection( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + name: string; + dimension?: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + } + | string, + ...rest: [string?, string?, number?, string[]?, boolean?, boolean?] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + name: string; + dimension?: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + name: string; + dimension?: number; + permissions?: string[]; + documentSecurity?: boolean; + enabled?: boolean; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + name: rest[1] as string, + dimension: rest[2] as number, + permissions: rest[3] as string[], + documentSecurity: rest[4] as boolean, + enabled: rest[5] as boolean, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const name = params.name; + const dimension = params.dimension; + const permissions = params.permissions; + const documentSecurity = params.documentSecurity; + const enabled = params.enabled; + 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 = '/vectorsdb/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof name !== 'undefined') { + apiPayload['name'] = name; + } + if (typeof dimension !== 'undefined') { + apiPayload['dimension'] = dimension; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + apiPayload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * 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<{}>} + */ + 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 = '/vectorsdb/{databaseId}/collections/{collectionId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * 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 524288 characters long. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + */ + listDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + }): Promise>; + /** + * 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 524288 characters long. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDocuments( + databaseId: string, + collectionId: string, + queries?: string[], + transactionId?: string, + total?: boolean, + ttl?: number, + ): Promise>; + listDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + } + | string, + ...rest: [string?, string[]?, string?, boolean?, number?] + ): Promise> { + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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 & Record : Partial & Omit} 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). + * @throws {AppwriteException} + * @returns {Promise} + */ + createDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & Omit; + permissions?: string[]; + }): Promise; + /** + * 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#documentsDBCreateCollection) 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 & Record : Partial & Omit} 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). + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocument( + databaseId: string, + collectionId: string, + documentId: string, + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & Omit, + permissions?: string[], + ): Promise; + createDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + permissions?: string[]; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit)?, + string[]?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + permissions?: string[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + data: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Omit; + permissions?: 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 & Record + : Partial & + Omit, + permissions: rest[3] as string[], + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof documentId !== 'undefined') { + apiPayload['documentId'] = documentId; + } + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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. + * @throws {AppwriteException} + * @returns {Promise>} + */ + createDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documents: object[]; + }): Promise>; + /** + * 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#documentsDBCreateCollection) 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. + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocuments( + databaseId: string, + collectionId: string, + documents: object[], + ): Promise>; + createDocuments( + paramsOrFirst: + | { databaseId: string; collectionId: string; documents: object[] } + | string, + ...rest: [string?, object[]?] + ): Promise> { + let params: { + databaseId: string; + collectionId: string; + documents: object[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documents: object[]; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documents: rest[1] as object[], + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documents = params.documents; + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof documents !== 'undefined') { + apiPayload['documents'] = documents; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * 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#documentsDBCreateCollection) 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>} + */ + upsertDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + }): Promise>; + /** + * 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#documentsDBCreateCollection) 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>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertDocuments( + databaseId: string, + collectionId: string, + documents: object[], + transactionId?: string, + ): Promise>; + upsertDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documents: object[]; + transactionId?: string; + } + | string, + ...rest: [string?, object[]?, string?] + ): Promise> { + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof documents !== 'undefined') { + apiPayload['documents'] = documents; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * 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>} + */ + updateDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + data?: object; + queries?: string[]; + transactionId?: string; + }): Promise>; + /** + * 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>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDocuments( + databaseId: string, + collectionId: string, + data?: object, + queries?: string[], + transactionId?: string, + ): Promise>; + updateDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + data?: object; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, object?, string[]?, string?] + ): Promise> { + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * 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>} + */ + deleteDocuments< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + }): Promise>; + /** + * 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). + * @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>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDocuments( + databaseId: string, + collectionId: string, + queries?: string[], + transactionId?: string, + ): Promise>; + deleteDocuments( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string[]?, string?] + ): Promise> { + 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; + queries?: string[]; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Get a list of all the user's documents in a given collection using a POST request. This behaves identically to the list documents endpoint but accepts the queries in the request body, allowing much larger `queries` arrays than can fit in a URL query string. + * + * + * @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 524288 characters long. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + */ + createQuery< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + }): Promise>; + /** + * Get a list of all the user's documents in a given collection using a POST request. This behaves identically to the list documents endpoint but accepts the queries in the request body, allowing much larger `queries` arrays than can fit in a URL query string. + * + * + * @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 524288 characters long. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createQuery( + databaseId: string, + collectionId: string, + queries?: string[], + transactionId?: string, + total?: boolean, + ttl?: number, + ): Promise>; + createQuery( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + transactionId?: string; + total?: boolean; + ttl?: number; + } + | string, + ...rest: [string?, string[]?, string?, boolean?, number?] + ): Promise> { + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/query' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + if (typeof ttl !== 'undefined') { + apiPayload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + * + * @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.documentId - Document ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise} + */ + getDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }): Promise; + /** + * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + * + * @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} documentId - Document ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDocument( + databaseId: string, + collectionId: string, + documentId: string, + queries?: string[], + transactionId?: string, + ): Promise; + getDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string[]?, string?] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + queries?: string[]; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + queries: rest[2] as string[], + transactionId: rest[3] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + 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"', + ); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "documentId"', + ); + } + const apiPath = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} params.data - Document data as JSON object. Include all required fields of the document to be created or updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + */ + upsertDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; + /** + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} data - Document data as JSON object. Include all required fields of the document to be created or updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertDocument( + databaseId: string, + collectionId: string, + documentId: string, + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + upsertDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>)?, + string[]?, + string?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>, + 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"', + ); + } + const apiPath = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('put', uri, apiHeaders, apiPayload); + } + + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} params.data - Document data as JSON object. Include only fields and value pairs to be updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateDocument< + Document extends Models.Document = Models.DefaultDocument, + >(params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + }): Promise; + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial & Record : Partial & Partial>} data - Document data as JSON object. Include only fields and value pairs to be updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDocument( + databaseId: string, + collectionId: string, + documentId: string, + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>, + permissions?: string[], + transactionId?: string, + ): Promise; + updateDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + permissions?: string[]; + transactionId?: string; + } + | string, + ...rest: [ + string?, + string?, + (Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>)?, + string[]?, + string?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + data?: Document extends Models.DefaultDocument + ? Partial & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>; + 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 & Record + : Partial & + Partial>, + 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"', + ); + } + const apiPath = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof data !== 'undefined') { + apiPayload['data'] = data; + } + if (typeof permissions !== 'undefined') { + apiPayload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + + /** + * Delete a document 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.documentId - Document ID. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDocument(params: { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }): Promise<{}>; + /** + * Delete a document 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} documentId - Document ID. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDocument( + databaseId: string, + collectionId: string, + documentId: string, + transactionId?: string, + ): Promise<{}>; + deleteDocument( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + } + | string, + ...rest: [string?, string?, string?] + ): Promise<{}> { + let params: { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + documentId: string; + transactionId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + transactionId: rest[2] as string, + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + 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"', + ); + } + const apiPath = + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace( + '{documentId}', + encodeURIComponent(String(documentId)), + ); + const apiPayload: Payload = {}; + if (typeof transactionId !== 'undefined') { + apiPayload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * 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} + */ + listIndexes(params: { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + }): Promise; + /** + * 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIndexes( + databaseId: string, + collectionId: string, + queries?: string[], + total?: boolean, + ): Promise; + listIndexes( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + queries?: string[]; + total?: boolean; + } + | string, + ...rest: [string?, string[]?, boolean?] + ): Promise { + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof queries !== 'undefined') { + apiPayload['queries'] = queries; + } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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 {VectorsDBIndexType} 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} + */ + createIndex(params: { + databaseId: string; + collectionId: string; + key: string; + type: VectorsDBIndexType; + attributes: string[]; + orders?: OrderBy[]; + lengths?: number[]; + }): Promise; + /** + * 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 {VectorsDBIndexType} 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIndex( + databaseId: string, + collectionId: string, + key: string, + type: VectorsDBIndexType, + attributes: string[], + orders?: OrderBy[], + lengths?: number[], + ): Promise; + createIndex( + paramsOrFirst: + | { + databaseId: string; + collectionId: string; + key: string; + type: VectorsDBIndexType; + attributes: string[]; + orders?: OrderBy[]; + lengths?: number[]; + } + | string, + ...rest: [ + string?, + string?, + VectorsDBIndexType?, + string[]?, + OrderBy[]?, + number[]?, + ] + ): Promise { + let params: { + databaseId: string; + collectionId: string; + key: string; + type: VectorsDBIndexType; + attributes: string[]; + orders?: OrderBy[]; + lengths?: number[]; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + collectionId: string; + key: string; + type: VectorsDBIndexType; + 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 VectorsDBIndexType, + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ); + const apiPayload: Payload = {}; + if (typeof key !== 'undefined') { + apiPayload['key'] = key; + } + if (typeof type !== 'undefined') { + apiPayload['type'] = type; + } + if (typeof attributes !== 'undefined') { + apiPayload['attributes'] = attributes; + } + if (typeof orders !== 'undefined') { + apiPayload['orders'] = orders; + } + if (typeof lengths !== 'undefined') { + apiPayload['lengths'] = lengths; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * Get index by 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} + */ + getIndex(params: { + databaseId: string; + collectionId: string; + key: string; + }): Promise; + /** + * Get index by 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} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getIndex( + databaseId: string, + collectionId: string, + key: string, + ): Promise; + getIndex( + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * 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<{}>} + */ + 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 = + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + .replace('{databaseId}', encodeURIComponent(String(databaseId))) + .replace( + '{collectionId}', + encodeURIComponent(String(collectionId)), + ) + .replace('{key}', encodeURIComponent(String(key))); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + */ + createFailover(params: { + databaseId: string; + targetReplicaId?: string; + }): Promise; + /** + * Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. + * + * @param {string} databaseId - Database ID. + * @param {string} targetReplicaId - Target replica ID to promote. If not specified, the healthiest replica is selected. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFailover( + databaseId: string, + targetReplicaId?: string, + ): Promise; + createFailover( + paramsOrFirst: + { databaseId: string; targetReplicaId?: string } | string, + ...rest: [string?] + ): Promise { + let params: { databaseId: string; targetReplicaId?: string }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + targetReplicaId?: string; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + targetReplicaId: rest[0] as string, + }; + } + + const databaseId = params.databaseId; + const targetReplicaId = params.targetReplicaId; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/vectorsdb/{databaseId}/failovers'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof targetReplicaId !== 'undefined') { + apiPayload['targetReplicaId'] = targetReplicaId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('post', uri, apiHeaders, apiPayload); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.status - Filter by operation status. + * @param {number} params.limit - Maximum number of operations to return. + * @param {number} params.offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + */ + listOperations(params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }): Promise; + /** + * List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. + * + * @param {string} databaseId - Database ID. + * @param {string} status - Filter by operation status. + * @param {number} limit - Maximum number of operations to return. + * @param {number} offset - Number of operations to skip. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOperations( + databaseId: string, + status?: string, + limit?: number, + offset?: number, + ): Promise; + listOperations( + paramsOrFirst: + | { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + } + | string, + ...rest: [string?, number?, number?] + ): Promise { + let params: { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { + databaseId: string; + status?: string; + limit?: number; + offset?: number; + }; + } else { + params = { + databaseId: paramsOrFirst as string, + status: rest[0] as string, + limit: rest[1] as number, + offset: rest[2] as number, + }; + } + + const databaseId = params.databaseId; + const status = params.status; + const limit = params.limit; + const offset = params.offset; + if (typeof databaseId === 'undefined') { + throw new AppwriteException( + 'Missing required parameter: "databaseId"', + ); + } + const apiPath = '/vectorsdb/{databaseId}/operations'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + if (typeof status !== 'undefined') { + apiPayload['status'] = status; + } + if (typeof limit !== 'undefined') { + apiPayload['limit'] = limit; + } + if (typeof offset !== 'undefined') { + apiPayload['offset'] = offset; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getReplicas(params: { + databaseId: string; + }): Promise; + /** + * Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReplicas(databaseId: string): Promise; + getReplicas( + 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 = '/vectorsdb/{databaseId}/replicas'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } + + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + getStatus(params: { databaseId: string }): Promise; + /** + * Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getStatus(databaseId: string): Promise; + getStatus( + 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 = '/vectorsdb/{databaseId}/status'.replace( + '{databaseId}', + encodeURIComponent(String(databaseId)), + ); + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + accept: 'application/json', + }; + + return this.client.call('get', uri, apiHeaders, apiPayload); + } +} diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts index 71d27f1..b63c750 100644 --- a/src/services/webhooks.ts +++ b/src/services/webhooks.ts @@ -1,8 +1,6 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload } from '../client'; import type { Models } from '../models'; - - export class Webhooks { client: Client; @@ -18,7 +16,10 @@ export class Webhooks { * @throws {AppwriteException} * @returns {Promise} */ - list(params?: { queries?: string[], total?: boolean }): Promise; + list(params?: { + queries?: string[]; + total?: boolean; + }): Promise; /** * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. * @@ -30,45 +31,46 @@ export class Webhooks { */ list(queries?: string[], total?: boolean): Promise; list( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + 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 + total: rest[0] as boolean, }; } - + const queries = params.queries; const total = params.total; - - const apiPath = '/webhooks'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { - payload['queries'] = queries; + apiPayload['queries'] = queries; } if (typeof total !== 'undefined') { - payload['total'] = total; + apiPayload['total'] = total; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -86,7 +88,17 @@ export class Webhooks { * @throws {AppwriteException} * @returns {Promise} */ - create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }): Promise; + create(params: { + webhookId: string; + url: string; + name: string; + events: string[]; + enabled?: boolean; + tls?: boolean; + authUsername?: string; + authPassword?: string; + secret?: string; + }): Promise; /** * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. * @@ -103,15 +115,70 @@ export class Webhooks { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string): Promise; 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)?] + webhookId: string, + url: string, + name: string, + events: string[], + enabled?: boolean, + tls?: boolean, + authUsername?: string, + authPassword?: string, + secret?: string, + ): Promise; + 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 { - 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 }; + 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, @@ -122,10 +189,10 @@ export class Webhooks { tls: rest[4] as boolean, authUsername: rest[5] as string, authPassword: rest[6] as string, - secret: rest[7] as string + secret: rest[7] as string, }; } - + const webhookId = params.webhookId; const url = params.url; const name = params.name; @@ -135,9 +202,10 @@ export class Webhooks { const authUsername = params.authUsername; const authPassword = params.authPassword; const secret = params.secret; - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); + throw new AppwriteException( + 'Missing required parameter: "webhookId"', + ); } if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); @@ -148,54 +216,48 @@ export class Webhooks { if (typeof events === 'undefined') { throw new AppwriteException('Missing required parameter: "events"'); } - const apiPath = '/webhooks'; - const payload: Payload = {}; + const apiPayload: Payload = {}; if (typeof webhookId !== 'undefined') { - payload['webhookId'] = webhookId; + apiPayload['webhookId'] = webhookId; } if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof events !== 'undefined') { - payload['events'] = events; + apiPayload['events'] = events; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof tls !== 'undefined') { - payload['tls'] = tls; + apiPayload['tls'] = tls; } if (typeof authUsername !== 'undefined') { - payload['authUsername'] = authUsername; + apiPayload['authUsername'] = authUsername; } if (typeof authPassword !== 'undefined') { - payload['authPassword'] = authPassword; + apiPayload['authPassword'] = authPassword; } if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); + return this.client.call('post', uri, apiHeaders, apiPayload); } /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * 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} @@ -203,7 +265,7 @@ export class Webhooks { */ get(params: { webhookId: string }): Promise; /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * 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} @@ -212,39 +274,41 @@ export class Webhooks { */ get(webhookId: string): Promise; get( - paramsOrFirst: { webhookId: string } | string + paramsOrFirst: { webhookId: string } | string, ): Promise { let params: { webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { webhookId: string }; } else { params = { - webhookId: paramsOrFirst as string + webhookId: paramsOrFirst as string, }; } - - const webhookId = params.webhookId; + const webhookId = params.webhookId; if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); + throw new AppwriteException( + 'Missing required parameter: "webhookId"', + ); } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', encodeURIComponent(String(webhookId))); - const payload: Payload = {}; + const apiPath = '/webhooks/{webhookId}'.replace( + '{webhookId}', + encodeURIComponent(String(webhookId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); + return this.client.call('get', uri, apiHeaders, apiPayload); } /** @@ -261,7 +325,16 @@ export class Webhooks { * @throws {AppwriteException} * @returns {Promise} */ - update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise; + update(params: { + webhookId: string; + name: string; + url: string; + events: string[]; + enabled?: boolean; + tls?: boolean; + authUsername?: string; + authPassword?: string; + }): Promise; /** * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. * @@ -277,15 +350,65 @@ export class Webhooks { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string): Promise; 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)?] + webhookId: string, + name: string, + url: string, + events: string[], + enabled?: boolean, + tls?: boolean, + authUsername?: string, + authPassword?: string, + ): Promise; + update( + paramsOrFirst: + | { + webhookId: string; + name: string; + url: string; + events: string[]; + enabled?: boolean; + tls?: boolean; + authUsername?: string; + authPassword?: string; + } + | string, + ...rest: [ + string?, + string?, + string[]?, + boolean?, + boolean?, + string?, + string?, + ] ): Promise { - let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, 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 }; + 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, @@ -295,10 +418,10 @@ export class Webhooks { enabled: rest[3] as boolean, tls: rest[4] as boolean, authUsername: rest[5] as string, - authPassword: rest[6] as string + authPassword: rest[6] as string, }; } - + const webhookId = params.webhookId; const name = params.name; const url = params.url; @@ -307,9 +430,10 @@ export class Webhooks { const tls = params.tls; const authUsername = params.authUsername; const authPassword = params.authPassword; - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); + throw new AppwriteException( + 'Missing required parameter: "webhookId"', + ); } if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); @@ -320,48 +444,45 @@ export class Webhooks { if (typeof events === 'undefined') { throw new AppwriteException('Missing required parameter: "events"'); } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', encodeURIComponent(String(webhookId))); - const payload: Payload = {}; + const apiPath = '/webhooks/{webhookId}'.replace( + '{webhookId}', + encodeURIComponent(String(webhookId)), + ); + const apiPayload: Payload = {}; if (typeof name !== 'undefined') { - payload['name'] = name; + apiPayload['name'] = name; } if (typeof url !== 'undefined') { - payload['url'] = url; + apiPayload['url'] = url; } if (typeof events !== 'undefined') { - payload['events'] = events; + apiPayload['events'] = events; } if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + apiPayload['enabled'] = enabled; } if (typeof tls !== 'undefined') { - payload['tls'] = tls; + apiPayload['tls'] = tls; } if (typeof authUsername !== 'undefined') { - payload['authUsername'] = authUsername; + apiPayload['authUsername'] = authUsername; } if (typeof authPassword !== 'undefined') { - payload['authPassword'] = authPassword; + apiPayload['authPassword'] = authPassword; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); + return this.client.call('put', uri, apiHeaders, apiPayload); } /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * 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} @@ -369,7 +490,7 @@ export class Webhooks { */ delete(params: { webhookId: string }): Promise<{}>; /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. * * @param {string} webhookId - Webhook ID. * @throws {AppwriteException} @@ -377,40 +498,40 @@ export class Webhooks { * @deprecated Use the object parameter style method for a better developer experience. */ delete(webhookId: string): Promise<{}>; - delete( - paramsOrFirst: { webhookId: string } | string - ): Promise<{}> { + delete(paramsOrFirst: { webhookId: string } | string): Promise<{}> { let params: { webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) + ) { params = (paramsOrFirst || {}) as { webhookId: string }; } else { params = { - webhookId: paramsOrFirst as string + webhookId: paramsOrFirst as string, }; } - - const webhookId = params.webhookId; + const webhookId = params.webhookId; if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); + throw new AppwriteException( + 'Missing required parameter: "webhookId"', + ); } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', encodeURIComponent(String(webhookId))); - const payload: Payload = {}; + const apiPath = '/webhooks/{webhookId}'.replace( + '{webhookId}', + encodeURIComponent(String(webhookId)), + ); + const apiPayload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - } + }; - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); + return this.client.call('delete', uri, apiHeaders, apiPayload); } /** @@ -421,7 +542,10 @@ export class Webhooks { * @throws {AppwriteException} * @returns {Promise} */ - updateSecret(params: { webhookId: string, secret?: string }): Promise; + updateSecret(params: { + webhookId: string; + secret?: string; + }): Promise; /** * 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. * @@ -433,45 +557,50 @@ export class Webhooks { */ updateSecret(webhookId: string, secret?: string): Promise; updateSecret( - paramsOrFirst: { webhookId: string, secret?: string } | string, - ...rest: [(string)?] + paramsOrFirst: { webhookId: string; secret?: string } | string, + ...rest: [string?] ): Promise { - let params: { webhookId: string, secret?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, secret?: string }; + 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 + secret: rest[0] as string, }; } - + const webhookId = params.webhookId; const secret = params.secret; - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); + throw new AppwriteException( + 'Missing required parameter: "webhookId"', + ); } - - const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', encodeURIComponent(String(webhookId))); - const payload: Payload = {}; + const apiPath = '/webhooks/{webhookId}/secret'.replace( + '{webhookId}', + encodeURIComponent(String(webhookId)), + ); + const apiPayload: Payload = {}; if (typeof secret !== 'undefined') { - payload['secret'] = secret; + apiPayload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', - 'accept': 'application/json', - } + accept: 'application/json', + }; - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); + return this.client.call('patch', uri, apiHeaders, apiPayload); } } diff --git a/test/client.test.js b/test/client.test.js index 0e10914..c13af6c 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -1,32 +1,43 @@ -const { Client } = require("../dist/client"); -const { fetch: mockedFetch, Response, Dispatcher } = require("undici"); +const { Client } = require('../dist/client'); +const { fetch: mockedFetch, Response, Dispatcher } = require('undici'); -jest.mock("undici", () => ({ ...jest.requireActual("undici"), fetch: jest.fn() })); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); -describe("Client", () => { +describe('Client', () => { beforeEach(() => { mockedFetch.mockReset(); mockedFetch.mockImplementation(() => Response.json({ ok: true })); }); - test("does not include a dispatcher by default", async () => { + test('does not include a dispatcher by default', async () => { const client = new Client(); - await client.call("GET", new URL("https://cloud.appwrite.io/v1/health")); + await client.call( + 'GET', + new URL('https://cloud.appwrite.io/v1/health'), + ); expect(mockedFetch).toHaveBeenCalledTimes(1); - expect(mockedFetch.mock.calls[0][1]).not.toHaveProperty("dispatcher"); + expect(mockedFetch.mock.calls[0][1]).not.toHaveProperty('dispatcher'); }); - test("includes a dispatcher for self-signed requests", async () => { + test('includes a dispatcher for self-signed requests', async () => { const client = new Client(); client.setSelfSigned(true); try { - await client.call("GET", new URL("https://self-hosted.example/v1/health")); + await client.call( + 'GET', + new URL('https://self-hosted.example/v1/health'), + ); expect(mockedFetch).toHaveBeenCalledTimes(1); - expect(mockedFetch.mock.calls[0][1].dispatcher).toBeInstanceOf(Dispatcher); + expect(mockedFetch.mock.calls[0][1].dispatcher).toBeInstanceOf( + Dispatcher, + ); } finally { client.setSelfSigned(false); } diff --git a/test/id.test.js b/test/id.test.js index 0a648bc..5b3305d 100644 --- a/test/id.test.js +++ b/test/id.test.js @@ -1,6 +1,6 @@ -const { ID } = require("../dist/id"); +const { ID } = require('../dist/id'); -describe("ID", () => { +describe('ID', () => { test('unique', () => expect(ID.unique()).toHaveLength(20)); test('custom', () => expect(ID.custom('custom')).toEqual('custom')); }); diff --git a/test/operator.test.js b/test/operator.test.js index a14910c..fde8923 100644 --- a/test/operator.test.js +++ b/test/operator.test.js @@ -1,99 +1,139 @@ -const { Condition, Operator } = require("../dist/operator"); +const { Condition, Operator } = require('../dist/operator'); describe('Operator', () => { - test('returns increment', () => { - expect(Operator.increment(1)).toEqual(`{"method":"increment","values":[1]}`); - }); - - test('returns increment with max', () => { - expect(Operator.increment(5, 100)).toEqual(`{"method":"increment","values":[5,100]}`); - }); - - test('returns decrement', () => { - expect(Operator.decrement(1)).toEqual(`{"method":"decrement","values":[1]}`); - }); - - test('returns decrement with min', () => { - expect(Operator.decrement(3, 0)).toEqual(`{"method":"decrement","values":[3,0]}`); - }); - - test('returns multiply', () => { - expect(Operator.multiply(2)).toEqual(`{"method":"multiply","values":[2]}`); - }); - - test('returns multiply with max', () => { - expect(Operator.multiply(3, 1000)).toEqual(`{"method":"multiply","values":[3,1000]}`); - }); - - test('returns divide', () => { - expect(Operator.divide(2)).toEqual(`{"method":"divide","values":[2]}`); - }); - - test('returns divide with min', () => { - expect(Operator.divide(4, 1)).toEqual(`{"method":"divide","values":[4,1]}`); - }); - - test('returns modulo', () => { - expect(Operator.modulo(5)).toEqual(`{"method":"modulo","values":[5]}`); - }); - - test('returns power', () => { - expect(Operator.power(2)).toEqual(`{"method":"power","values":[2]}`); - }); - - test('returns arrayAppend', () => { - expect(Operator.arrayAppend(['item1', 'item2'])).toEqual('{"method":"arrayAppend","values":["item1","item2"]}'); - }); - - test('returns arrayPrepend', () => { - expect(Operator.arrayPrepend(['first', 'second'])).toEqual('{"method":"arrayPrepend","values":["first","second"]}'); - }); - - test('returns arrayInsert', () => { - expect(Operator.arrayInsert(0, 'newItem')).toEqual('{"method":"arrayInsert","values":[0,"newItem"]}'); - }); - - test('returns arrayRemove', () => { - expect(Operator.arrayRemove('oldItem')).toEqual('{"method":"arrayRemove","values":["oldItem"]}'); - }); - - test('returns arrayUnique', () => { - expect(Operator.arrayUnique()).toEqual('{"method":"arrayUnique","values":[]}'); - }); - - test('returns arrayIntersect', () => { - expect(Operator.arrayIntersect(['a', 'b', 'c'])).toEqual('{"method":"arrayIntersect","values":["a","b","c"]}'); - }); - - test('returns arrayDiff', () => { - expect(Operator.arrayDiff(['x', 'y'])).toEqual('{"method":"arrayDiff","values":["x","y"]}'); - }); - - test('returns arrayFilter', () => { - expect(Operator.arrayFilter(Condition.Equal, 'test')).toEqual('{"method":"arrayFilter","values":["equal","test"]}'); - }); - - test('returns stringConcat', () => { - expect(Operator.stringConcat('suffix')).toEqual('{"method":"stringConcat","values":["suffix"]}'); - }); - - test('returns stringReplace', () => { - expect(Operator.stringReplace('old', 'new')).toEqual('{"method":"stringReplace","values":["old","new"]}'); - }); - - test('returns toggle', () => { - expect(Operator.toggle()).toEqual('{"method":"toggle","values":[]}'); - }); - - test('returns dateAddDays', () => { - expect(Operator.dateAddDays(7)).toEqual('{"method":"dateAddDays","values":[7]}'); - }); - - test('returns dateSubDays', () => { - expect(Operator.dateSubDays(7)).toEqual('{"method":"dateSubDays","values":[7]}'); - }); - - test('returns dateSetNow', () => { - expect(Operator.dateSetNow()).toEqual('{"method":"dateSetNow","values":[]}'); - }); + test('returns increment', () => { + expect(Operator.increment(1)).toEqual( + `{"method":"increment","values":[1]}`, + ); + }); + + test('returns increment with max', () => { + expect(Operator.increment(5, 100)).toEqual( + `{"method":"increment","values":[5,100]}`, + ); + }); + + test('returns decrement', () => { + expect(Operator.decrement(1)).toEqual( + `{"method":"decrement","values":[1]}`, + ); + }); + + test('returns decrement with min', () => { + expect(Operator.decrement(3, 0)).toEqual( + `{"method":"decrement","values":[3,0]}`, + ); + }); + + test('returns multiply', () => { + expect(Operator.multiply(2)).toEqual( + `{"method":"multiply","values":[2]}`, + ); + }); + + test('returns multiply with max', () => { + expect(Operator.multiply(3, 1000)).toEqual( + `{"method":"multiply","values":[3,1000]}`, + ); + }); + + test('returns divide', () => { + expect(Operator.divide(2)).toEqual(`{"method":"divide","values":[2]}`); + }); + + test('returns divide with min', () => { + expect(Operator.divide(4, 1)).toEqual( + `{"method":"divide","values":[4,1]}`, + ); + }); + + test('returns modulo', () => { + expect(Operator.modulo(5)).toEqual(`{"method":"modulo","values":[5]}`); + }); + + test('returns power', () => { + expect(Operator.power(2)).toEqual(`{"method":"power","values":[2]}`); + }); + + test('returns arrayAppend', () => { + expect(Operator.arrayAppend(['item1', 'item2'])).toEqual( + '{"method":"arrayAppend","values":["item1","item2"]}', + ); + }); + + test('returns arrayPrepend', () => { + expect(Operator.arrayPrepend(['first', 'second'])).toEqual( + '{"method":"arrayPrepend","values":["first","second"]}', + ); + }); + + test('returns arrayInsert', () => { + expect(Operator.arrayInsert(0, 'newItem')).toEqual( + '{"method":"arrayInsert","values":[0,"newItem"]}', + ); + }); + + test('returns arrayRemove', () => { + expect(Operator.arrayRemove('oldItem')).toEqual( + '{"method":"arrayRemove","values":["oldItem"]}', + ); + }); + + test('returns arrayUnique', () => { + expect(Operator.arrayUnique()).toEqual( + '{"method":"arrayUnique","values":[]}', + ); + }); + + test('returns arrayIntersect', () => { + expect(Operator.arrayIntersect(['a', 'b', 'c'])).toEqual( + '{"method":"arrayIntersect","values":["a","b","c"]}', + ); + }); + + test('returns arrayDiff', () => { + expect(Operator.arrayDiff(['x', 'y'])).toEqual( + '{"method":"arrayDiff","values":["x","y"]}', + ); + }); + + test('returns arrayFilter', () => { + expect(Operator.arrayFilter(Condition.Equal, 'test')).toEqual( + '{"method":"arrayFilter","values":["equal","test"]}', + ); + }); + + test('returns stringConcat', () => { + expect(Operator.stringConcat('suffix')).toEqual( + '{"method":"stringConcat","values":["suffix"]}', + ); + }); + + test('returns stringReplace', () => { + expect(Operator.stringReplace('old', 'new')).toEqual( + '{"method":"stringReplace","values":["old","new"]}', + ); + }); + + test('returns toggle', () => { + expect(Operator.toggle()).toEqual('{"method":"toggle","values":[]}'); + }); + + test('returns dateAddDays', () => { + expect(Operator.dateAddDays(7)).toEqual( + '{"method":"dateAddDays","values":[7]}', + ); + }); + + test('returns dateSubDays', () => { + expect(Operator.dateSubDays(7)).toEqual( + '{"method":"dateSubDays","values":[7]}', + ); + }); + + test('returns dateSetNow', () => { + expect(Operator.dateSetNow()).toEqual( + '{"method":"dateSetNow","values":[]}', + ); + }); }); diff --git a/test/permission.test.js b/test/permission.test.js index 7f972d3..891ee16 100644 --- a/test/permission.test.js +++ b/test/permission.test.js @@ -1,10 +1,15 @@ -const { Permission } = require("../dist/permission"); -const { Role } = require("../dist/role"); +const { Permission } = require('../dist/permission'); +const { Role } = require('../dist/role'); describe('Permission', () => { - test('read', () => expect(Permission.read(Role.any())).toEqual('read("any")')); - test('write', () => expect(Permission.write(Role.any())).toEqual('write("any")')); - test('create', () => expect(Permission.create(Role.any())).toEqual('create("any")')); - test('update', () => expect(Permission.update(Role.any())).toEqual('update("any")')); - test('delete', () => expect(Permission.delete(Role.any())).toEqual('delete("any")')); -}) + test('read', () => + expect(Permission.read(Role.any())).toEqual('read("any")')); + test('write', () => + expect(Permission.write(Role.any())).toEqual('write("any")')); + test('create', () => + expect(Permission.create(Role.any())).toEqual('create("any")')); + test('update', () => + expect(Permission.update(Role.any())).toEqual('update("any")')); + test('delete', () => + expect(Permission.delete(Role.any())).toEqual('delete("any")')); +}); diff --git a/test/query.test.js b/test/query.test.js index e539a1f..52e9490 100644 --- a/test/query.test.js +++ b/test/query.test.js @@ -1,155 +1,157 @@ -const { Query } = require("../dist/query"); +const { Query } = require('../dist/query'); const tests = [ { description: 'with a string', value: 's', - expectedValues: '["s"]' + expectedValues: '["s"]', }, { description: 'with a integer', value: 1, - expectedValues: '[1]' + expectedValues: '[1]', }, { description: 'with a double', value: 1.2, - expectedValues: '[1.2]' + expectedValues: '[1.2]', }, { description: 'with a whole number double', value: 1.0, - expectedValues: '[1]' + expectedValues: '[1]', }, { description: 'with a bool', value: false, - expectedValues: '[false]' + expectedValues: '[false]', }, { description: 'with a list', value: ['a', 'b', 'c'], - expectedValues: '["a","b","c"]' - } + expectedValues: '["a","b","c"]', + }, ]; describe('Query', () => { describe('basic filter equal', () => { for (const t of tests) { test(t.description, () => - expect(Query.equal("attr", t.value)) - .toEqual(`{"method":"equal","attribute":"attr","values":${t.expectedValues}}`) - ) + expect(Query.equal('attr', t.value)).toEqual( + `{"method":"equal","attribute":"attr","values":${t.expectedValues}}`, + ), + ); } - }) + }); describe('basic filter notEqual', () => { for (const t of tests) { test(t.description, () => - expect(Query.notEqual("attr", t.value)) - .toEqual(`{"method":"notEqual","attribute":"attr","values":${t.expectedValues}}`) - ) + expect(Query.notEqual('attr', t.value)).toEqual( + `{"method":"notEqual","attribute":"attr","values":${t.expectedValues}}`, + ), + ); } }); describe('basic filter lessThan', () => { for (const t of tests) { test(t.description, () => - expect(Query.lessThan("attr", t.value)) - .toEqual(`{"method":"lessThan","attribute":"attr","values":${t.expectedValues}}`) - ) + expect(Query.lessThan('attr', t.value)).toEqual( + `{"method":"lessThan","attribute":"attr","values":${t.expectedValues}}`, + ), + ); } }); describe('basic filter lessThanEqual', () => { for (const t of tests) { test(t.description, () => - expect(Query.lessThanEqual("attr", t.value)) - .toEqual(`{"method":"lessThanEqual","attribute":"attr","values":${t.expectedValues}}`) - ) + expect(Query.lessThanEqual('attr', t.value)).toEqual( + `{"method":"lessThanEqual","attribute":"attr","values":${t.expectedValues}}`, + ), + ); } }); describe('basic filter greaterThan', () => { for (const t of tests) { test(t.description, () => - expect(Query.greaterThan("attr", t.value)) - .toEqual(`{"method":"greaterThan","attribute":"attr","values":${t.expectedValues}}`) - ) + expect(Query.greaterThan('attr', t.value)).toEqual( + `{"method":"greaterThan","attribute":"attr","values":${t.expectedValues}}`, + ), + ); } }); describe('basic filter greaterThanEqual', () => { for (const t of tests) { test(t.description, () => - expect(Query.greaterThanEqual("attr", t.value)) - .toEqual(`{"method":"greaterThanEqual","attribute":"attr","values":${t.expectedValues}}`) - ) + expect(Query.greaterThanEqual('attr', t.value)).toEqual( + `{"method":"greaterThanEqual","attribute":"attr","values":${t.expectedValues}}`, + ), + ); } }); test('search', () => - expect(Query.search('attr', 'keyword1 keyword2')) - .toEqual(`{"method":"search","attribute":"attr","values":["keyword1 keyword2"]}`) - ); + expect(Query.search('attr', 'keyword1 keyword2')).toEqual( + `{"method":"search","attribute":"attr","values":["keyword1 keyword2"]}`, + )); test('isNull', () => - expect(Query.isNull('attr')) - .toEqual(`{"method":"isNull","attribute":"attr"}`) - ); + expect(Query.isNull('attr')).toEqual( + `{"method":"isNull","attribute":"attr"}`, + )); test('isNotNull', () => - expect(Query.isNotNull('attr')) - .toEqual(`{"method":"isNotNull","attribute":"attr"}`) - ); + expect(Query.isNotNull('attr')).toEqual( + `{"method":"isNotNull","attribute":"attr"}`, + )); describe('between', () => { test('with integers', () => - expect(Query.between('attr', 1, 2)) - .toEqual(`{"method":"between","attribute":"attr","values":[1,2]}`) - ); + expect(Query.between('attr', 1, 2)).toEqual( + `{"method":"between","attribute":"attr","values":[1,2]}`, + )); test('with doubles', () => - expect(Query.between('attr', 1.2, 2.2)) - .toEqual(`{"method":"between","attribute":"attr","values":[1.2,2.2]}`) - ); + expect(Query.between('attr', 1.2, 2.2)).toEqual( + `{"method":"between","attribute":"attr","values":[1.2,2.2]}`, + )); test('with strings', () => - expect(Query.between('attr',"a","z")) - .toEqual(`{"method":"between","attribute":"attr","values":["a","z"]}`) - ); + expect(Query.between('attr', 'a', 'z')).toEqual( + `{"method":"between","attribute":"attr","values":["a","z"]}`, + )); }); test('select', () => - expect(Query.select(['attr1', 'attr2'])) - .toEqual(`{"method":"select","values":["attr1","attr2"]}`) - ); + expect(Query.select(['attr1', 'attr2'])).toEqual( + `{"method":"select","values":["attr1","attr2"]}`, + )); test('orderAsc', () => - expect(Query.orderAsc('attr')) - .toEqual(`{"method":"orderAsc","attribute":"attr"}`) - ); + expect(Query.orderAsc('attr')).toEqual( + `{"method":"orderAsc","attribute":"attr"}`, + )); test('orderDesc', () => - expect(Query.orderDesc('attr')) - .toEqual(`{"method":"orderDesc","attribute":"attr"}`) - ); + expect(Query.orderDesc('attr')).toEqual( + `{"method":"orderDesc","attribute":"attr"}`, + )); test('cursorBefore', () => - expect(Query.cursorBefore('attr')) - .toEqual('{"method":"cursorBefore","values":["attr"]}') - ); + expect(Query.cursorBefore('attr')).toEqual( + '{"method":"cursorBefore","values":["attr"]}', + )); test('cursorAfter', () => - expect(Query.cursorAfter('attr')) - .toEqual('{"method":"cursorAfter","values":["attr"]}') - ); + expect(Query.cursorAfter('attr')).toEqual( + '{"method":"cursorAfter","values":["attr"]}', + )); test('limit', () => - expect(Query.limit(1)) - .toEqual('{"method":"limit","values":[1]}') - ); + expect(Query.limit(1)).toEqual('{"method":"limit","values":[1]}')); test('offset', () => - expect(Query.offset(1)) - .toEqual('{"method":"offset","values":[1]}') - ); -}) + expect(Query.offset(1)).toEqual('{"method":"offset","values":[1]}')); +}); diff --git a/test/role.test.js b/test/role.test.js index 8f7420b..827c845 100644 --- a/test/role.test.js +++ b/test/role.test.js @@ -1,14 +1,22 @@ -const { Role } = require("../dist/role"); +const { Role } = require('../dist/role'); describe('Role', () => { test('any', () => expect(Role.any()).toEqual('any')); - test('user without status', () => expect(Role.user('custom')).toEqual('user:custom')); - test('user with status', () => expect(Role.user('custom', 'verified')).toEqual('user:custom/verified')); + test('user without status', () => + expect(Role.user('custom')).toEqual('user:custom')); + test('user with status', () => + expect(Role.user('custom', 'verified')).toEqual( + 'user:custom/verified', + )); test('users without status', () => expect(Role.users()).toEqual('users')); - test('users with status', () => expect(Role.users('verified')).toEqual('users/verified')); + test('users with status', () => + expect(Role.users('verified')).toEqual('users/verified')); test('guests', () => expect(Role.guests()).toEqual('guests')); - test('team without role', () => expect(Role.team('custom')).toEqual('team:custom')) - test('team with role', () => expect(Role.team('custom', 'owner')).toEqual('team:custom/owner')) - test('member', () => expect(Role.member('custom')).toEqual('member:custom')) - test('label', () => expect(Role.label('admin')).toEqual('label:admin')) -}) + test('team without role', () => + expect(Role.team('custom')).toEqual('team:custom')); + test('team with role', () => + expect(Role.team('custom', 'owner')).toEqual('team:custom/owner')); + test('member', () => + expect(Role.member('custom')).toEqual('member:custom')); + test('label', () => expect(Role.label('admin')).toEqual('label:admin')); +}); diff --git a/test/services/account.test.js b/test/services/account.test.js index 0947305..3f7f45e 100644 --- a/test/services/account.test.js +++ b/test/services/account.test.js @@ -1,64 +1,63 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Account } = require("../../dist/services/account"); +const { Client } = require('../../dist/client'); +const { Account } = require('../../dist/services/account'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Account', () => { const client = new Client(); const account = new Account(client); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.get( - ); + const response = await account.get(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.create( '', 'email@example.com', @@ -70,91 +69,80 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method listConsents()', async () => { - const data = { - 'total': 5, - 'consents': [],}; + const data = { + total: 5, + consents: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listConsents( - ); + const response = await account.listConsents(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getConsent()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'appId': '5e5ea5c16897e', - 'cimdUrl': 'https://example.com/.well-known/client-metadata.json', - 'scopes': [], - 'resources': [], - 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + appId: '5e5ea5c16897e', + cimdUrl: 'https://example.com/.well-known/client-metadata.json', + scopes: [], + resources: [], + authorizationDetails: + '[{\\"type\\":\\"calendar\\",\\"identifier\\":\\"primary\\",\\"actions\\":[\\"read_events\\",\\"create_event\\"]}]', + expire: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getConsent( - '', - ); + const response = await account.getConsent(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteConsent()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteConsent( - '', - ); + const response = await account.deleteConsent(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listConsentTokens()', async () => { - const data = { - 'total': 5, - 'tokens': [],}; + const data = { + total: 5, + tokens: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listConsentTokens( - '', - ); + const response = await account.listConsentTokens(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getConsentToken()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'consentId': '5e5ea5c16897e', - 'userId': '5e5ea5c16897e', - 'appId': '5e5ea5c16897e', - 'cimdUrl': 'https://example.com/.well-known/client-metadata.json', - 'scopes': [], - 'resources': [], - 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + consentId: '5e5ea5c16897e', + userId: '5e5ea5c16897e', + appId: '5e5ea5c16897e', + cimdUrl: 'https://example.com/.well-known/client-metadata.json', + scopes: [], + resources: [], + authorizationDetails: + '[{\\"type\\":\\"calendar\\",\\"identifier\\":\\"primary\\",\\"actions\\":[\\"read_events\\",\\"create_event\\"]}]', + expire: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.getConsentToken( '', '', @@ -165,11 +153,9 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method deleteConsentToken()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.deleteConsentToken( '', '', @@ -180,27 +166,26 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method updateEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updateEmail( 'email@example.com', 'password', @@ -211,272 +196,232 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method listIdentities()', async () => { - const data = { - 'total': 5, - 'identities': [],}; + const data = { + total: 5, + identities: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listIdentities( - ); + const response = await account.listIdentities(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteIdentity()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteIdentity( - '', - ); + const response = await account.deleteIdentity(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; + const data = { + total: 5, + logs: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listLogs( - ); + const response = await account.listLogs(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMFA()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMFA( - true, - ); + const response = await account.updateMFA(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMfaAuthenticator()', async () => { - const data = { - 'secret': '[SHARED_SECRET]', - 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; + const data = { + secret: '[SHARED_SECRET]', + uri: 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMfaAuthenticator( - 'totp', - ); + const response = await account.createMfaAuthenticator('totp'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMFAAuthenticator()', async () => { - const data = { - 'secret': '[SHARED_SECRET]', - 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; + const data = { + secret: '[SHARED_SECRET]', + uri: 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMFAAuthenticator( - 'totp', - ); + const response = await account.createMFAAuthenticator('totp'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMfaAuthenticator()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMfaAuthenticator( - 'totp', - '', - ); + const response = await account.updateMfaAuthenticator('totp', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMFAAuthenticator()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMFAAuthenticator( - 'totp', - '', - ); + const response = await account.updateMFAAuthenticator('totp', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteMfaAuthenticator()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteMfaAuthenticator( - 'totp', - ); + const response = await account.deleteMfaAuthenticator('totp'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteMFAAuthenticator()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteMFAAuthenticator( - 'totp', - ); + const response = await account.deleteMFAAuthenticator('totp'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMfaChallenge()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + expire: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMfaChallenge( - 'email', - ); + const response = await account.createMfaChallenge('email'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMFAChallenge()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + expire: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMFAChallenge( - 'email', - ); + const response = await account.createMFAChallenge('email'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMfaChallenge()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updateMfaChallenge( '', '', @@ -487,40 +432,39 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method updateMFAChallenge()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updateMFAChallenge( '', '', @@ -531,271 +475,238 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method listMfaFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - 'custom': true,}; + const data = { + totp: true, + phone: true, + email: true, + recoveryCode: true, + custom: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listMfaFactors( - ); + const response = await account.listMfaFactors(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listMFAFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - 'custom': true,}; + const data = { + totp: true, + phone: true, + email: true, + recoveryCode: true, + custom: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listMFAFactors( - ); + const response = await account.listMFAFactors(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getMfaRecoveryCodes( - ); + const response = await account.getMfaRecoveryCodes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getMFARecoveryCodes( - ); + const response = await account.getMFARecoveryCodes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMfaRecoveryCodes( - ); + const response = await account.createMfaRecoveryCodes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMFARecoveryCodes( - ); + const response = await account.createMFARecoveryCodes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMfaRecoveryCodes( - ); + const response = await account.updateMfaRecoveryCodes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMFARecoveryCodes( - ); + const response = await account.updateMFARecoveryCodes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateName()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateName( - '', - ); + const response = await account.updateName(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePassword()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePassword( - 'password', - ); + const response = await account.updatePassword('password'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePhone()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePhone( - '+12065550100', - 'password', - ); + const response = await account.updatePhone('+12065550100', 'password'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getPrefs()', async () => { - const data = {}; + const data = {}; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getPrefs( - ); + const response = await account.getPrefs(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePrefs()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePrefs( - {}, - ); + const response = await account.updatePrefs({}); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createRecovery()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.createRecovery( 'email@example.com', 'https://example.com', @@ -806,17 +717,16 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method updateRecovery()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updateRecovery( '', '', @@ -828,110 +738,102 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method listSessions()', async () => { - const data = { - 'total': 5, - 'sessions': [],}; + const data = { + total: 5, + sessions: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listSessions( - ); + const response = await account.listSessions(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteSessions()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteSessions( - ); + const response = await account.deleteSessions(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createAnonymousSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createAnonymousSession( - ); + const response = await account.createAnonymousSession(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createEmailPasswordSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.createEmailPasswordSession( 'email@example.com', 'password', @@ -942,40 +844,39 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method updateMagicURLSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updateMagicURLSession( '', '', @@ -986,40 +887,39 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method updatePhoneSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updatePhoneSession( '', '', @@ -1030,190 +930,173 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method createSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createSession( - '', - '', - ); + const response = await account.createSession('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getSession( - '', - ); + const response = await account.getSession(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateSession( - '', - ); + const response = await account.updateSession(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteSession()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteSession( - '', - ); + const response = await account.deleteSession(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateStatus( - ); + const response = await account.updateStatus(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createEmailToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.createEmailToken( '', 'email@example.com', @@ -1224,17 +1107,16 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method createMagicURLToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.createMagicURLToken( '', 'email@example.com', @@ -1245,31 +1127,26 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method createOAuth2Token()', async () => { const data = 'https://example.com/'; mockedFetch.mockImplementation(() => Response.redirect(data)); - - const response = await account.createOAuth2Token( - 'amazon', - ); + const response = await account.createOAuth2Token('amazon'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createPhoneToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.createPhoneToken( '', '+12065550100', @@ -1280,17 +1157,16 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method createEmailVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.createEmailVerification( 'https://example.com', ); @@ -1300,17 +1176,16 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method createVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.createVerification( 'https://example.com', ); @@ -1320,17 +1195,16 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method updateEmailVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updateEmailVerification( '', '', @@ -1341,17 +1215,16 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method updateVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updateVerification( '', '', @@ -1362,36 +1235,33 @@ describe('Account', () => { expect(response).toEqual(data); }); - test('test method createPhoneVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createPhoneVerification( - ); + const response = await account.createPhoneVerification(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePhoneVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await account.updatePhoneVerification( '', '', @@ -1402,4 +1272,4 @@ describe('Account', () => { expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/activities.test.js b/test/services/activities.test.js index 61bc596..5270074 100644 --- a/test/services/activities.test.js +++ b/test/services/activities.test.js @@ -1,70 +1,68 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Activities } = require("../../dist/services/activities"); +const { Client } = require('../../dist/client'); +const { Activities } = require('../../dist/services/activities'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Activities', () => { const client = new Client(); const activities = new Activities(client); - test('test method listEvents()', async () => { - const data = { - 'total': 5, - 'events': [],}; + const data = { + total: 5, + events: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await activities.listEvents( - ); + const response = await activities.listEvents(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getEvent()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'actorType': 'user', - 'actorId': '610fc2f985ee0', - 'actorEmail': 'john@appwrite.io', - 'actorName': 'John Doe', - 'resourceParent': 'database/ID', - 'resourceType': 'collection', - 'resourceId': '610fc2f985ee0', - 'resource': 'collections/610fc2f985ee0', - 'event': 'account.sessions.create', - 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', - 'ip': '127.0.0.1', - 'mode': 'admin', - 'country': 'US', - 'continentCode': 'NA', - 'city': 'Mountain View', - 'subdivisions': 'California', - 'isp': 'Google', - 'autonomousSystemNumber': '15169', - 'autonomousSystemOrganization': 'GOOGLE', - 'connectionType': 'cable', - 'connectionUsageType': 'residential', - 'connectionOrganization': 'Google LLC', - 'time': '2020-10-15T06:38:00.000+00:00', - 'projectId': '610fc2f985ee0', - 'teamId': '610fc2f985ee0', - 'hostname': 'appwrite.io', - 'sdk': 'web', - 'sdkVersion': '14.0.0',}; + const data = { + '\\$id': '5e5ea5c16897e', + actorType: 'user', + actorId: '610fc2f985ee0', + actorEmail: 'john@appwrite.io', + actorName: 'John Doe', + resourceParent: 'database/ID', + resourceType: 'collection', + resourceId: '610fc2f985ee0', + resource: 'collections/610fc2f985ee0', + event: 'account.sessions.create', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + ip: '127.0.0.1', + mode: 'admin', + country: 'US', + continentCode: 'NA', + city: 'Mountain View', + subdivisions: 'California', + isp: 'Google', + autonomousSystemNumber: '15169', + autonomousSystemOrganization: 'GOOGLE', + connectionType: 'cable', + connectionUsageType: 'residential', + connectionOrganization: 'Google LLC', + time: '2020-10-15T06:38:00.000+00:00', + projectId: '610fc2f985ee0', + teamId: '610fc2f985ee0', + hostname: 'appwrite.io', + sdk: 'web', + sdkVersion: '14.0.0', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await activities.getEvent( - '', - ); + const response = await activities.getEvent(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/advisor.test.js b/test/services/advisor.test.js index 401e34a..777728a 100644 --- a/test/services/advisor.test.js +++ b/test/services/advisor.test.js @@ -1,103 +1,93 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Advisor } = require("../../dist/services/advisor"); +const { Client } = require('../../dist/client'); +const { Advisor } = require('../../dist/services/advisor'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Advisor', () => { const client = new Client(); const advisor = new Advisor(client); - test('test method listReports()', async () => { - const data = { - 'total': 5, - 'reports': [],}; + const data = { + total: 5, + reports: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.listReports( - ); + const response = await advisor.listReports(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getReport()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'type': 'lighthouse', - 'title': 'Lighthouse audit for https://appwrite.io/', - 'summary': 'Performance score 78. 4 opportunities found.', - 'targetType': 'urls', - 'target': 'https://appwrite.io/', - 'categories': [], - 'insights': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + type: 'lighthouse', + title: 'Lighthouse audit for https://appwrite.io/', + summary: 'Performance score 78. 4 opportunities found.', + targetType: 'urls', + target: 'https://appwrite.io/', + categories: [], + insights: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.getReport( - '', - ); + const response = await advisor.getReport(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteReport()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.deleteReport( - '', - ); + const response = await advisor.deleteReport(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listInsights()', async () => { - const data = { - 'total': 5, - 'insights': [],}; + const data = { + total: 5, + insights: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.listInsights( - '', - ); + const response = await advisor.listInsights(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getInsight()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'reportId': '5e5ea5c16897e', - 'type': 'tablesDBIndex', - 'severity': 'warning', - 'status': 'active', - 'resourceType': 'databases', - 'resourceId': 'main', - 'parentResourceType': 'tables', - 'parentResourceId': 'orders', - 'title': 'Missing index on collection orders', - 'summary': 'Queries against `orders.status` are scanning the full collection.', - 'ctas': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + reportId: '5e5ea5c16897e', + type: 'tablesDBIndex', + severity: 'warning', + status: 'active', + resourceType: 'databases', + resourceId: 'main', + parentResourceType: 'tables', + parentResourceId: 'orders', + title: 'Missing index on collection orders', + summary: + 'Queries against `orders.status` are scanning the full collection.', + ctas: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await advisor.getInsight( '', '', @@ -108,4 +98,4 @@ describe('Advisor', () => { expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/apps.test.js b/test/services/apps.test.js index 2026c43..d79c42c 100644 --- a/test/services/apps.test.js +++ b/test/services/apps.test.js @@ -1,226 +1,202 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Apps } = require("../../dist/services/apps"); +const { Client } = require('../../dist/client'); +const { Apps } = require('../../dist/services/apps'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Apps', () => { const client = new Client(); const apps = new Apps(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'apps': [],}; + const data = { + total: 5, + apps: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.list( - ); + const response = await apps.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Application', - 'description': 'Connect your workspace to My Application.', - 'clientUri': 'https://example.com', - 'logoUri': 'https://example.com/logo.png', - 'privacyPolicyUrl': 'https://example.com/privacy', - 'termsUrl': 'https://example.com/terms', - 'contacts': [], - 'tagline': 'Automate your workspace.', - 'tags': [], - 'labels': [], - 'images': [], - 'supportUrl': 'https://example.com/support', - 'dataDeletionUrl': 'https://example.com/data-deletion', - 'redirectUris': [], - 'postLogoutRedirectUris': [], - 'enabled': true, - 'type': 'confidential', - 'deviceFlow': true, - 'teamId': '5e5ea5c16897e', - 'userId': '5e5ea5c16897e', - 'installationScopes': [], - 'installationRedirectUrl': 'https://example.com/setup', - 'secrets': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Application', + description: 'Connect your workspace to My Application.', + clientUri: 'https://example.com', + logoUri: 'https://example.com/logo.png', + privacyPolicyUrl: 'https://example.com/privacy', + termsUrl: 'https://example.com/terms', + contacts: [], + tagline: 'Automate your workspace.', + tags: [], + labels: [], + images: [], + supportUrl: 'https://example.com/support', + dataDeletionUrl: 'https://example.com/data-deletion', + redirectUris: [], + postLogoutRedirectUris: [], + enabled: true, + type: 'confidential', + deviceFlow: true, + teamId: '5e5ea5c16897e', + userId: '5e5ea5c16897e', + installationScopes: [], + installationRedirectUrl: 'https://example.com/setup', + secrets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.create( - '', - '', - [], - ); + const response = await apps.create('', '', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listInstallationScopes()', async () => { - const data = { - 'total': 5, - 'scopes': [],}; + const data = { + total: 5, + scopes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.listInstallationScopes( - ); + const response = await apps.listInstallationScopes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listOAuth2Scopes()', async () => { - const data = { - 'total': 5, - 'scopes': [],}; + const data = { + total: 5, + scopes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.listOAuth2Scopes( - ); + const response = await apps.listOAuth2Scopes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Application', - 'description': 'Connect your workspace to My Application.', - 'clientUri': 'https://example.com', - 'logoUri': 'https://example.com/logo.png', - 'privacyPolicyUrl': 'https://example.com/privacy', - 'termsUrl': 'https://example.com/terms', - 'contacts': [], - 'tagline': 'Automate your workspace.', - 'tags': [], - 'labels': [], - 'images': [], - 'supportUrl': 'https://example.com/support', - 'dataDeletionUrl': 'https://example.com/data-deletion', - 'redirectUris': [], - 'postLogoutRedirectUris': [], - 'enabled': true, - 'type': 'confidential', - 'deviceFlow': true, - 'teamId': '5e5ea5c16897e', - 'userId': '5e5ea5c16897e', - 'installationScopes': [], - 'installationRedirectUrl': 'https://example.com/setup', - 'secrets': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Application', + description: 'Connect your workspace to My Application.', + clientUri: 'https://example.com', + logoUri: 'https://example.com/logo.png', + privacyPolicyUrl: 'https://example.com/privacy', + termsUrl: 'https://example.com/terms', + contacts: [], + tagline: 'Automate your workspace.', + tags: [], + labels: [], + images: [], + supportUrl: 'https://example.com/support', + dataDeletionUrl: 'https://example.com/data-deletion', + redirectUris: [], + postLogoutRedirectUris: [], + enabled: true, + type: 'confidential', + deviceFlow: true, + teamId: '5e5ea5c16897e', + userId: '5e5ea5c16897e', + installationScopes: [], + installationRedirectUrl: 'https://example.com/setup', + secrets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.get( - '', - ); + const response = await apps.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Application', - 'description': 'Connect your workspace to My Application.', - 'clientUri': 'https://example.com', - 'logoUri': 'https://example.com/logo.png', - 'privacyPolicyUrl': 'https://example.com/privacy', - 'termsUrl': 'https://example.com/terms', - 'contacts': [], - 'tagline': 'Automate your workspace.', - 'tags': [], - 'labels': [], - 'images': [], - 'supportUrl': 'https://example.com/support', - 'dataDeletionUrl': 'https://example.com/data-deletion', - 'redirectUris': [], - 'postLogoutRedirectUris': [], - 'enabled': true, - 'type': 'confidential', - 'deviceFlow': true, - 'teamId': '5e5ea5c16897e', - 'userId': '5e5ea5c16897e', - 'installationScopes': [], - 'installationRedirectUrl': 'https://example.com/setup', - 'secrets': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Application', + description: 'Connect your workspace to My Application.', + clientUri: 'https://example.com', + logoUri: 'https://example.com/logo.png', + privacyPolicyUrl: 'https://example.com/privacy', + termsUrl: 'https://example.com/terms', + contacts: [], + tagline: 'Automate your workspace.', + tags: [], + labels: [], + images: [], + supportUrl: 'https://example.com/support', + dataDeletionUrl: 'https://example.com/data-deletion', + redirectUris: [], + postLogoutRedirectUris: [], + enabled: true, + type: 'confidential', + deviceFlow: true, + teamId: '5e5ea5c16897e', + userId: '5e5ea5c16897e', + installationScopes: [], + installationRedirectUrl: 'https://example.com/setup', + secrets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.update( - '', - '', - ); + const response = await apps.update('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.delete( - '', - ); + const response = await apps.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listInstallations()', async () => { - const data = { - 'total': 5, - 'installations': [],}; + const data = { + total: 5, + installations: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.listInstallations( - '', - ); + const response = await apps.listInstallations(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getInstallation()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'teamId': '5e5ea5c16897e', - 'scopes': [], - 'authorizationDetails': {}, - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + teamId: '5e5ea5c16897e', + scopes: [], + authorizationDetails: [], + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await apps.getInstallation( '', '', @@ -231,11 +207,9 @@ describe('Apps', () => { expect(response).toEqual(data); }); - test('test method deleteInstallation()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await apps.deleteInstallation( '', '', @@ -246,16 +220,15 @@ describe('Apps', () => { expect(response).toEqual(data); }); - test('test method createInstallationToken()', async () => { - const data = { - 'access_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...', - 'token_type': 'Bearer', - 'expires_in': 3600, - 'refresh_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', - 'scope': 'openid email profile',}; + const data = { + access_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...', + token_type: 'Bearer', + expires_in: 3600, + refresh_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', + scope: 'openid email profile', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await apps.createInstallationToken( '', '', @@ -266,252 +239,210 @@ describe('Apps', () => { expect(response).toEqual(data); }); - test('test method listKeys()', async () => { - const data = { - 'total': 5, - 'keys': [],}; + const data = { + total: 5, + keys: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.listKeys( - '', - ); + const response = await apps.listKeys(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'secret': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', - 'hint': 'f5c6c7', - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + secret: '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + hint: 'f5c6c7', + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.createKey( - '', - ); + const response = await apps.createKey(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'secret': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', - 'hint': 'f5c6c7', - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + secret: '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + hint: 'f5c6c7', + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.getKey( - '', - '', - ); + const response = await apps.getKey('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteKey()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.deleteKey( - '', - '', - ); + const response = await apps.deleteKey('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateLabels()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Application', - 'description': 'Connect your workspace to My Application.', - 'clientUri': 'https://example.com', - 'logoUri': 'https://example.com/logo.png', - 'privacyPolicyUrl': 'https://example.com/privacy', - 'termsUrl': 'https://example.com/terms', - 'contacts': [], - 'tagline': 'Automate your workspace.', - 'tags': [], - 'labels': [], - 'images': [], - 'supportUrl': 'https://example.com/support', - 'dataDeletionUrl': 'https://example.com/data-deletion', - 'redirectUris': [], - 'postLogoutRedirectUris': [], - 'enabled': true, - 'type': 'confidential', - 'deviceFlow': true, - 'teamId': '5e5ea5c16897e', - 'userId': '5e5ea5c16897e', - 'installationScopes': [], - 'installationRedirectUrl': 'https://example.com/setup', - 'secrets': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Application', + description: 'Connect your workspace to My Application.', + clientUri: 'https://example.com', + logoUri: 'https://example.com/logo.png', + privacyPolicyUrl: 'https://example.com/privacy', + termsUrl: 'https://example.com/terms', + contacts: [], + tagline: 'Automate your workspace.', + tags: [], + labels: [], + images: [], + supportUrl: 'https://example.com/support', + dataDeletionUrl: 'https://example.com/data-deletion', + redirectUris: [], + postLogoutRedirectUris: [], + enabled: true, + type: 'confidential', + deviceFlow: true, + teamId: '5e5ea5c16897e', + userId: '5e5ea5c16897e', + installationScopes: [], + installationRedirectUrl: 'https://example.com/setup', + secrets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.updateLabels( - '', - [], - ); + const response = await apps.updateLabels('', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listSecrets()', async () => { - const data = { - 'total': 5, - 'secrets': [],}; + const data = { + total: 5, + secrets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.listSecrets( - '', - ); + const response = await apps.listSecrets(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSecret()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'secret': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', - 'hint': 'f5c6c7', - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + secret: '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + hint: 'f5c6c7', + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.createSecret( - '', - ); + const response = await apps.createSecret(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getSecret()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'secret': '', - 'hint': 'f5c6c7', - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + secret: '', + hint: 'f5c6c7', + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.getSecret( - '', - '', - ); + const response = await apps.getSecret('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteSecret()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.deleteSecret( - '', - '', - ); + const response = await apps.deleteSecret('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateTeam()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Application', - 'description': 'Connect your workspace to My Application.', - 'clientUri': 'https://example.com', - 'logoUri': 'https://example.com/logo.png', - 'privacyPolicyUrl': 'https://example.com/privacy', - 'termsUrl': 'https://example.com/terms', - 'contacts': [], - 'tagline': 'Automate your workspace.', - 'tags': [], - 'labels': [], - 'images': [], - 'supportUrl': 'https://example.com/support', - 'dataDeletionUrl': 'https://example.com/data-deletion', - 'redirectUris': [], - 'postLogoutRedirectUris': [], - 'enabled': true, - 'type': 'confidential', - 'deviceFlow': true, - 'teamId': '5e5ea5c16897e', - 'userId': '5e5ea5c16897e', - 'installationScopes': [], - 'installationRedirectUrl': 'https://example.com/setup', - 'secrets': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Application', + description: 'Connect your workspace to My Application.', + clientUri: 'https://example.com', + logoUri: 'https://example.com/logo.png', + privacyPolicyUrl: 'https://example.com/privacy', + termsUrl: 'https://example.com/terms', + contacts: [], + tagline: 'Automate your workspace.', + tags: [], + labels: [], + images: [], + supportUrl: 'https://example.com/support', + dataDeletionUrl: 'https://example.com/data-deletion', + redirectUris: [], + postLogoutRedirectUris: [], + enabled: true, + type: 'confidential', + deviceFlow: true, + teamId: '5e5ea5c16897e', + userId: '5e5ea5c16897e', + installationScopes: [], + installationRedirectUrl: 'https://example.com/setup', + secrets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.updateTeam( - '', - '', - ); + const response = await apps.updateTeam('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteTokens()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await apps.deleteTokens( - '', - ); + const response = await apps.deleteTokens(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/avatars.test.js b/test/services/avatars.test.js index 56da275..62baf68 100644 --- a/test/services/avatars.test.js +++ b/test/services/avatars.test.js @@ -1,123 +1,104 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Avatars } = require("../../dist/services/avatars"); +const { Client } = require('../../dist/client'); +const { Avatars } = require('../../dist/services/avatars'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Avatars', () => { const client = new Client(); const avatars = new Avatars(client); - test('test method getBrowser()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getBrowser( - 'aa', - ); + const response = await avatars.getBrowser('aa'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getCreditCard()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getCreditCard( - 'amex', - ); + const response = await avatars.getCreditCard('amex'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getFavicon()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getFavicon( - 'https://example.com', - ); + const response = await avatars.getFavicon('https://example.com'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getFlag()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getFlag( - 'af', - ); + const response = await avatars.getFlag('af'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getImage()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getImage( - 'https://example.com', - ); + const response = await avatars.getImage('https://example.com'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getInitials()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); + const response = await avatars.getInitials(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; - const response = await avatars.getInitials( - ); + expect(response).toEqual(data); + }); + test('test method getPhoto()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + const response = await avatars.getPhoto(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getQR()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getQR( - '', - ); + const response = await avatars.getQR(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getScreenshot()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getScreenshot( - 'https://example.com', - ); + const response = await avatars.getScreenshot('https://example.com'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/backups.test.js b/test/services/backups.test.js index b37c790..912e834 100644 --- a/test/services/backups.test.js +++ b/test/services/backups.test.js @@ -1,259 +1,222 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Backups } = require("../../dist/services/backups"); +const { Client } = require('../../dist/client'); +const { Backups } = require('../../dist/services/backups'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Backups', () => { const client = new Client(); const backups = new Backups(client); - test('test method listArchives()', async () => { - const data = { - 'total': 5, - 'archives': [],}; + const data = { + total: 5, + archives: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.listArchives( - ); + const response = await backups.listArchives(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createArchive()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + policyId: 'did8jx6ws45jana098ab7', + size: 100000, + status: 'completed', + startedAt: '2020-10-15T06:38:00.000+00:00', + migrationId: 'did8jx6ws45jana098ab7', + services: [], + resources: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.createArchive( - [], - ); + const response = await backups.createArchive([]); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getArchive()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + policyId: 'did8jx6ws45jana098ab7', + size: 100000, + status: 'completed', + startedAt: '2020-10-15T06:38:00.000+00:00', + migrationId: 'did8jx6ws45jana098ab7', + services: [], + resources: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.getArchive( - '', - ); + const response = await backups.getArchive(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteArchive()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.deleteArchive( - '', - ); + const response = await backups.deleteArchive(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listPolicies()', async () => { - const data = { - 'total': 5, - 'policies': [],}; + const data = { + total: 5, + policies: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.listPolicies( - ); + const response = await backups.listPolicies(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'type': 'full', - 'enabled': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.createPolicy( - '', - [], - 1, - '', - ); + const response = await backups.createPolicy('', [], 1, ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'type': 'full', - 'enabled': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.getPolicy( - '', - ); + const response = await backups.getPolicy(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'type': 'full', - 'enabled': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.updatePolicy( - '', - ); + const response = await backups.updatePolicy(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deletePolicy()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.deletePolicy( - '', - ); + const response = await backups.deletePolicy(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createRestoration()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + archiveId: 'did8jx6ws45jana098ab7', + policyId: 'did8jx6ws45jana098ab7', + status: 'completed', + startedAt: '2020-10-15T06:38:00.000+00:00', + migrationId: 'did8jx6ws45jana098ab7', + services: [], + resources: [], + options: '{databases.database[{oldId, newId, newName}]}', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.createRestoration( - '', - [], - ); + const response = await backups.createRestoration('', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listRestorations()', async () => { - const data = { - 'total': 5, - 'restorations': [],}; + const data = { + total: 5, + restorations: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.listRestorations( - ); + const response = await backups.listRestorations(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getRestoration()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + archiveId: 'did8jx6ws45jana098ab7', + policyId: 'did8jx6ws45jana098ab7', + status: 'completed', + startedAt: '2020-10-15T06:38:00.000+00:00', + migrationId: 'did8jx6ws45jana098ab7', + services: [], + resources: [], + options: '{databases.database[{oldId, newId, newName}]}', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.getRestoration( - '', - ); + const response = await backups.getRestoration(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/databases.test.js b/test/services/databases.test.js index e4172d2..2af87b0 100644 --- a/test/services/databases.test.js +++ b/test/services/databases.test.js @@ -1,245 +1,210 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Databases } = require("../../dist/services/databases"); +const { Client } = require('../../dist/client'); +const { Databases } = require('../../dist/services/databases'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Databases', () => { const client = new Client(); const databases = new Databases(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'databases': [],}; + const data = { + total: 5, + databases: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.list( - ); + const response = await databases.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy',}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.create( - '', - '', - ); + const response = await databases.create('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listTransactions()', async () => { - const data = { - 'total': 5, - 'transactions': [],}; + const data = { + total: 5, + transactions: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.listTransactions( - ); + const response = await databases.listTransactions(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createTransaction( - ); + const response = await databases.createTransaction(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.getTransaction( - '', - ); + const response = await databases.getTransaction(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateTransaction( - '', - ); + const response = await databases.updateTransaction(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteTransaction()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.deleteTransaction( - '', - ); + const response = await databases.deleteTransaction(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createOperations()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createOperations( - '', - ); + const response = await databases.createOperations(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy',}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.get( - '', - ); + const response = await databases.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy',}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.update( - '', - ); + const response = await databases.update(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.delete( - '', - ); + const response = await databases.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listCollections()', async () => { - const data = { - 'total': 5, - 'collections': [],}; + const data = { + total: 5, + collections: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.listCollections( - '', - ); + const response = await databases.listCollections(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createCollection()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createCollection( '', '', @@ -251,23 +216,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method getCollection()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.getCollection( '', '', @@ -278,23 +242,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateCollection()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateCollection( '', '', @@ -305,11 +268,9 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method deleteCollection()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.deleteCollection( '', '', @@ -320,13 +281,12 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method listAttributes()', async () => { - const data = { - 'total': 5, - 'attributes': [],}; + const data = { + total: 5, + attributes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.listAttributes( '', '', @@ -337,22 +297,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createBigIntAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'bigint', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createBigIntAttribute( '', '', - '', + '', true, ); @@ -361,22 +320,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateBigIntAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'bigint', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateBigIntAttribute( '', '', - '', + '', true, 1, ); @@ -386,22 +344,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createBooleanAttribute()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'isEnabled', + type: 'boolean', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createBooleanAttribute( '', '', - '', + '', true, ); @@ -410,22 +367,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateBooleanAttribute()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'isEnabled', + type: 'boolean', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateBooleanAttribute( '', '', - '', + '', true, true, ); @@ -435,23 +391,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createDatetimeAttribute()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; + const data = { + key: 'birthDay', + type: 'datetime', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createDatetimeAttribute( '', '', - '', + '', true, ); @@ -460,23 +415,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateDatetimeAttribute()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; + const data = { + key: 'birthDay', + type: 'datetime', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateDatetimeAttribute( '', '', - '', + '', true, '2020-10-15T06:38:00.000+00:00', ); @@ -486,23 +440,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createEmailAttribute()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; + const data = { + key: 'userEmail', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'email', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createEmailAttribute( '', '', - '', + '', true, ); @@ -511,23 +464,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateEmailAttribute()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; + const data = { + key: 'userEmail', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'email', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateEmailAttribute( '', '', - '', + '', true, 'email@example.com', ); @@ -537,24 +489,23 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createEnumAttribute()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; + const data = { + key: 'status', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + elements: [], + format: 'enum', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createEnumAttribute( '', '', - '', + '', [], true, ); @@ -564,27 +515,26 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateEnumAttribute()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; + const data = { + key: 'status', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + elements: [], + format: 'enum', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateEnumAttribute( '', '', - '', + '', [], true, - '', + 'active', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -592,22 +542,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createFloatAttribute()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'percentageCompleted', + type: 'double', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createFloatAttribute( '', '', - '', + '', true, ); @@ -616,22 +565,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateFloatAttribute()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'percentageCompleted', + type: 'double', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateFloatAttribute( '', '', - '', + '', true, 1.0, ); @@ -641,22 +589,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createIntegerAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'integer', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createIntegerAttribute( '', '', - '', + '', true, ); @@ -665,22 +612,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateIntegerAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'integer', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateIntegerAttribute( '', '', - '', + '', true, 1, ); @@ -690,23 +636,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createIpAttribute()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; + const data = { + key: 'ipAddress', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'ip', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createIpAttribute( '', '', - '', + '', true, ); @@ -715,25 +660,24 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateIpAttribute()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; + const data = { + key: 'ipAddress', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'ip', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateIpAttribute( '', '', - '', + '', true, - '', + '192.0.2.0', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -741,22 +685,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createLineAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createLineAttribute( '', '', - '', + '', true, ); @@ -765,22 +708,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateLineAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateLineAttribute( '', '', - '', + '', true, ); @@ -789,22 +731,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createLongtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createLongtextAttribute( '', '', - '', + '', true, ); @@ -813,24 +754,23 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateLongtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateLongtextAttribute( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -838,22 +778,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createMediumtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createMediumtextAttribute( '', '', - '', + '', true, ); @@ -862,24 +801,23 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateMediumtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateMediumtextAttribute( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -887,22 +825,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createPointAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createPointAttribute( '', '', - '', + '', true, ); @@ -911,22 +848,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updatePointAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updatePointAttribute( '', '', - '', + '', true, ); @@ -935,22 +871,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createPolygonAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createPolygonAttribute( '', '', - '', + '', true, ); @@ -959,22 +894,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updatePolygonAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updatePolygonAttribute( '', '', - '', + '', true, ); @@ -983,24 +917,23 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createRelationshipAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + relatedCollection: 'collection', + relationType: 'oneToOne|oneToMany|manyToOne|manyToMany', + twoWay: true, + twoWayKey: 'string', + onDelete: 'restrict|cascade|setNull', + side: 'parent|child', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createRelationshipAttribute( '', '', @@ -1013,28 +946,27 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateRelationshipAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + relatedCollection: 'collection', + relationType: 'oneToOne|oneToMany|manyToOne|manyToMany', + twoWay: true, + twoWayKey: 'string', + onDelete: 'restrict|cascade|setNull', + side: 'parent|child', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateRelationshipAttribute( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1042,23 +974,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createStringAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createStringAttribute( '', '', - '', + '', 1, true, ); @@ -1068,25 +999,24 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateStringAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateStringAttribute( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1094,22 +1024,21 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createTextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createTextAttribute( '', '', - '', + '', true, ); @@ -1118,24 +1047,23 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateTextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateTextAttribute( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1143,23 +1071,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createUrlAttribute()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; + const data = { + key: 'githubUrl', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'url', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createUrlAttribute( '', '', - '', + '', true, ); @@ -1168,23 +1095,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateUrlAttribute()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; + const data = { + key: 'githubUrl', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'url', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateUrlAttribute( '', '', - '', + '', true, 'https://example.com', ); @@ -1194,23 +1120,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createVarcharAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createVarcharAttribute( '', '', - '', + '', 1, true, ); @@ -1220,25 +1145,24 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateVarcharAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateVarcharAttribute( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1246,23 +1170,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method getAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.getAttribute( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1270,15 +1193,13 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method deleteAttribute()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.deleteAttribute( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1286,13 +1207,12 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method listDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; + const data = { + total: 5, + documents: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.listDocuments( '', '', @@ -1303,18 +1223,17 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createDocument( '', '', @@ -1327,13 +1246,12 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; + const data = { + total: 5, + documents: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createDocuments( '', '', @@ -1345,13 +1263,12 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method upsertDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; + const data = { + total: 5, + documents: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.upsertDocuments( '', '', @@ -1363,13 +1280,12 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; + const data = { + total: 5, + documents: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateDocuments( '', '', @@ -1380,13 +1296,12 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method deleteDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; + const data = { + total: 5, + documents: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.deleteDocuments( '', '', @@ -1397,18 +1312,17 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method getDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.getDocument( '', '', @@ -1420,18 +1334,17 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method upsertDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.upsertDocument( '', '', @@ -1443,18 +1356,17 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method updateDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.updateDocument( '', '', @@ -1466,11 +1378,9 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method deleteDocument()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.deleteDocument( '', '', @@ -1482,23 +1392,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method decrementDocumentAttribute()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.decrementDocumentAttribute( '', '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1506,23 +1415,22 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method incrementDocumentAttribute()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.incrementDocumentAttribute( '', '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1530,13 +1438,12 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method listIndexes()', async () => { - const data = { - 'total': 5, - 'indexes': [],}; + const data = { + total: 5, + indexes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.listIndexes( '', '', @@ -1547,24 +1454,23 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method createIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + attributes: [], + lengths: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.createIndex( '', '', - '', + '', 'key', [], ); @@ -1574,24 +1480,23 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method getIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + attributes: [], + lengths: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.getIndex( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1599,15 +1504,13 @@ describe('Databases', () => { expect(response).toEqual(data); }); - test('test method deleteIndex()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await databases.deleteIndex( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1615,4 +1518,4 @@ describe('Databases', () => { expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/documents-d-b.test.js b/test/services/documents-d-b.test.js new file mode 100644 index 0000000..26a4f93 --- /dev/null +++ b/test/services/documents-d-b.test.js @@ -0,0 +1,723 @@ +const { Client } = require('../../dist/client'); +const { DocumentsDB } = require('../../dist/services/documents-db'); + +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); + +describe('DocumentsDB', () => { + const client = new Client(); + const documentsDB = new DocumentsDB(client); + + test('test method list()', async () => { + const data = { + total: 5, + databases: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.list(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method create()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.create('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listSpecifications()', async () => { + const data = { + specifications: [], + total: 9, + pricing: {}, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.listSpecifications(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listTransactions()', async () => { + const data = { + total: 5, + transactions: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.listTransactions(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createTransaction()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.createTransaction(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getTransaction()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.getTransaction(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateTransaction()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = + await documentsDB.updateTransaction(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteTransaction()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = + await documentsDB.deleteTransaction(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createOperations()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.createOperations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method get()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.get(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method update()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.update('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method delete()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.delete(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listCollections()', async () => { + const data = { + total: 5, + collections: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.listCollections(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createCollection()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.createCollection( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getCollection()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.getCollection( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateCollection()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.updateCollection( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteCollection()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.deleteCollection( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.listDocuments( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.createDocument( + '', + '', + '', + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.createDocuments( + '', + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method upsertDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.upsertDocuments( + '', + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.updateDocuments( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.deleteDocuments( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.getDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method upsertDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.upsertDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.updateDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteDocument()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.deleteDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method decrementDocumentAttribute()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.decrementDocumentAttribute( + '', + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method incrementDocumentAttribute()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.incrementDocumentAttribute( + '', + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listIndexes()', async () => { + const data = { + total: 5, + indexes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.listIndexes( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createIndex()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + attributes: [], + lengths: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.createIndex( + '', + '', + '', + 'key', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getIndex()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + attributes: [], + lengths: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.getIndex( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteIndex()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.deleteIndex( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createFailover()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.createFailover(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listOperations()', async () => { + const data = { + total: 5, + operations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.listOperations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getReplicas()', async () => { + const data = { + replicas: 2, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + members: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.getReplicas(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getStatus()', async () => { + const data = { + health: 'healthy', + ready: true, + engine: 'postgresql', + version: '17', + uptime: 86400, + connections: {}, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + replicas: [], + volumes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await documentsDB.getStatus(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); +}); diff --git a/test/services/embeddings.test.js b/test/services/embeddings.test.js index 02e84ed..ae0732e 100644 --- a/test/services/embeddings.test.js +++ b/test/services/embeddings.test.js @@ -1,28 +1,27 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Embeddings } = require("../../dist/services/embeddings"); +const { Client } = require('../../dist/client'); +const { Embeddings } = require('../../dist/services/embeddings'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Embeddings', () => { const client = new Client(); const embeddings = new Embeddings(client); - test('test method createTextEmbeddings()', async () => { - const data = { - 'total': 5, - 'embeddings': [],}; + const data = { + total: 5, + embeddings: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await embeddings.createTextEmbeddings( - [], - ); + const response = await embeddings.createTextEmbeddings([]); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/functions.test.js b/test/services/functions.test.js index e805931..62c32e0 100644 --- a/test/services/functions.test.js +++ b/test/services/functions.test.js @@ -1,66 +1,66 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Functions } = require("../../dist/services/functions"); +const { Client } = require('../../dist/client'); +const { InputFile } = require('../../dist/inputFile'); +const { Functions } = require('../../dist/services/functions'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Functions', () => { const client = new Client(); const functions = new Functions(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'functions': [],}; + const data = { + total: 5, + functions: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.list( - ); + const response = await functions.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + execute: [], + name: 'My Function', + enabled: true, + live: true, + logging: true, + runtime: 'python-3.8', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + events: [], + schedule: '5 4 * * *', + timeout: 300, + entrypoint: 'index.js', + commands: 'npm install', + version: 'v2', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'functions/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.create( '', '', @@ -72,180 +72,164 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method listRuntimes()', async () => { - const data = { - 'total': 5, - 'runtimes': [],}; + const data = { + total: 5, + runtimes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listRuntimes( - ); + const response = await functions.listRuntimes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listSpecifications()', async () => { - const data = { - 'total': 5, - 'specifications': [],}; + const data = { + total: 5, + specifications: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listSpecifications( - ); + const response = await functions.listSpecifications(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + execute: [], + name: 'My Function', + enabled: true, + live: true, + logging: true, + runtime: 'python-3.8', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + events: [], + schedule: '5 4 * * *', + timeout: 300, + entrypoint: 'index.js', + commands: 'npm install', + version: 'v2', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'functions/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.get( - '', - ); + const response = await functions.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + execute: [], + name: 'My Function', + enabled: true, + live: true, + logging: true, + runtime: 'python-3.8', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + events: [], + schedule: '5 4 * * *', + timeout: 300, + entrypoint: 'index.js', + commands: 'npm install', + version: 'v2', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'functions/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.update( - '', - '', - ); + const response = await functions.update('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.delete( - '', - ); + const response = await functions.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateFunctionDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + execute: [], + name: 'My Function', + enabled: true, + live: true, + logging: true, + runtime: 'python-3.8', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + events: [], + schedule: '5 4 * * *', + timeout: 300, + entrypoint: 'index.js', + commands: 'npm install', + version: 'v2', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'functions/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.updateFunctionDeployment( '', '', @@ -256,54 +240,53 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method listDeployments()', async () => { - const data = { - 'total': 5, - 'deployments': [],}; + const data = { + total: 5, + deployments: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listDeployments( - '', - ); + const response = await functions.listDeployments(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.createDeployment( '', InputFile.fromBuffer(new Uint8Array(0), 'image.png'), @@ -315,38 +298,40 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method createDuplicateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.createDuplicateDeployment( '', '', @@ -357,38 +342,40 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method createTemplateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.createTemplateDeployment( '', '', @@ -403,38 +390,40 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method createVcsDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.createVcsDeployment( '', 'branch', @@ -446,38 +435,40 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method getDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.getDeployment( '', '', @@ -488,11 +479,9 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method deleteDeployment()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.deleteDeployment( '', '', @@ -503,11 +492,9 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method getDeploymentDownload()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - const response = await functions.getDeploymentDownload( '', '', @@ -518,38 +505,40 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method updateDeploymentStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.updateDeploymentStatus( '', '', @@ -560,75 +549,70 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method listExecutions()', async () => { - const data = { - 'total': 5, - 'executions': [],}; + const data = { + total: 5, + executions: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listExecutions( - '', - ); + const response = await functions.listExecutions(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createExecution()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + deploymentId: '5e5ea5c16897e', + trigger: 'http', + status: 'processing', + requestMethod: 'GET', + requestPath: '/articles?id=5', + requestHeaders: [], + responseStatusCode: 200, + responseBody: '', + responseHeaders: [], + logs: '', + errors: '', + duration: 0.4, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.createExecution( - '', - ); + const response = await functions.createExecution(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getExecution()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + deploymentId: '5e5ea5c16897e', + trigger: 'http', + status: 'processing', + requestMethod: 'GET', + requestPath: '/articles?id=5', + requestHeaders: [], + responseStatusCode: 200, + responseBody: '', + responseHeaders: [], + logs: '', + errors: '', + duration: 0.4, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.getExecution( '', '', @@ -639,11 +623,9 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method deleteExecution()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.deleteExecution( '', '', @@ -654,35 +636,31 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method listVariables()', async () => { - const data = { - 'total': 5, - 'variables': [],}; + const data = { + total: 5, + variables: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listVariables( - '', - ); + const response = await functions.listVariables(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.createVariable( '', '', @@ -695,19 +673,18 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method getVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.getVariable( '', '', @@ -718,19 +695,18 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method updateVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.updateVariable( '', '', @@ -741,11 +717,9 @@ describe('Functions', () => { expect(response).toEqual(data); }); - test('test method deleteVariable()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await functions.deleteVariable( '', '', @@ -756,4 +730,4 @@ describe('Functions', () => { expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/graphql.test.js b/test/services/graphql.test.js index 6f2577d..e98c1c9 100644 --- a/test/services/graphql.test.js +++ b/test/services/graphql.test.js @@ -1,40 +1,34 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Graphql } = require("../../dist/services/graphql"); +const { Client } = require('../../dist/client'); +const { Graphql } = require('../../dist/services/graphql'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Graphql', () => { const client = new Client(); const graphql = new Graphql(client); - test('test method query()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await graphql.query( - {}, - ); + const response = await graphql.query({}); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method mutation()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await graphql.mutation( - {}, - ); + const response = await graphql.mutation({}); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/locale.test.js b/test/services/locale.test.js index 675b715..eb2c343 100644 --- a/test/services/locale.test.js +++ b/test/services/locale.test.js @@ -1,137 +1,123 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Locale } = require("../../dist/services/locale"); +const { Client } = require('../../dist/client'); +const { Locale } = require('../../dist/services/locale'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Locale', () => { const client = new Client(); const locale = new Locale(client); - test('test method get()', async () => { - const data = { - 'ip': '127.0.0.1', - 'countryCode': 'US', - 'country': 'United States', - 'continentCode': 'NA', - 'continent': 'North America', - 'eu': true, - 'currency': 'USD',}; + const data = { + ip: '127.0.0.1', + countryCode: 'US', + country: 'United States', + continentCode: 'NA', + continent: 'North America', + eu: true, + currency: 'USD', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.get( - ); + const response = await locale.get(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listCodes()', async () => { - const data = { - 'total': 5, - 'localeCodes': [],}; + const data = { + total: 5, + localeCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCodes( - ); + const response = await locale.listCodes(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listContinents()', async () => { - const data = { - 'total': 5, - 'continents': [],}; + const data = { + total: 5, + continents: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listContinents( - ); + const response = await locale.listContinents(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listCountries()', async () => { - const data = { - 'total': 5, - 'countries': [],}; + const data = { + total: 5, + countries: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCountries( - ); + const response = await locale.listCountries(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listCountriesEU()', async () => { - const data = { - 'total': 5, - 'countries': [],}; + const data = { + total: 5, + countries: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCountriesEU( - ); + const response = await locale.listCountriesEU(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listCountriesPhones()', async () => { - const data = { - 'total': 5, - 'phones': [],}; + const data = { + total: 5, + phones: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCountriesPhones( - ); + const response = await locale.listCountriesPhones(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listCurrencies()', async () => { - const data = { - 'total': 5, - 'currencies': [],}; + const data = { + total: 5, + currencies: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCurrencies( - ); + const response = await locale.listCurrencies(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listLanguages()', async () => { - const data = { - 'total': 5, - 'languages': [],}; + const data = { + total: 5, + languages: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listLanguages( - ); + const response = await locale.listLanguages(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/messaging.test.js b/test/services/messaging.test.js index 007688e..5afb42c 100644 --- a/test/services/messaging.test.js +++ b/test/services/messaging.test.js @@ -1,44 +1,43 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Messaging } = require("../../dist/services/messaging"); +const { Client } = require('../../dist/client'); +const { Messaging } = require('../../dist/services/messaging'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Messaging', () => { const client = new Client(); const messaging = new Messaging(client); - test('test method listMessages()', async () => { - const data = { - 'total': 5, - 'messages': [],}; + const data = { + total: 5, + messages: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listMessages( - ); + const response = await messaging.listMessages(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createEmail( '', '', @@ -50,258 +49,222 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateEmail( - '', - ); + const response = await messaging.updateEmail(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createPush()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createPush( - '', - ); + const response = await messaging.createPush(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePush()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updatePush( - '', - ); + const response = await messaging.updatePush(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSms()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSms( - '', - '', - ); + const response = await messaging.createSms('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSMS()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSMS( - '', - '', - ); + const response = await messaging.createSMS('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSms()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSms( - '', - ); + const response = await messaging.updateSms(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSMS()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSMS( - '', - ); + const response = await messaging.updateSMS(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMessage()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + providerType: 'email', + topics: [], + users: [], + targets: [], + deliveredTotal: 1, + data: {}, + status: 'processing', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.getMessage( - '', - ); + const response = await messaging.getMessage(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.delete( - '', - ); + const response = await messaging.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listTargets()', async () => { - const data = { - 'total': 5, - 'targets': [],}; + const data = { + total: 5, + targets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listTargets( - '', - ); + const response = await messaging.listTargets(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listProviders()', async () => { - const data = { - 'total': 5, - 'providers': [],}; + const data = { + total: 5, + providers: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listProviders( - ); + const response = await messaging.listProviders(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createApnsProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createApnsProvider( '', '', @@ -312,19 +275,18 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method createAPNSProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createAPNSProvider( '', '', @@ -335,63 +297,56 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateApnsProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateApnsProvider( - '', - ); + const response = await messaging.updateApnsProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateAPNSProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateAPNSProvider( - '', - ); + const response = await messaging.updateAPNSProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createFcmProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createFcmProvider( '', '', @@ -402,19 +357,18 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method createFCMProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createFCMProvider( '', '', @@ -425,63 +379,56 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateFcmProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateFcmProvider( - '', - ); + const response = await messaging.updateFcmProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateFCMProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateFCMProvider( - '', - ); + const response = await messaging.updateFCMProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMailgunProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createMailgunProvider( '', '', @@ -492,41 +439,37 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateMailgunProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateMailgunProvider( - '', - ); + const response = await messaging.updateMailgunProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMsg91Provider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createMsg91Provider( '', '', @@ -537,41 +480,37 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateMsg91Provider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateMsg91Provider( - '', - ); + const response = await messaging.updateMsg91Provider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createResendProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createResendProvider( '', '', @@ -582,41 +521,37 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateResendProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateResendProvider( - '', - ); + const response = await messaging.updateResendProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSendgridProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createSendgridProvider( '', '', @@ -627,41 +562,38 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateSendgridProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSendgridProvider( - '', - ); + const response = + await messaging.updateSendgridProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSesProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createSesProvider( '', '', @@ -672,41 +604,37 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateSesProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSesProvider( - '', - ); + const response = await messaging.updateSesProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSmtpProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createSmtpProvider( '', '', @@ -718,19 +646,18 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method createSMTPProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createSMTPProvider( '', '', @@ -742,63 +669,56 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateSmtpProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSmtpProvider( - '', - ); + const response = await messaging.updateSmtpProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSMTPProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSMTPProvider( - '', - ); + const response = await messaging.updateSMTPProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTelesignProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createTelesignProvider( '', '', @@ -809,41 +729,38 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateTelesignProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTelesignProvider( - '', - ); + const response = + await messaging.updateTelesignProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTextmagicProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createTextmagicProvider( '', '', @@ -854,41 +771,38 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateTextmagicProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTextmagicProvider( - '', - ); + const response = + await messaging.updateTextmagicProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTwilioProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createTwilioProvider( '', '', @@ -899,41 +813,37 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateTwilioProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTwilioProvider( - '', - ); + const response = await messaging.updateTwilioProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createVonageProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createVonageProvider( '', '', @@ -944,190 +854,160 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method updateVonageProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateVonageProvider( - '', - ); + const response = await messaging.updateVonageProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Mailgun', + provider: 'mailgun', + enabled: true, + type: 'sms', + credentials: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.getProvider( - '', - ); + const response = await messaging.getProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteProvider()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.deleteProvider( - '', - ); + const response = await messaging.deleteProvider(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listTopics()', async () => { - const data = { - 'total': 5, - 'topics': [],}; + const data = { + total: 5, + topics: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listTopics( - ); + const response = await messaging.listTopics(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTopic()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'events', + emailTotal: 100, + smsTotal: 100, + pushTotal: 100, + subscribe: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createTopic( - '', - '', - ); + const response = await messaging.createTopic('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getTopic()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'events', + emailTotal: 100, + smsTotal: 100, + pushTotal: 100, + subscribe: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.getTopic( - '', - ); + const response = await messaging.getTopic(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateTopic()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'events', + emailTotal: 100, + smsTotal: 100, + pushTotal: 100, + subscribe: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTopic( - '', - ); + const response = await messaging.updateTopic(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteTopic()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.deleteTopic( - '', - ); + const response = await messaging.deleteTopic(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listSubscribers()', async () => { - const data = { - 'total': 5, - 'subscribers': [],}; + const data = { + total: 5, + subscribers: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listSubscribers( - '', - ); + const response = await messaging.listSubscribers(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSubscriber()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': {}, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + targetId: '259125845563242502', + target: {}, + userId: '5e5ea5c16897e', + userName: 'Aegon Targaryen', + topicId: '259125845563242502', + providerType: 'email', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.createSubscriber( '', '', @@ -1139,20 +1019,19 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method getSubscriber()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': {}, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + targetId: '259125845563242502', + target: {}, + userId: '5e5ea5c16897e', + userName: 'Aegon Targaryen', + topicId: '259125845563242502', + providerType: 'email', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.getSubscriber( '', '', @@ -1163,11 +1042,9 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - test('test method deleteSubscriber()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await messaging.deleteSubscriber( '', '', @@ -1178,4 +1055,4 @@ describe('Messaging', () => { expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/mongo.test.js b/test/services/mongo.test.js new file mode 100644 index 0000000..eb7d7dc --- /dev/null +++ b/test/services/mongo.test.js @@ -0,0 +1,979 @@ +const { Client } = require('../../dist/client'); +const { Mongo } = require('../../dist/services/mongo'); + +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); + +describe('Mongo', () => { + const client = new Client(); + const mongo = new Mongo(client); + + test('test method list()', async () => { + const data = { + total: 5, + databases: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.list(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method create()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.create('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listSpecifications()', async () => { + const data = { + specifications: [], + total: 9, + pricing: {}, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.listSpecifications(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method get()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.get(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method update()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.update(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method delete()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.delete(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBackups()', async () => { + const data = { + total: 5, + backups: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.listBackups(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBackup()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + policyId: '5e5ea5c16897e', + trigger: 'schedule', + type: 'full', + requestedType: 'incremental', + fallbackReason: + 'PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.', + status: 'completed', + sizeBytes: 1073741824, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.createBackup(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBackupPolicies()', async () => { + const data = { + total: 5, + policies: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.listBackupPolicies(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.createBackupPolicy( + '', + '', + '', + '', + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.getBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.updateBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBackupPolicy()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.deleteBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateBackupStorage()', async () => { + const data = { + provider: 's3', + bucket: 'my-backup-bucket', + region: 'us-east-1', + prefix: 'backups/', + endpoint: 'https://minio.example.com', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.updateBackupStorage( + '', + 's3', + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getBackup()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + policyId: '5e5ea5c16897e', + trigger: 'schedule', + type: 'full', + requestedType: 'incremental', + fallbackReason: + 'PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.', + status: 'completed', + sizeBytes: 1073741824, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.getBackup('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBackup()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.deleteBackup( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBranches()', async () => { + const data = { + total: 2, + branches: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.listBranches(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBranch()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.createBranch(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBranch()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.deleteBranch( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateCredentials()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.updateCredentials(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createFailover()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.createFailover(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateMaintenance()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.updateMaintenance( + '', + 'sun', + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createMigration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.createMigration('', 'shared'); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listOperations()', async () => { + const data = { + total: 5, + operations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.listOperations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getPitr()', async () => { + const data = { + earliest: '2020-10-15T06:38:00.000+00:00', + latest: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.getPitr(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getReplicas()', async () => { + const data = { + replicas: 2, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + members: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.getReplicas(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listRestorations()', async () => { + const data = { + total: 5, + restorations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.listRestorations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createRestoration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + sourceDatabaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + backupId: '5e5ea5c16897e', + type: 'backup', + status: 'completed', + targetTime: '2020-10-15T06:38:00.000+00:00', + startedAt: '2020-10-15T06:38:00.000+00:00', + completedAt: '2020-10-15T06:38:00.000+00:00', + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.createRestoration(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getRestoration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + sourceDatabaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + backupId: '5e5ea5c16897e', + type: 'backup', + status: 'completed', + targetTime: '2020-10-15T06:38:00.000+00:00', + startedAt: '2020-10-15T06:38:00.000+00:00', + completedAt: '2020-10-15T06:38:00.000+00:00', + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.getRestoration( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getStatus()', async () => { + const data = { + health: 'healthy', + ready: true, + engine: 'postgresql', + version: '17', + uptime: 86400, + connections: {}, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + replicas: [], + volumes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.getStatus(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createUpgrade()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mongo.createUpgrade( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); +}); diff --git a/test/services/mysql.test.js b/test/services/mysql.test.js new file mode 100644 index 0000000..3cd1e69 --- /dev/null +++ b/test/services/mysql.test.js @@ -0,0 +1,1038 @@ +const { Client } = require('../../dist/client'); +const { Mysql } = require('../../dist/services/mysql'); + +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); + +describe('Mysql', () => { + const client = new Client(); + const mysql = new Mysql(client); + + test('test method list()', async () => { + const data = { + total: 5, + databases: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.list(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method create()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.create('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listSpecifications()', async () => { + const data = { + specifications: [], + total: 9, + pricing: {}, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.listSpecifications(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method get()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.get(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method update()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.update(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method delete()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.delete(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBackups()', async () => { + const data = { + total: 5, + backups: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.listBackups(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBackup()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + policyId: '5e5ea5c16897e', + trigger: 'schedule', + type: 'full', + requestedType: 'incremental', + fallbackReason: + 'PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.', + status: 'completed', + sizeBytes: 1073741824, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createBackup(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBackupPolicies()', async () => { + const data = { + total: 5, + policies: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.listBackupPolicies(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createBackupPolicy( + '', + '', + '', + '', + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.getBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.updateBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBackupPolicy()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.deleteBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateBackupStorage()', async () => { + const data = { + provider: 's3', + bucket: 'my-backup-bucket', + region: 'us-east-1', + prefix: 'backups/', + endpoint: 'https://minio.example.com', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.updateBackupStorage( + '', + 's3', + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getBackup()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + policyId: '5e5ea5c16897e', + trigger: 'schedule', + type: 'full', + requestedType: 'incremental', + fallbackReason: + 'PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.', + status: 'completed', + sizeBytes: 1073741824, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.getBackup('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBackup()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.deleteBackup( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBranches()', async () => { + const data = { + total: 2, + branches: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.listBranches(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBranch()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createBranch(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBranch()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.deleteBranch( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateCredentials()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.updateCredentials(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createExecution()', async () => { + const data = { + rows: [], + rowCount: 1, + columns: [], + durationMs: 12, + truncated: true, + bytes: 1024, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createExecution('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createFailover()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createFailover(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateMaintenance()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.updateMaintenance( + '', + 'sun', + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createMigration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createMigration('', 'shared'); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listOperations()', async () => { + const data = { + total: 5, + operations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.listOperations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getPitr()', async () => { + const data = { + earliest: '2020-10-15T06:38:00.000+00:00', + latest: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.getPitr(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getPooler()', async () => { + const data = { + enabled: true, + mode: 'transaction', + maxConnections: 200, + defaultPoolSize: 25, + port: 6432, + readWriteSplitting: true, + poolerCpuRequest: '100m', + poolerCpuLimit: '200m', + poolerMemoryRequest: '64Mi', + poolerMemoryLimit: '128Mi', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.getPooler(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updatePooler()', async () => { + const data = { + enabled: true, + mode: 'transaction', + maxConnections: 200, + defaultPoolSize: 25, + port: 6432, + readWriteSplitting: true, + poolerCpuRequest: '100m', + poolerCpuLimit: '200m', + poolerMemoryRequest: '64Mi', + poolerMemoryLimit: '128Mi', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.updatePooler(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getReplicas()', async () => { + const data = { + replicas: 2, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + members: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.getReplicas(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listRestorations()', async () => { + const data = { + total: 5, + restorations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.listRestorations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createRestoration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + sourceDatabaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + backupId: '5e5ea5c16897e', + type: 'backup', + status: 'completed', + targetTime: '2020-10-15T06:38:00.000+00:00', + startedAt: '2020-10-15T06:38:00.000+00:00', + completedAt: '2020-10-15T06:38:00.000+00:00', + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createRestoration(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getRestoration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + sourceDatabaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + backupId: '5e5ea5c16897e', + type: 'backup', + status: 'completed', + targetTime: '2020-10-15T06:38:00.000+00:00', + startedAt: '2020-10-15T06:38:00.000+00:00', + completedAt: '2020-10-15T06:38:00.000+00:00', + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.getRestoration( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getStatus()', async () => { + const data = { + health: 'healthy', + ready: true, + engine: 'postgresql', + version: '17', + uptime: 86400, + connections: {}, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + replicas: [], + volumes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.getStatus(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createUpgrade()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await mysql.createUpgrade( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); +}); diff --git a/test/services/oauth2.test.js b/test/services/oauth2.test.js index b1bf4c4..7523dcf 100644 --- a/test/services/oauth2.test.js +++ b/test/services/oauth2.test.js @@ -1,152 +1,140 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Oauth2 } = require("../../dist/services/oauth-2"); +const { Client } = require('../../dist/client'); +const { Oauth2 } = require('../../dist/services/oauth-2'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Oauth2', () => { const client = new Client(); const oauth2 = new Oauth2(client); - test('test method approve()', async () => { - const data = { - 'redirectUrl': 'https://example.com/callback?code=abcde&state=fghij',}; + const data = { + redirectUrl: 'https://example.com/callback?code=abcde&state=fghij', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.approve( - '', - ); + const response = await oauth2.approve(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method authorize()', async () => { - const data = { - 'grantId': '5e5ea5c16897e', - 'redirectUrl': 'https://example.com/callback?code=abcde&state=fghij',}; + const data = { + grantId: '5e5ea5c16897e', + redirectUrl: 'https://example.com/callback?code=abcde&state=fghij', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.authorize( - ); + const response = await oauth2.authorize(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method authorizePost()', async () => { - const data = { - 'grantId': '5e5ea5c16897e', - 'redirectUrl': 'https://example.com/callback?code=abcde&state=fghij',}; + const data = { + grantId: '5e5ea5c16897e', + redirectUrl: 'https://example.com/callback?code=abcde&state=fghij', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.authorizePost( - ); + const response = await oauth2.authorizePost(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createDeviceAuthorization()', async () => { - const data = { - 'device_code': '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', - 'user_code': 'ABCD-EFGH', - 'verification_uri': 'https://cloud.appwrite.io/console/oauth2/device', - 'verification_uri_complete': 'https://cloud.appwrite.io/console/oauth2/device?user_code=ABCD-EFGH', - 'expires_in': 900, - 'interval': 5,}; + const data = { + device_code: + '5f3c8d2a1b9e4f7a6c8b2d1e9f4a7b3c5d8e1f2a9b4c7d6e3f5a8b1c4d7e2f9a', + user_code: 'ABCD-EFGH', + verification_uri: 'https://cloud.appwrite.io/console/oauth2/device', + verification_uri_complete: + 'https://cloud.appwrite.io/console/oauth2/device?user_code=ABCD-EFGH', + expires_in: 900, + interval: 5, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.createDeviceAuthorization( - ); + const response = await oauth2.createDeviceAuthorization(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createGrant()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'appId': '5e5ea5c16897e', - 'scopes': [], - 'resources': [], - 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', - 'prompt': 'login', - 'redirectUri': 'https://example.com/callback', - 'authTime': 1592981250, - 'expire': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + appId: '5e5ea5c16897e', + scopes: [], + resources: [], + authorizationDetails: + '[{\\"type\\":\\"calendar\\",\\"identifier\\":\\"primary\\",\\"actions\\":[\\"read_events\\",\\"create_event\\"]}]', + prompt: 'login', + redirectUri: 'https://example.com/callback', + authTime: 1592981250, + expire: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.createGrant( - '', - ); + const response = await oauth2.createGrant(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getGrant()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'appId': '5e5ea5c16897e', - 'scopes': [], - 'resources': [], - 'authorizationDetails': '[{\"type\":\"calendar\",\"identifier\":\"primary\",\"actions\":[\"read_events\",\"create_event\"]}]', - 'prompt': 'login', - 'redirectUri': 'https://example.com/callback', - 'authTime': 1592981250, - 'expire': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + appId: '5e5ea5c16897e', + scopes: [], + resources: [], + authorizationDetails: + '[{\\"type\\":\\"calendar\\",\\"identifier\\":\\"primary\\",\\"actions\\":[\\"read_events\\",\\"create_event\\"]}]', + prompt: 'login', + redirectUri: 'https://example.com/callback', + authTime: 1592981250, + expire: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.getGrant( - '', - ); + const response = await oauth2.getGrant(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listOrganizations()', async () => { - const data = { - 'total': 5, - 'organizations': [],}; + const data = { + total: 5, + organizations: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.listOrganizations( - ); + const response = await oauth2.listOrganizations(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createPAR()', async () => { - const data = { - 'request_uri': 'urn:appwrite:oauth2:request:5e5ea5c16897e', - 'expires_in': 600,}; + const data = { + request_uri: 'urn:appwrite:oauth2:request:5e5ea5c16897e', + expires_in: 600, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await oauth2.createPAR( '', 'https://example.com', @@ -158,67 +146,56 @@ describe('Oauth2', () => { expect(response).toEqual(data); }); - test('test method listProjects()', async () => { - const data = { - 'total': 5, - 'projects': [],}; + const data = { + total: 5, + projects: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.listProjects( - ); + const response = await oauth2.listProjects(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method reject()', async () => { - const data = { - 'redirectUrl': 'https://example.com/callback?error=access_denied&state=fghij',}; + const data = { + redirectUrl: + 'https://example.com/callback?error=access_denied&state=fghij', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.reject( - '', - ); + const response = await oauth2.reject(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method revoke()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.revoke( - '', - ); + const response = await oauth2.revoke(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createToken()', async () => { - const data = { - 'access_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...', - 'token_type': 'Bearer', - 'expires_in': 3600, - 'refresh_token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', - 'scope': 'openid email profile',}; + const data = { + access_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...', + token_type: 'Bearer', + expires_in: 3600, + refresh_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...', + scope: 'openid email profile', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await oauth2.createToken( - '', - ); + const response = await oauth2.createToken(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/organization.test.js b/test/services/organization.test.js index 70ae604..d01389a 100644 --- a/test/services/organization.test.js +++ b/test/services/organization.test.js @@ -1,391 +1,345 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Organization } = require("../../dist/services/organization"); +const { Client } = require('../../dist/client'); +const { Organization } = require('../../dist/services/organization'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Organization', () => { const client = new Client(); const organization = new Organization(client); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {}, - 'budgetAlerts': [], - 'billingPlan': 'tier-1', - 'billingPlanId': 'tier-1', - 'billingPlanDetails': {}, - 'billingEmail': 'billing@org.example', - 'billingStartDate': '2020-10-15T06:38:00.000+00:00', - 'billingCurrentInvoiceDate': '2020-10-15T06:38:00.000+00:00', - 'billingNextInvoiceDate': '2020-10-15T06:38:00.000+00:00', - 'billingTrialDays': 14, - 'billingAggregationId': 'adbc3de4rddfsd', - 'billingInvoiceId': 'adbc3de4rddfsd', - 'paymentMethodId': 'adbc3de4rddfsd', - 'status': 'active', - 'markedForDeletion': true, - 'platform': 'imagine', - 'projects': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'VIP', + total: 7, + prefs: {}, + budgetAlerts: [], + billingPlan: 'tier-1', + billingPlanId: 'tier-1', + billingPlanDetails: {}, + billingEmail: 'billing@org.example', + billingStartDate: '2020-10-15T06:38:00.000+00:00', + billingCurrentInvoiceDate: '2020-10-15T06:38:00.000+00:00', + billingNextInvoiceDate: '2020-10-15T06:38:00.000+00:00', + billingTrialDays: 14, + billingAggregationId: 'adbc3de4rddfsd', + billingInvoiceId: 'adbc3de4rddfsd', + paymentMethodId: 'adbc3de4rddfsd', + status: 'active', + markedForDeletion: true, + platform: 'imagine', + projects: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.get( - ); + const response = await organization.get(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {}, - 'budgetAlerts': [], - 'billingPlan': 'tier-1', - 'billingPlanId': 'tier-1', - 'billingPlanDetails': {}, - 'billingEmail': 'billing@org.example', - 'billingStartDate': '2020-10-15T06:38:00.000+00:00', - 'billingCurrentInvoiceDate': '2020-10-15T06:38:00.000+00:00', - 'billingNextInvoiceDate': '2020-10-15T06:38:00.000+00:00', - 'billingTrialDays': 14, - 'billingAggregationId': 'adbc3de4rddfsd', - 'billingInvoiceId': 'adbc3de4rddfsd', - 'paymentMethodId': 'adbc3de4rddfsd', - 'status': 'active', - 'markedForDeletion': true, - 'platform': 'imagine', - 'projects': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'VIP', + total: 7, + prefs: {}, + budgetAlerts: [], + billingPlan: 'tier-1', + billingPlanId: 'tier-1', + billingPlanDetails: {}, + billingEmail: 'billing@org.example', + billingStartDate: '2020-10-15T06:38:00.000+00:00', + billingCurrentInvoiceDate: '2020-10-15T06:38:00.000+00:00', + billingNextInvoiceDate: '2020-10-15T06:38:00.000+00:00', + billingTrialDays: 14, + billingAggregationId: 'adbc3de4rddfsd', + billingInvoiceId: 'adbc3de4rddfsd', + paymentMethodId: 'adbc3de4rddfsd', + status: 'active', + markedForDeletion: true, + platform: 'imagine', + projects: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.update( - '', - ); + const response = await organization.update(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.delete( - ); + const response = await organization.delete(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listInstallations()', async () => { - const data = { - 'total': 5, - 'installations': [],}; + const data = { + total: 5, + installations: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.listInstallations( - ); + const response = await organization.listInstallations(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createInstallation()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'teamId': '5e5ea5c16897e', - 'scopes': [], - 'authorizationDetails': {}, - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + teamId: '5e5ea5c16897e', + scopes: [], + authorizationDetails: [], + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.createInstallation( - '', - ); + const response = await organization.createInstallation(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getInstallation()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'teamId': '5e5ea5c16897e', - 'scopes': [], - 'authorizationDetails': {}, - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + teamId: '5e5ea5c16897e', + scopes: [], + authorizationDetails: [], + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.getInstallation( - '', - ); + const response = + await organization.getInstallation(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateInstallation()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'teamId': '5e5ea5c16897e', - 'scopes': [], - 'authorizationDetails': {}, - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + teamId: '5e5ea5c16897e', + scopes: [], + authorizationDetails: [], + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.updateInstallation( - '', - ); + const response = + await organization.updateInstallation(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteInstallation()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.deleteInstallation( - '', - ); + const response = + await organization.deleteInstallation(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listKeys()', async () => { - const data = { - 'total': 5, - 'keys': [],}; + const data = { + total: 5, + keys: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.listKeys( - ); + const response = await organization.listKeys(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.createKey( - '', - '', - [], - ); + const response = await organization.createKey('', '', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.getKey( - '', - ); + const response = await organization.getKey(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.updateKey( - '', - '', - [], - ); + const response = await organization.updateKey('', '', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteKey()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.deleteKey( - '', - ); + const response = await organization.deleteKey(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listMemberships()', async () => { - const data = { - 'total': 5, - 'memberships': [],}; + const data = { + total: 5, + memberships: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.listMemberships( - ); + const response = await organization.listMemberships(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'roles': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + userName: 'John Doe', + userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', + teamId: '5e5ea5c16897e', + teamName: 'VIP', + invited: '2020-10-15T06:38:00.000+00:00', + joined: '2020-10-15T06:38:00.000+00:00', + confirm: true, + mfa: true, + userAccessedAt: '2020-10-15T06:38:00.000+00:00', + roles: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.createMembership( - [], - ); + const response = await organization.createMembership([]); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'roles': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + userName: 'John Doe', + userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', + teamId: '5e5ea5c16897e', + teamName: 'VIP', + invited: '2020-10-15T06:38:00.000+00:00', + joined: '2020-10-15T06:38:00.000+00:00', + confirm: true, + mfa: true, + userAccessedAt: '2020-10-15T06:38:00.000+00:00', + roles: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.getMembership( - '', - ); + const response = await organization.getMembership(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'roles': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + userName: 'John Doe', + userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', + teamId: '5e5ea5c16897e', + teamName: 'VIP', + invited: '2020-10-15T06:38:00.000+00:00', + joined: '2020-10-15T06:38:00.000+00:00', + confirm: true, + mfa: true, + userAccessedAt: '2020-10-15T06:38:00.000+00:00', + roles: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await organization.updateMembership( '', [], @@ -396,70 +350,62 @@ describe('Organization', () => { expect(response).toEqual(data); }); - test('test method deleteMembership()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.deleteMembership( - '', - ); + const response = await organization.deleteMembership(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listProjects()', async () => { - const data = { - 'total': 5, - 'projects': [],}; + const data = { + total: 5, + projects: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.listProjects( - ); + const response = await organization.listProjects(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createProject()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await organization.createProject( - '', + '', '', ); @@ -468,81 +414,75 @@ describe('Organization', () => { expect(response).toEqual(data); }); - test('test method getProject()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.getProject( - '', - ); + const response = await organization.getProject(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateProject()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await organization.updateProject( '', '', @@ -553,18 +493,14 @@ describe('Organization', () => { expect(response).toEqual(data); }); - test('test method deleteProject()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await organization.deleteProject( - '', - ); + const response = await organization.deleteProject(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/postgresql.test.js b/test/services/postgresql.test.js new file mode 100644 index 0000000..eb277f2 --- /dev/null +++ b/test/services/postgresql.test.js @@ -0,0 +1,1183 @@ +const { Client } = require('../../dist/client'); +const { Postgresql } = require('../../dist/services/postgresql'); + +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); + +describe('Postgresql', () => { + const client = new Client(); + const postgresql = new Postgresql(client); + + test('test method list()', async () => { + const data = { + total: 5, + databases: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.list(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method create()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.create('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listSpecifications()', async () => { + const data = { + specifications: [], + total: 9, + pricing: {}, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.listSpecifications(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method get()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.get(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method update()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.update(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method delete()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.delete(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBackups()', async () => { + const data = { + total: 5, + backups: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.listBackups(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBackup()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + policyId: '5e5ea5c16897e', + trigger: 'schedule', + type: 'full', + requestedType: 'incremental', + fallbackReason: + 'PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.', + status: 'completed', + sizeBytes: 1073741824, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createBackup(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBackupPolicies()', async () => { + const data = { + total: 5, + policies: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.listBackupPolicies(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createBackupPolicy( + '', + '', + '', + '', + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.getBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateBackupPolicy()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'Hourly backups', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + services: [], + resources: [], + retention: 7, + schedule: '0 * * * *', + type: 'full', + enabled: true, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.updateBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBackupPolicy()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.deleteBackupPolicy( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateBackupStorage()', async () => { + const data = { + provider: 's3', + bucket: 'my-backup-bucket', + region: 'us-east-1', + prefix: 'backups/', + endpoint: 'https://minio.example.com', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.updateBackupStorage( + '', + 's3', + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getBackup()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + policyId: '5e5ea5c16897e', + trigger: 'schedule', + type: 'full', + requestedType: 'incremental', + fallbackReason: + 'PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.', + status: 'completed', + sizeBytes: 1073741824, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.getBackup( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBackup()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.deleteBackup( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listBranches()', async () => { + const data = { + total: 2, + branches: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.listBranches(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createBranch()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createBranch(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteBranch()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.deleteBranch( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateCredentials()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.updateCredentials(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createExecution()', async () => { + const data = { + rows: [], + rowCount: 1, + columns: [], + durationMs: 12, + truncated: true, + bytes: 1024, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createExecution( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listExtensions()', async () => { + const data = { + installed: [], + available: [], + metadata: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.listExtensions(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createExtension()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createExtension( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteExtension()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.deleteExtension( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createFailover()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createFailover(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateMaintenance()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.updateMaintenance( + '', + 'sun', + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createMigration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createMigration( + '', + 'shared', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listOperations()', async () => { + const data = { + total: 5, + operations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.listOperations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getPitr()', async () => { + const data = { + earliest: '2020-10-15T06:38:00.000+00:00', + latest: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.getPitr(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getPooler()', async () => { + const data = { + enabled: true, + mode: 'transaction', + maxConnections: 200, + defaultPoolSize: 25, + port: 6432, + readWriteSplitting: true, + poolerCpuRequest: '100m', + poolerCpuLimit: '200m', + poolerMemoryRequest: '64Mi', + poolerMemoryLimit: '128Mi', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.getPooler(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updatePooler()', async () => { + const data = { + enabled: true, + mode: 'transaction', + maxConnections: 200, + defaultPoolSize: 25, + port: 6432, + readWriteSplitting: true, + poolerCpuRequest: '100m', + poolerCpuLimit: '200m', + poolerMemoryRequest: '64Mi', + poolerMemoryLimit: '128Mi', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.updatePooler(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getReplicas()', async () => { + const data = { + replicas: 2, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + members: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.getReplicas(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listRestorations()', async () => { + const data = { + total: 5, + restorations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.listRestorations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createRestoration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + sourceDatabaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + backupId: '5e5ea5c16897e', + type: 'backup', + status: 'completed', + targetTime: '2020-10-15T06:38:00.000+00:00', + startedAt: '2020-10-15T06:38:00.000+00:00', + completedAt: '2020-10-15T06:38:00.000+00:00', + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createRestoration(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getRestoration()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + databaseId: '5e5ea5c16897e', + sourceDatabaseId: '5e5ea5c16897e', + projectId: '5e5ea5c16897e', + backupId: '5e5ea5c16897e', + type: 'backup', + status: 'completed', + targetTime: '2020-10-15T06:38:00.000+00:00', + startedAt: '2020-10-15T06:38:00.000+00:00', + completedAt: '2020-10-15T06:38:00.000+00:00', + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.getRestoration( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getStatus()', async () => { + const data = { + health: 'healthy', + ready: true, + engine: 'postgresql', + version: '17', + uptime: 86400, + connections: {}, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + replicas: [], + volumes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.getStatus(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createUpgrade()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await postgresql.createUpgrade( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); +}); diff --git a/test/services/presences.test.js b/test/services/presences.test.js index 5f570cc..b388216 100644 --- a/test/services/presences.test.js +++ b/test/services/presences.test.js @@ -1,60 +1,56 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Presences } = require("../../dist/services/presences"); +const { Client } = require('../../dist/client'); +const { Presences } = require('../../dist/services/presences'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Presences', () => { const client = new Client(); const presences = new Presences(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'presences': [],}; + const data = { + total: 5, + presences: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.list( - ); + const response = await presences.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + userId: '674af8f3e12a5f9ac0be', + source: 'HTTP', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.get( - '', - ); + const response = await presences.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method upsert()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + userId: '674af8f3e12a5f9ac0be', + source: 'HTTP', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await presences.upsert( '', '', @@ -66,39 +62,31 @@ describe('Presences', () => { expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + userId: '674af8f3e12a5f9ac0be', + source: 'HTTP', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.update( - '', - '', - ); + const response = await presences.update('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.delete( - '', - ); + const response = await presences.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/project.test.js b/test/services/project.test.js index 44703bc..0093f1e 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -1,387 +1,335 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Project } = require("../../dist/services/project"); +const { Client } = require('../../dist/client'); +const { Project } = require('../../dist/services/project'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Project', () => { const client = new Client(); const project = new Project(client); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.get( - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.get(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.delete( - ); + const response = await project.delete(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateAuthMethod()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateAuthMethod( - 'email-password', - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateAuthMethod('email-password', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listKeys()', async () => { - const data = { - 'total': 5, - 'keys': [],}; + const data = { + total: 5, + keys: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listKeys( - ); + const response = await project.listKeys(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createEphemeralKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createEphemeralKey( - [], - 1, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.createEphemeralKey([], 1); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getKey( - '', - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.getKey(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateKey( - '', - '', - [], - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateKey('', '', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteKey()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deleteKey( - '', - ); + const response = await project.deleteKey(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateLabels()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateLabels( - [], - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateLabels([]); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listMockPhones()', async () => { - const data = { - 'total': 5, - 'mockNumbers': [],}; + const data = { + total: 5, + mockNumbers: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listMockPhones( - ); + const response = await project.listMockPhones(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMockPhone()', async () => { - const data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + number: '+1612842323', + otp: '123456', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createMockPhone( - '+12065550100', - '', - ); + const response = await project.createMockPhone('+12065550100', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMockPhone()', async () => { - const data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + number: '+1612842323', + otp: '123456', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getMockPhone( - '+12065550100', - ); + const response = await project.getMockPhone('+12065550100'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMockPhone()', async () => { - const data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + number: '+1612842323', + otp: '123456', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateMockPhone( - '+12065550100', - '', - ); + const response = await project.updateMockPhone('+12065550100', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteMockPhone()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deleteMockPhone( - '+12065550100', - ); + const response = await project.deleteMockPhone('+12065550100'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listOAuth2Providers()', async () => { - const data = { - 'total': 5, - 'providers': [],}; + const data = { + total: 5, + providers: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listOAuth2Providers( - ); + const response = await project.listOAuth2Providers(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Server()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.updateOAuth2Server( true, 'https://example.com', @@ -392,799 +340,745 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method updateOAuth2Amazon()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', - 'clientSecret': '79ffe4000000000000000000000000000000000000000000000000000002de55',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: + 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + clientSecret: + '79ffe4000000000000000000000000000000000000000000000000000002de55', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Amazon( - ); + const response = await project.updateOAuth2Amazon(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Apple()', async () => { - const data = { - '\$id': 'apple', - 'enabled': true, - 'serviceId': 'ip.appwrite.app.web', - 'keyId': 'P4000000N8', - 'teamId': 'D4000000R6', - 'p8File': '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----',}; + const data = { + '\\$id': 'apple', + enabled: true, + serviceId: 'ip.appwrite.app.web', + keyId: 'P4000000N8', + teamId: 'D4000000R6', + p8File: '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Apple( - ); + const response = await project.updateOAuth2Apple(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Appwrite()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '6a42000000000000b5a0', - 'clientSecret': 'b86afd000000000000000000000000000000000000000000000000000ced5f93',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '6a42000000000000b5a0', + clientSecret: + 'b86afd000000000000000000000000000000000000000000000000000ced5f93', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Appwrite( - ); + const response = await project.updateOAuth2Appwrite(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Auth0()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'OaOkIA000000000000000000005KLSYq', - 'clientSecret': 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', - 'endpoint': 'example.us.auth0.com',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'OaOkIA000000000000000000005KLSYq', + clientSecret: + 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + endpoint: 'example.us.auth0.com', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Auth0( - ); + const response = await project.updateOAuth2Auth0(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Authentik()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', - 'clientSecret': 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', - 'endpoint': 'example.authentik.com',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'dTKOPa0000000000000000000000000000e7G8hv', + clientSecret: + 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + endpoint: 'example.authentik.com', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Authentik( - ); + const response = await project.updateOAuth2Authentik(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Autodesk()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '5zw90v00000000000000000000kVYXN7', - 'clientSecret': '7I000000000000MW',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '5zw90v00000000000000000000kVYXN7', + clientSecret: '7I000000000000MW', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Autodesk( - ); + const response = await project.updateOAuth2Autodesk(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Bitbucket()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'key': 'Knt70000000000ByRc', - 'secret': 'NMfLZJ00000000000000000000TLQdDx',}; + const data = { + '\\$id': 'github', + enabled: true, + key: 'Knt70000000000ByRc', + secret: 'NMfLZJ00000000000000000000TLQdDx', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Bitbucket( - ); + const response = await project.updateOAuth2Bitbucket(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Bitly()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'd95151000000000000000000000000000067af9b', - 'clientSecret': 'a13e250000000000000000000000000000d73095',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'd95151000000000000000000000000000067af9b', + clientSecret: 'a13e250000000000000000000000000000d73095', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Bitly( - ); + const response = await project.updateOAuth2Bitly(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Box()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'deglcs00000000000000000000x2og6y', - 'clientSecret': 'OKM1f100000000000000000000eshEif',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'deglcs00000000000000000000x2og6y', + clientSecret: 'OKM1f100000000000000000000eshEif', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Box( - ); + const response = await project.updateOAuth2Box(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Dailymotion()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'apiKey': '07a9000000000000067f', - 'apiSecret': 'a399a90000000000000000000000000000d90639',}; + const data = { + '\\$id': 'github', + enabled: true, + apiKey: '07a9000000000000067f', + apiSecret: 'a399a90000000000000000000000000000d90639', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Dailymotion( - ); + const response = await project.updateOAuth2Dailymotion(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Discord()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '950722000000343754', - 'clientSecret': 'YmPXnM000000000000000000002zFg5D',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '950722000000343754', + clientSecret: 'YmPXnM000000000000000000002zFg5D', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Discord( - ); + const response = await project.updateOAuth2Discord(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Disqus()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'publicKey': 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', - 'secretKey': 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9',}; + const data = { + '\\$id': 'github', + enabled: true, + publicKey: + 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + secretKey: + 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Disqus( - ); + const response = await project.updateOAuth2Disqus(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Dropbox()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'appKey': 'jl000000000009t', - 'appSecret': 'g200000000000vw',}; + const data = { + '\\$id': 'github', + enabled: true, + appKey: 'jl000000000009t', + appSecret: 'g200000000000vw', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Dropbox( - ); + const response = await project.updateOAuth2Dropbox(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Etsy()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'keyString': 'nsgzxh0000000000008j85a2', - 'sharedSecret': 'tp000000ru',}; + const data = { + '\\$id': 'github', + enabled: true, + keyString: 'nsgzxh0000000000008j85a2', + sharedSecret: 'tp000000ru', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Etsy( - ); + const response = await project.updateOAuth2Etsy(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Facebook()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'appId': '260600000007694', - 'appSecret': '2d0b2800000000000000000000d38af4',}; + const data = { + '\\$id': 'github', + enabled: true, + appId: '260600000007694', + appSecret: '2d0b2800000000000000000000d38af4', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Facebook( - ); + const response = await project.updateOAuth2Facebook(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Figma()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'byay5H0000000000VtiI40', - 'clientSecret': 'yEpOYn0000000000000000004iIsU5',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'byay5H0000000000VtiI40', + clientSecret: 'yEpOYn0000000000000000004iIsU5', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Figma( - ); + const response = await project.updateOAuth2Figma(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2FusionAuth()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'b2222c00-0000-0000-0000-000000862097', - 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', - 'endpoint': 'example.fusionauth.io',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'b2222c00-0000-0000-0000-000000862097', + clientSecret: 'Jx4s0C0000000000000000000000000000000wGqLsc', + endpoint: 'example.fusionauth.io', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2FusionAuth( - ); + const response = await project.updateOAuth2FusionAuth(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2GitHub()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'e4d87900000000540733', - 'clientSecret': '5e07c00000000000000000000000000000198bcc',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'e4d87900000000540733', + clientSecret: '5e07c00000000000000000000000000000198bcc', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2GitHub( - ); + const response = await project.updateOAuth2GitHub(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Gitlab()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', - 'secret': 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', - 'endpoint': 'https://gitlab.com',}; + const data = { + '\\$id': 'github', + enabled: true, + applicationId: + 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + secret: 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + endpoint: 'https://gitlab.com', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Gitlab( - ); + const response = await project.updateOAuth2Gitlab(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Google()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', - 'clientSecret': 'GOCSPX-2k8gsR0000000000000000VNahJj', - 'prompt': [],}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: + '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', + clientSecret: 'GOCSPX-2k8gsR0000000000000000VNahJj', + prompt: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateOAuth2Google(); - const response = await project.updateOAuth2Google( - ); + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateOAuth2HuggingFace()', async () => { + const data = { + '\\$id': 'github', + enabled: true, + clientId: '2ab9cff9-d711-40ad-a91e-b08a49c42d24', + clientSecret: 'oauth_app_secret_wcLhRtl000000000000000000000xbNdLt', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateOAuth2HuggingFace(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Keycloak()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'appwrite-o0000000st-app', - 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', - 'endpoint': 'keycloak.example.com', - 'realmName': 'appwrite-realm',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'appwrite-o0000000st-app', + clientSecret: 'jdjrJd00000000000000000000HUsaZO', + endpoint: 'keycloak.example.com', + realmName: 'appwrite-realm', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Keycloak( - ); + const response = await project.updateOAuth2Keycloak(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Kick()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '01KQ7C00000000000001MFHS32', - 'clientSecret': '34ac5600000000000000000000000000000000000000000000000000e830c8b',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '01KQ7C00000000000001MFHS32', + clientSecret: + '34ac5600000000000000000000000000000000000000000000000000e830c8b', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Kick( - ); + const response = await project.updateOAuth2Kick(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Linkedin()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '770000000000dv', - 'primaryClientSecret': 'WPL_AP1.2Bf0000000000000./HtlYw==',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '770000000000dv', + primaryClientSecret: 'WPL_AP1.2Bf0000000000000./HtlYw==', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Linkedin( - ); + const response = await project.updateOAuth2Linkedin(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Microsoft()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', - 'tenant': 'common',}; + const data = { + '\\$id': 'github', + enabled: true, + applicationId: '00001111-aaaa-2222-bbbb-3333cccc4444', + applicationSecret: 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + tenant: 'common', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Microsoft( - ); + const response = await project.updateOAuth2Microsoft(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Notion()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', - 'oauthClientSecret': 'secret_dLUr4b000000000000000000000000000000lFHAa9',}; + const data = { + '\\$id': 'github', + enabled: true, + oauthClientId: '341d8700-0000-0000-0000-000000446ee3', + oauthClientSecret: + 'secret_dLUr4b000000000000000000000000000000lFHAa9', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Notion( - ); + const response = await project.updateOAuth2Notion(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Oidc()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', - 'clientSecret': 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', - 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', - 'authorizationURL': 'https://myoauth.com/oauth2/authorize', - 'tokenURL': 'https://myoauth.com/oauth2/token', - 'userInfoURL': 'https://myoauth.com/oauth2/userinfo', - 'prompt': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Oidc( - ); + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'qibI2x0000000000000000000000000006L2YFoG', + clientSecret: + 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + wellKnownURL: + 'https://myoauth.com/.well-known/openid-configuration', + authorizationURL: 'https://myoauth.com/oauth2/authorize', + tokenURL: 'https://myoauth.com/oauth2/token', + userInfoURL: 'https://myoauth.com/oauth2/userinfo', + prompt: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateOAuth2Oidc(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Okta()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '0oa00000000000000698', - 'clientSecret': 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', - 'domain': 'trial-6400025.okta.com', - 'authorizationServerId': 'aus000000000000000h7z',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '0oa00000000000000698', + clientSecret: + 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + domain: 'trial-6400025.okta.com', + authorizationServerId: 'aus000000000000000h7z', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Okta( - ); + const response = await project.updateOAuth2Okta(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Paypal()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + secretKey: + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Paypal( - ); + const response = await project.updateOAuth2Paypal(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2PaypalSandbox()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + secretKey: + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2PaypalSandbox( - ); + const response = await project.updateOAuth2PaypalSandbox(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Podio()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'appwrite-oauth-test-app', - 'clientSecret': 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'appwrite-oauth-test-app', + clientSecret: + 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Podio( - ); + const response = await project.updateOAuth2Podio(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Salesforce()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'customerKey': '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', - 'customerSecret': '3w000000000000e2',}; + const data = { + '\\$id': 'github', + enabled: true, + customerKey: + '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + customerSecret: '3w000000000000e2', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Salesforce( - ); + const response = await project.updateOAuth2Salesforce(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Slack()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '23000000089.15000000000023', - 'clientSecret': '81656000000000000000000000f3d2fd',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '23000000089.15000000000023', + clientSecret: '81656000000000000000000000f3d2fd', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Slack( - ); + const response = await project.updateOAuth2Slack(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Spotify()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '6ec271000000000000000000009beace', - 'clientSecret': 'db068a000000000000000000008b5b9f',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '6ec271000000000000000000009beace', + clientSecret: 'db068a000000000000000000008b5b9f', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Spotify( - ); + const response = await project.updateOAuth2Spotify(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Stripe()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'ca_UKibXX0000000000000000000006byvR', - 'apiSecretKey': 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'ca_UKibXX0000000000000000000006byvR', + apiSecretKey: + 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Stripe( - ); + const response = await project.updateOAuth2Stripe(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Tradeshift()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + const data = { + '\\$id': 'github', + enabled: true, + oauth2ClientId: 'appwrite-test-org.appwrite-test-app', + oauth2ClientSecret: '7cb52700-0000-0000-0000-000000ca5b83', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Tradeshift( - ); + const response = await project.updateOAuth2Tradeshift(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2TradeshiftSandbox()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + const data = { + '\\$id': 'github', + enabled: true, + oauth2ClientId: 'appwrite-test-org.appwrite-test-app', + oauth2ClientSecret: '7cb52700-0000-0000-0000-000000ca5b83', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2TradeshiftSandbox( - ); + const response = await project.updateOAuth2TradeshiftSandbox(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Twitch()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'vvi0in000000000000000000ikmt9p', - 'clientSecret': 'pmapue000000000000000000zylw3v',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'vvi0in000000000000000000ikmt9p', + clientSecret: 'pmapue000000000000000000zylw3v', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Twitch( - ); + const response = await project.updateOAuth2Twitch(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2WordPress()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '130005', - 'clientSecret': 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '130005', + clientSecret: + 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2WordPress( - ); + const response = await project.updateOAuth2WordPress(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2X()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'customerKey': 'slzZV0000000000000NFLaWT', - 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9',}; + const data = { + '\\$id': 'github', + enabled: true, + customerKey: 'slzZV0000000000000NFLaWT', + secretKey: 'tkEPkp00000000000000000000000000000000000000FTxbI9', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2X( - ); + const response = await project.updateOAuth2X(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Yahoo()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', - 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: + 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + clientSecret: 'cf978f0000000000000000000000000000c5e2e9', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Yahoo( - ); + const response = await project.updateOAuth2Yahoo(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Yandex()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '6a8a6a0000000000000000000091483c', - 'clientSecret': 'bbf98500000000000000000000c75a63',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '6a8a6a0000000000000000000091483c', + clientSecret: 'bbf98500000000000000000000c75a63', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Yandex( - ); + const response = await project.updateOAuth2Yandex(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Zoho()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '1000.83C178000000000000000000RPNX0B', - 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: '1000.83C178000000000000000000RPNX0B', + clientSecret: 'fb5cac000000000000000000000000000000a68f6e', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Zoho( - ); + const response = await project.updateOAuth2Zoho(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateOAuth2Zoom()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'QMAC00000000000000w0AQ', - 'clientSecret': 'GAWsG4000000000000000000007U01ON',}; + const data = { + '\\$id': 'github', + enabled: true, + clientId: 'QMAC00000000000000w0AQ', + clientSecret: 'GAWsG4000000000000000000007U01ON', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Zoom( - ); + const response = await project.updateOAuth2Zoom(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getOAuth2Provider()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', - 'tenant': 'common',}; + const data = { + '\\$id': 'github', + enabled: true, + applicationId: '00001111-aaaa-2222-bbbb-3333cccc4444', + applicationSecret: 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + tenant: 'common', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getOAuth2Provider( - 'amazon', - ); + const response = await project.getOAuth2Provider('amazon'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listPlatforms()', async () => { - const data = { - 'total': 5, - 'platforms': [],}; + const data = { + total: 5, + platforms: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listPlatforms( - ); + const response = await project.listPlatforms(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createAndroidPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + applicationId: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.createAndroidPlatform( '', '', @@ -1196,17 +1090,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method updateAndroidPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + applicationId: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.updateAndroidPlatform( '', '', @@ -1218,17 +1111,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method createApplePlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + bundleIdentifier: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.createApplePlatform( '', '', @@ -1240,17 +1132,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method updateApplePlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + bundleIdentifier: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.updateApplePlatform( '', '', @@ -1262,17 +1153,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method createLinuxPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + packageName: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.createLinuxPlatform( '', '', @@ -1284,17 +1174,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method updateLinuxPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + packageName: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.updateLinuxPlatform( '', '', @@ -1306,17 +1195,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method createWebPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + hostname: 'app.example.com', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.createWebPlatform( '', '', @@ -1328,17 +1216,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method updateWebPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + hostname: 'app.example.com', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.updateWebPlatform( '', '', @@ -1350,17 +1237,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method createWindowsPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + packageIdentifierName: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.createWindowsPlatform( '', '', @@ -1372,17 +1258,16 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method updateWindowsPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + packageIdentifierName: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.updateWindowsPlatform( '', '', @@ -1394,904 +1279,808 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method getPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Web App', + type: 'web', + packageName: 'com.company.appname', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getPlatform( - '', - ); + const response = await project.getPlatform(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deletePlatform()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deletePlatform( - '', - ); + const response = await project.deletePlatform(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listPolicies()', async () => { - const data = { - 'total': 10, - 'policies': [],}; + const data = { + total: 10, + policies: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listPolicies( - ); + const response = await project.listPolicies(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateDenyAliasedEmailPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateDenyAliasedEmailPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateDenyAliasedEmailPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateDenyCorporateEmailPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateDenyCorporateEmailPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateDenyCorporateEmailPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateDenyDisposableEmailPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateDenyDisposableEmailPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateDenyDisposableEmailPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateDenyFreeEmailPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateDenyFreeEmailPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateDenyFreeEmailPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMembershipPrivacyPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateMembershipPrivacyPolicy( - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateMembershipPrivacyPolicy(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMFAFactorsPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateMFAFactorsPolicy( - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateMFAFactorsPolicy(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePasswordDictionaryPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updatePasswordDictionaryPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updatePasswordDictionaryPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePasswordHistoryPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updatePasswordHistoryPolicy( - 1, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updatePasswordHistoryPolicy(1); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePasswordPersonalDataPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updatePasswordPersonalDataPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updatePasswordPersonalDataPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePasswordStrengthPolicy()', async () => { - const data = { - '\$id': 'password-dictionary', - 'min': 12, - 'uppercase': true, - 'lowercase': true, - 'number': true, - 'symbols': true,}; + const data = { + '\\$id': 'password-dictionary', + min: 12, + uppercase: true, + lowercase: true, + number: true, + symbols: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updatePasswordStrengthPolicy( - ); + const response = await project.updatePasswordStrengthPolicy(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSessionAlertPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionAlertPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateSessionAlertPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSessionDurationPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionDurationPolicy( - 1, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateSessionDurationPolicy(1); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSessionInvalidationPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionInvalidationPolicy( - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateSessionInvalidationPolicy(true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSessionLimitPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionLimitPolicy( - 1, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateSessionLimitPolicy(1); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateUserLimitPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateUserLimitPolicy( - 1, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateUserLimitPolicy(1); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getPolicy()', async () => { - const data = { - '\$id': 'password-dictionary', - 'enabled': true,}; + const data = { + '\\$id': 'password-dictionary', + enabled: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getPolicy( - 'password-dictionary', - ); + const response = await project.getPolicy('password-dictionary'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateProtocol()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateProtocol( - 'rest', - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateProtocol('rest', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateService()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateService( - 'account', - true, - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateService('account', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSMTP()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'region': 'fra', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'smtp-password', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'onboarding': {}, - 'authMethods': [], - 'services': [], - 'protocols': [], - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'wafEnabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSMTP( - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'New Project', + teamId: '1592981250', + region: 'fra', + devKeys: [], + smtpEnabled: true, + smtpSenderName: 'John Appwrite', + smtpSenderEmail: 'john@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', + smtpHost: 'mail.appwrite.io', + smtpPort: 25, + smtpUsername: 'emailuser', + smtpPassword: 'smtp-password', + smtpSecure: 'tls', + pingCount: 1, + pingedAt: '2020-10-15T06:38:00.000+00:00', + labels: [], + status: 'active', + onboarding: {}, + authMethods: [], + services: [], + protocols: [], + blocks: [], + consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateSMTP(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSMTPTest()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createSMTPTest( - [], - ); + const response = await project.createSMTPTest([]); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listEmailTemplates()', async () => { - const data = { - 'total': 5, - 'templates': [],}; + const data = { + total: 5, + templates: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listEmailTemplates( - ); + const response = await project.listEmailTemplates(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateEmailTemplate()', async () => { - const data = { - 'templateId': 'verification', - 'locale': 'en_us', - 'message': 'Click on the link to verify your account.', - 'senderName': 'My User', - 'senderEmail': 'mail@appwrite.io', - 'replyToEmail': 'emails@appwrite.io', - 'replyToName': 'Support Team', - 'subject': 'Please verify your email address',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateEmailTemplate( - 'verification', - ); + const data = { + templateId: 'verification', + locale: 'en_us', + message: 'Click on the link to verify your account.', + senderName: 'My User', + senderEmail: 'mail@appwrite.io', + replyToEmail: 'emails@appwrite.io', + replyToName: 'Support Team', + subject: 'Please verify your email address', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateEmailTemplate('verification'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getEmailTemplate()', async () => { - const data = { - 'templateId': 'verification', - 'locale': 'en_us', - 'message': 'Click on the link to verify your account.', - 'senderName': 'My User', - 'senderEmail': 'mail@appwrite.io', - 'replyToEmail': 'emails@appwrite.io', - 'replyToName': 'Support Team', - 'subject': 'Please verify your email address',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getEmailTemplate( - 'verification', - ); + const data = { + templateId: 'verification', + locale: 'en_us', + message: 'Click on the link to verify your account.', + senderName: 'My User', + senderEmail: 'mail@appwrite.io', + replyToEmail: 'emails@appwrite.io', + replyToName: 'Support Team', + subject: 'Please verify your email address', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.getEmailTemplate('verification'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listVariables()', async () => { - const data = { - 'total': 5, - 'variables': [],}; + const data = { + total: 5, + variables: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listVariables( - ); + const response = await project.listVariables(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await project.createVariable( '', '', @@ -2303,62 +2092,52 @@ describe('Project', () => { expect(response).toEqual(data); }); - test('test method getVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getVariable( - '', - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.getVariable(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateVariable( - '', - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateVariable(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteVariable()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deleteVariable( - '', - ); + const response = await project.deleteVariable(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/proxy.test.js b/test/services/proxy.test.js index ebe4625..bf9d288 100644 --- a/test/services/proxy.test.js +++ b/test/services/proxy.test.js @@ -1,97 +1,89 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Proxy } = require("../../dist/services/proxy"); +const { Client } = require('../../dist/client'); +const { Proxy } = require('../../dist/services/proxy'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Proxy', () => { const client = new Client(); const proxy = new Proxy(client); - test('test method createInvalidation()', async () => { - const data = { - 'domain': 'appwrite.company.com', - 'type': 'tag', - 'reference': 'products', - 'status': 'success',}; + const data = { + domain: 'appwrite.company.com', + type: 'tag', + reference: 'products', + status: 'success', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.createInvalidation( - '', - 'tag', - ); + const response = await proxy.createInvalidation('example.com', 'tag'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listRules()', async () => { - const data = { - 'total': 5, - 'rules': [],}; + const data = { + total: 5, + rules: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.listRules( - ); + const response = await proxy.listRules(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createAPIRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: 'verified', + logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.createAPIRule( - '', - ); + const response = await proxy.createAPIRule('example.com'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createFunctionRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: 'verified', + logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await proxy.createFunctionRule( - '', + 'example.com', '', ); @@ -100,27 +92,26 @@ describe('Proxy', () => { expect(response).toEqual(data); }); - test('test method createRedirectRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: 'verified', + logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await proxy.createRedirectRule( - '', + 'example.com', 'https://example.com', '301', '', @@ -132,103 +123,89 @@ describe('Proxy', () => { expect(response).toEqual(data); }); - test('test method createSiteRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: 'verified', + logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.createSiteRule( - '', - '', - ); + const response = await proxy.createSiteRule('example.com', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: 'verified', + logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.getRule( - '', - ); + const response = await proxy.getRule(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteRule()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.deleteRule( - '', - ); + const response = await proxy.deleteRule(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateRuleStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: 'verified', + logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.updateRuleStatus( - '', - ); + const response = await proxy.updateRuleStatus(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/sites.test.js b/test/services/sites.test.js index 402a5d5..7b267ce 100644 --- a/test/services/sites.test.js +++ b/test/services/sites.test.js @@ -1,68 +1,69 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Sites } = require("../../dist/services/sites"); +const { Client } = require('../../dist/client'); +const { InputFile } = require('../../dist/inputFile'); +const { Sites } = require('../../dist/services/sites'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Sites', () => { const client = new Client(); const sites = new Sites(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'sites': [],}; + const data = { + total: 5, + sites: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.list( - ); + const response = await sites.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Site', + enabled: true, + live: true, + logging: true, + framework: 'react', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + deploymentScreenshotLight: '5e5ea5c16897e', + deploymentScreenshotDark: '5e5ea5c16897e', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + timeout: 300, + installCommand: 'npm install', + buildCommand: 'npm run build', + startCommand: 'node custom-server.mjs', + outputDirectory: 'build', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'sites/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + buildRuntime: 'node-22', + adapter: 'static', + fallbackFile: 'index.html', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.create( '', '', @@ -75,187 +76,173 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method listFrameworks()', async () => { - const data = { - 'total': 5, - 'frameworks': [],}; + const data = { + total: 5, + frameworks: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listFrameworks( - ); + const response = await sites.listFrameworks(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listSpecifications()', async () => { - const data = { - 'total': 5, - 'specifications': [],}; + const data = { + total: 5, + specifications: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listSpecifications( - ); + const response = await sites.listSpecifications(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Site', + enabled: true, + live: true, + logging: true, + framework: 'react', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + deploymentScreenshotLight: '5e5ea5c16897e', + deploymentScreenshotDark: '5e5ea5c16897e', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + timeout: 300, + installCommand: 'npm install', + buildCommand: 'npm run build', + startCommand: 'node custom-server.mjs', + outputDirectory: 'build', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'sites/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + buildRuntime: 'node-22', + adapter: 'static', + fallbackFile: 'index.html', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.get( - '', - ); + const response = await sites.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Site', + enabled: true, + live: true, + logging: true, + framework: 'react', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + deploymentScreenshotLight: '5e5ea5c16897e', + deploymentScreenshotDark: '5e5ea5c16897e', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + timeout: 300, + installCommand: 'npm install', + buildCommand: 'npm run build', + startCommand: 'node custom-server.mjs', + outputDirectory: 'build', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'sites/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + buildRuntime: 'node-22', + adapter: 'static', + fallbackFile: 'index.html', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.update( - '', - '', - 'analog', - ); + const response = await sites.update('', '', 'analog'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.delete( - '', - ); + const response = await sites.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSiteDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'providerBranches': [], - 'providerPaths': [], - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Site', + enabled: true, + live: true, + logging: true, + framework: 'react', + deploymentRetention: 7, + deploymentId: '5e5ea5c16897e', + deploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + deploymentScreenshotLight: '5e5ea5c16897e', + deploymentScreenshotDark: '5e5ea5c16897e', + latestDeploymentId: '5e5ea5c16897e', + latestDeploymentCreatedAt: '2020-10-15T06:38:00.000+00:00', + latestDeploymentStatus: 'ready', + scopes: [], + vars: [], + timeout: 300, + installCommand: 'npm install', + buildCommand: 'npm run build', + startCommand: 'node custom-server.mjs', + outputDirectory: 'build', + installationId: '6m40at4ejk5h2u9s1hboo', + providerRepositoryId: 'appwrite', + providerBranch: 'main', + providerRootDirectory: 'sites/helloWorld', + providerSilentMode: true, + providerBranches: [], + providerPaths: [], + buildSpecification: 's-1vcpu-512mb', + runtimeSpecification: 's-1vcpu-512mb', + buildRuntime: 'node-22', + adapter: 'static', + fallbackFile: 'index.html', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.updateSiteDeployment( '', '', @@ -266,54 +253,53 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method listDeployments()', async () => { - const data = { - 'total': 5, - 'deployments': [],}; + const data = { + total: 5, + deployments: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listDeployments( - '', - ); + const response = await sites.listDeployments(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.createDeployment( '', InputFile.fromBuffer(new Uint8Array(0), 'image.png'), @@ -324,38 +310,40 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method createDuplicateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.createDuplicateDeployment( '', '', @@ -366,38 +354,40 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method createTemplateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.createTemplateDeployment( '', '', @@ -412,38 +402,40 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method createVcsDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.createVcsDeployment( '', 'branch', @@ -455,38 +447,40 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method getDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.getDeployment( '', '', @@ -497,11 +491,9 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method deleteDeployment()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.deleteDeployment( '', '', @@ -512,11 +504,9 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method getDeploymentDownload()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - const response = await sites.getDeploymentDownload( '', '', @@ -527,38 +517,40 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method updateDeploymentStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + type: 'vcs', + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + entrypoint: 'index.js', + sourceSize: 128, + buildSize: 128, + totalSize: 128, + buildId: '5e5ea5c16897e', + activate: true, + screenshotLight: '5e5ea5c16897e', + screenshotDark: '5e5ea5c16897e', + status: 'ready', + buildLogs: 'Compiling source files...', + buildDuration: 128, + providerRepositoryName: 'database', + providerRepositoryOwner: 'utopia', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', + providerCommitHash: '7c3f25d', + providerCommitAuthorUrl: 'https://github.com/vermakhushboo', + providerCommitAuthor: 'Khushboo Verma', + providerCommitMessage: 'Update index.js', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerBranch: '0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.updateDeploymentStatus( '', '', @@ -569,98 +561,83 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method listLogs()', async () => { - const data = { - 'total': 5, - 'executions': [],}; + const data = { + total: 5, + executions: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listLogs( - '', - ); + const response = await sites.listLogs(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getLog()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + resourceId: '5e5ea6g16897e', + resourceType: 'functions', + deploymentId: '5e5ea5c16897e', + trigger: 'http', + status: 'processing', + requestMethod: 'GET', + requestPath: '/articles?id=5', + requestHeaders: [], + responseStatusCode: 200, + responseBody: '', + responseHeaders: [], + logs: '', + errors: '', + duration: 0.4, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.getLog( - '', - '', - ); + const response = await sites.getLog('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteLog()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.deleteLog( - '', - '', - ); + const response = await sites.deleteLog('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listVariables()', async () => { - const data = { - 'total': 5, - 'variables': [],}; + const data = { + total: 5, + variables: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listVariables( - '', - ); + const response = await sites.listVariables(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.createVariable( '', '', @@ -673,42 +650,37 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method getVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.getVariable( - '', - '', - ); + const response = await sites.getVariable('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'API_KEY', + value: 'myPa\\$\\$word1', + secret: true, + resourceType: 'function', + resourceId: 'myAwesomeFunction', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.updateVariable( '', '', @@ -719,11 +691,9 @@ describe('Sites', () => { expect(response).toEqual(data); }); - test('test method deleteVariable()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await sites.deleteVariable( '', '', @@ -734,4 +704,4 @@ describe('Sites', () => { expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/storage.test.js b/test/services/storage.test.js index 761c156..7f35319 100644 --- a/test/services/storage.test.js +++ b/test/services/storage.test.js @@ -1,166 +1,148 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Storage } = require("../../dist/services/storage"); +const { Client } = require('../../dist/client'); +const { InputFile } = require('../../dist/inputFile'); +const { Storage } = require('../../dist/services/storage'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Storage', () => { const client = new Client(); const storage = new Storage(client); - test('test method listBuckets()', async () => { - const data = { - 'total': 5, - 'buckets': [],}; + const data = { + total: 5, + buckets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.listBuckets( - ); + const response = await storage.listBuckets(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createBucket()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + fileSecurity: true, + name: 'Documents', + enabled: true, + maximumFileSize: 100, + allowedFileExtensions: [], + compression: 'gzip', + encryption: true, + antivirus: true, + transformations: true, + totalSize: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.createBucket( - '', - '', - ); + const response = await storage.createBucket('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getBucket()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + fileSecurity: true, + name: 'Documents', + enabled: true, + maximumFileSize: 100, + allowedFileExtensions: [], + compression: 'gzip', + encryption: true, + antivirus: true, + transformations: true, + totalSize: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.getBucket( - '', - ); + const response = await storage.getBucket(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateBucket()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + fileSecurity: true, + name: 'Documents', + enabled: true, + maximumFileSize: 100, + allowedFileExtensions: [], + compression: 'gzip', + encryption: true, + antivirus: true, + transformations: true, + totalSize: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.updateBucket( - '', - '', - ); + const response = await storage.updateBucket('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteBucket()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.deleteBucket( - '', - ); + const response = await storage.deleteBucket(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listFiles()', async () => { - const data = { - 'total': 5, - 'files': [],}; + const data = { + total: 5, + files: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.listFiles( - '', - ); + const response = await storage.listFiles(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createFile()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'folder': 'photos/2026/', - 'key': 'photos/2026/Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'sizeActual': 12345, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; + const data = { + '\\$id': '5e5ea5c16897e', + bucketId: '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + name: 'Pink.png', + folder: 'photos/2026/', + key: 'photos/2026/Pink.png', + signature: '5d529fd02b544198ae075bd57c1762bb', + mimeType: 'image/png', + sizeOriginal: 17890, + sizeActual: 12345, + chunksTotal: 17890, + chunksUploaded: 17890, + encryption: true, + compression: 'gzip', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await storage.createFile( '', '', @@ -172,88 +154,73 @@ describe('Storage', () => { expect(response).toEqual(data); }); - test('test method getFile()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'folder': 'photos/2026/', - 'key': 'photos/2026/Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'sizeActual': 12345, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; + const data = { + '\\$id': '5e5ea5c16897e', + bucketId: '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + name: 'Pink.png', + folder: 'photos/2026/', + key: 'photos/2026/Pink.png', + signature: '5d529fd02b544198ae075bd57c1762bb', + mimeType: 'image/png', + sizeOriginal: 17890, + sizeActual: 12345, + chunksTotal: 17890, + chunksUploaded: 17890, + encryption: true, + compression: 'gzip', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.getFile( - '', - '', - ); + const response = await storage.getFile('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateFile()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'folder': 'photos/2026/', - 'key': 'photos/2026/Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'sizeActual': 12345, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; + const data = { + '\\$id': '5e5ea5c16897e', + bucketId: '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + name: 'Pink.png', + folder: 'photos/2026/', + key: 'photos/2026/Pink.png', + signature: '5d529fd02b544198ae075bd57c1762bb', + mimeType: 'image/png', + sizeOriginal: 17890, + sizeActual: 12345, + chunksTotal: 17890, + chunksUploaded: 17890, + encryption: true, + compression: 'gzip', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.updateFile( - '', - '', - ); + const response = await storage.updateFile('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteFile()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.deleteFile( - '', - '', - ); + const response = await storage.deleteFile('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getFileDownload()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - const response = await storage.getFileDownload( '', '', @@ -264,11 +231,9 @@ describe('Storage', () => { expect(response).toEqual(data); }); - test('test method getFilePreview()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - const response = await storage.getFilePreview( '', '', @@ -279,19 +244,14 @@ describe('Storage', () => { expect(response).toEqual(data); }); - test('test method getFileView()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); - - const response = await storage.getFileView( - '', - '', - ); + const response = await storage.getFileView('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/tables-d-b.test.js b/test/services/tables-d-b.test.js index c039340..21e3719 100644 --- a/test/services/tables-d-b.test.js +++ b/test/services/tables-d-b.test.js @@ -1,325 +1,287 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { TablesDB } = require("../../dist/services/tables-db"); +const { Client } = require('../../dist/client'); +const { TablesDB } = require('../../dist/services/tables-db'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('TablesDB', () => { const client = new Client(); const tablesDB = new TablesDB(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'databases': [],}; + const data = { + total: 5, + databases: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.list( - ); + const response = await tablesDB.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy',}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.create( - '', - '', - ); + const response = await tablesDB.create('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listSpecifications()', async () => { - const data = { - 'specifications': [], - 'total': 9, - 'pricing': {},}; + const data = { + specifications: [], + total: 9, + pricing: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listSpecifications( - ); + const response = await tablesDB.listSpecifications(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listTransactions()', async () => { - const data = { - 'total': 5, - 'transactions': [],}; + const data = { + total: 5, + transactions: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listTransactions( - ); + const response = await tablesDB.listTransactions(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createTransaction( - ); + const response = await tablesDB.createTransaction(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getTransaction( - '', - ); + const response = await tablesDB.getTransaction(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateTransaction( - '', - ); + const response = await tablesDB.updateTransaction(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteTransaction()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.deleteTransaction( - '', - ); + const response = await tablesDB.deleteTransaction(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createOperations()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createOperations( - '', - ); + const response = await tablesDB.createOperations(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy',}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.get( - '', - ); + const response = await tablesDB.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy',}; + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.update( - '', - ); + const response = await tablesDB.update(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.delete( - '', - ); + const response = await tablesDB.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createFailover()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'projectId': '5e5ea5c16897e', - 'name': 'My Production Database', - 'api': 'postgresql', - 'engine': 'postgresql', - 'version': '16', - 'specification': 's-2vcpu-2gb', - 'backend': 'edge', - 'hostname': 'db-myproject-mydb.fra.appwrite.center', - 'connectionPort': 5432, - 'connectionUser': 'appwrite_user', - 'connectionPassword': '••••••••', - 'connectionString': 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', - 'ssl': true, - 'status': 'ready', - 'containerStatus': 'active', - 'lifecycleState': 'active', - 'idleTimeoutMinutes': 15, - 'cpu': 2000, - 'memory': 4096, - 'storage': 100, - 'storageClass': 'ssd', - 'storageMaxGb': 100, - 'nodePool': 'db-pool-4vcpu-8gb', - 'replicas': 2, - 'syncMode': 'async', - 'networkMaxConnections': 500, - 'networkIdleTimeoutSeconds': 900, - 'networkIPAllowlist': [], - 'backupEnabled': true, - 'pitr': true, - 'pitrRetentionDays': 14, - 'storageAutoscaling': true, - 'storageAutoscalingThresholdPercent': 85, - 'storageAutoscalingMaxGb': 500, - 'maintenanceWindowDay': 'sun', - 'maintenanceWindowHourUtc': 3, - 'metricsEnabled': true, - 'sqlApiEnabled': true, - 'sqlApiAllowedStatements': [], - 'sqlApiMaxRows': 10000, - 'sqlApiMaxBytes': 10485760, - 'sqlApiTimeoutSeconds': 30, - 'error': '',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createFailover( - '', - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await tablesDB.createFailover(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listMigrations()', async () => { - const data = { - 'total': 5, - 'migrations': [],}; + const data = { + total: 5, + migrations: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listMigrations( - '', - ); + const response = await tablesDB.listMigrations(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMigration()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'projectId': '5e5ea5c16897e', - 'databaseId': '5e5ea5c16897e', - 'specification': 's-2vcpu-4gb', - 'phase': 'pending', - 'attempt': 0, - 'lastError': '', - 'lagDocuments': 0, - 'verifiedAt': '2020-10-15T06:38:00.000+00:00', - 'cutoverAt': '2020-10-15T06:38:00.000+00:00', - 'soakUntil': '2020-10-15T06:38:00.000+00:00', - 'autoCutover': true, - 'cutoverRequested': true, - 'paused': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + databaseId: '5e5ea5c16897e', + specification: 's-2vcpu-4gb', + phase: 'pending', + attempt: 0, + lastError: '', + lagDocuments: 0, + changelogWatermark: 0, + verifiedAt: '2020-10-15T06:38:00.000+00:00', + cutoverAt: '2020-10-15T06:38:00.000+00:00', + soakUntil: '2020-10-15T06:38:00.000+00:00', + autoCutover: true, + cutoverRequested: true, + paused: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createMigration( '', 's-1vcpu-1gb', @@ -330,27 +292,27 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method getMigration()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'projectId': '5e5ea5c16897e', - 'databaseId': '5e5ea5c16897e', - 'specification': 's-2vcpu-4gb', - 'phase': 'pending', - 'attempt': 0, - 'lastError': '', - 'lagDocuments': 0, - 'verifiedAt': '2020-10-15T06:38:00.000+00:00', - 'cutoverAt': '2020-10-15T06:38:00.000+00:00', - 'soakUntil': '2020-10-15T06:38:00.000+00:00', - 'autoCutover': true, - 'cutoverRequested': true, - 'paused': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + databaseId: '5e5ea5c16897e', + specification: 's-2vcpu-4gb', + phase: 'pending', + attempt: 0, + lastError: '', + lagDocuments: 0, + changelogWatermark: 0, + verifiedAt: '2020-10-15T06:38:00.000+00:00', + cutoverAt: '2020-10-15T06:38:00.000+00:00', + soakUntil: '2020-10-15T06:38:00.000+00:00', + autoCutover: true, + cutoverRequested: true, + paused: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.getMigration( '', '', @@ -361,11 +323,9 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method deleteMigration()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.deleteMigration( '', '', @@ -376,27 +336,27 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method cutoverMigration()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'projectId': '5e5ea5c16897e', - 'databaseId': '5e5ea5c16897e', - 'specification': 's-2vcpu-4gb', - 'phase': 'pending', - 'attempt': 0, - 'lastError': '', - 'lagDocuments': 0, - 'verifiedAt': '2020-10-15T06:38:00.000+00:00', - 'cutoverAt': '2020-10-15T06:38:00.000+00:00', - 'soakUntil': '2020-10-15T06:38:00.000+00:00', - 'autoCutover': true, - 'cutoverRequested': true, - 'paused': true,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + databaseId: '5e5ea5c16897e', + specification: 's-2vcpu-4gb', + phase: 'pending', + attempt: 0, + lastError: '', + lagDocuments: 0, + changelogWatermark: 0, + verifiedAt: '2020-10-15T06:38:00.000+00:00', + cutoverAt: '2020-10-15T06:38:00.000+00:00', + soakUntil: '2020-10-15T06:38:00.000+00:00', + autoCutover: true, + cutoverRequested: true, + paused: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.cutoverMigration( '', '', @@ -407,101 +367,88 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method listOperations()', async () => { - const data = { - 'total': 5, - 'operations': [],}; + const data = { + total: 5, + operations: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listOperations( - '', - ); + const response = await tablesDB.listOperations(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getReplicas()', async () => { - const data = { - 'replicas': 2, - 'syncMode': 'async', - 'syncDegraded': true, - 'syncAcknowledgements': 1, - 'syncStandbyCount': 2, - 'members': [],}; + const data = { + replicas: 2, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + members: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getReplicas( - '', - ); + const response = await tablesDB.getReplicas(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getStatus()', async () => { - const data = { - 'health': 'healthy', - 'ready': true, - 'engine': 'postgresql', - 'version': '17', - 'uptime': 86400, - 'connections': {}, - 'syncMode': 'async', - 'syncDegraded': true, - 'syncAcknowledgements': 1, - 'syncStandbyCount': 2, - 'replicas': [], - 'volumes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getStatus( - '', - ); + const data = { + health: 'healthy', + ready: true, + engine: 'postgresql', + version: '17', + uptime: 86400, + connections: {}, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + replicas: [], + volumes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await tablesDB.getStatus(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listTables()', async () => { - const data = { - 'total': 5, - 'tables': [],}; + const data = { + total: 5, + tables: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listTables( - '', - ); + const response = await tablesDB.listTables(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Table', + enabled: true, + rowSecurity: true, + columns: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createTable( '', '', @@ -513,50 +460,45 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method getTable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getTable( - '', - '', - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Table', + enabled: true, + rowSecurity: true, + columns: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await tablesDB.getTable('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateTable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Table', + enabled: true, + rowSecurity: true, + columns: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateTable( '', '', @@ -567,11 +509,9 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method deleteTable()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.deleteTable( '', '', @@ -582,13 +522,12 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method listColumns()', async () => { - const data = { - 'total': 5, - 'columns': [],}; + const data = { + total: 5, + columns: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.listColumns( '', '', @@ -599,22 +538,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createBigIntColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'bigint', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createBigIntColumn( '', '', - '', + '', true, ); @@ -623,22 +561,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateBigIntColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'bigint', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateBigIntColumn( '', '', - '', + '', true, 1, ); @@ -648,22 +585,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createBooleanColumn()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'isEnabled', + type: 'boolean', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createBooleanColumn( '', '', - '', + '', true, ); @@ -672,22 +608,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateBooleanColumn()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'isEnabled', + type: 'boolean', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateBooleanColumn( '', '', - '', + '', true, true, ); @@ -697,23 +632,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createDatetimeColumn()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; + const data = { + key: 'birthDay', + type: 'datetime', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createDatetimeColumn( '', '', - '', + '', true, ); @@ -722,23 +656,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateDatetimeColumn()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; + const data = { + key: 'birthDay', + type: 'datetime', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'datetime', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateDatetimeColumn( '', '', - '', + '', true, '2020-10-15T06:38:00.000+00:00', ); @@ -748,23 +681,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createEmailColumn()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; + const data = { + key: 'userEmail', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'email', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createEmailColumn( '', '', - '', + '', true, ); @@ -773,23 +705,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateEmailColumn()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; + const data = { + key: 'userEmail', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'email', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateEmailColumn( '', '', - '', + '', true, 'email@example.com', ); @@ -799,24 +730,23 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createEnumColumn()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; + const data = { + key: 'status', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + elements: [], + format: 'enum', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createEnumColumn( '', '', - '', + '', [], true, ); @@ -826,27 +756,26 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateEnumColumn()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; + const data = { + key: 'status', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + elements: [], + format: 'enum', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateEnumColumn( '', '', - '', + '', [], true, - '', + 'active', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -854,22 +783,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createFloatColumn()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'percentageCompleted', + type: 'double', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createFloatColumn( '', '', - '', + '', true, ); @@ -878,22 +806,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateFloatColumn()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'percentageCompleted', + type: 'double', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateFloatColumn( '', '', - '', + '', true, 1.0, ); @@ -903,22 +830,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createIntegerColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'integer', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createIntegerColumn( '', '', - '', + '', true, ); @@ -927,22 +853,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateIntegerColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'count', + type: 'integer', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateIntegerColumn( '', '', - '', + '', true, 1, ); @@ -952,23 +877,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createIpColumn()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; + const data = { + key: 'ipAddress', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'ip', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createIpColumn( '', '', - '', + '', true, ); @@ -977,25 +901,24 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateIpColumn()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; + const data = { + key: 'ipAddress', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'ip', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateIpColumn( '', '', - '', + '', true, - '', + '192.0.2.0', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1003,22 +926,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createLineColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createLineColumn( '', '', - '', + '', true, ); @@ -1027,22 +949,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateLineColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateLineColumn( '', '', - '', + '', true, ); @@ -1051,22 +972,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createLongtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createLongtextColumn( '', '', - '', + '', true, ); @@ -1075,24 +995,23 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateLongtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateLongtextColumn( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1100,22 +1019,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createMediumtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createMediumtextColumn( '', '', - '', + '', true, ); @@ -1124,24 +1042,23 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateMediumtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateMediumtextColumn( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1149,22 +1066,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createPointColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createPointColumn( '', '', - '', + '', true, ); @@ -1173,22 +1089,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updatePointColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updatePointColumn( '', '', - '', + '', true, ); @@ -1197,22 +1112,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createPolygonColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createPolygonColumn( '', '', - '', + '', true, ); @@ -1221,22 +1135,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updatePolygonColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updatePolygonColumn( '', '', - '', + '', true, ); @@ -1245,24 +1158,23 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createRelationshipColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + relatedTable: 'table', + relationType: 'oneToOne|oneToMany|manyToOne|manyToMany', + twoWay: true, + twoWayKey: 'string', + onDelete: 'restrict|cascade|setNull', + side: 'parent|child', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createRelationshipColumn( '', '', @@ -1275,23 +1187,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createStringColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createStringColumn( '', '', - '', + '', 1, true, ); @@ -1301,25 +1212,24 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateStringColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateStringColumn( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1327,22 +1237,21 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createTextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createTextColumn( '', '', - '', + '', true, ); @@ -1351,24 +1260,23 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateTextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateTextColumn( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1376,23 +1284,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createUrlColumn()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; + const data = { + key: 'githubUrl', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'url', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createUrlColumn( '', '', - '', + '', true, ); @@ -1401,23 +1308,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateUrlColumn()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; + const data = { + key: 'githubUrl', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + format: 'url', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateUrlColumn( '', '', - '', + '', true, 'https://example.com', ); @@ -1427,23 +1333,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createVarcharColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createVarcharColumn( '', '', - '', + '', 1, true, ); @@ -1453,25 +1358,24 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateVarcharColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateVarcharColumn( '', '', - '', + '', true, - '', + 'Hello World', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1479,23 +1383,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method getColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + size: 128, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.getColumn( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1503,15 +1406,13 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method deleteColumn()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.deleteColumn( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1519,28 +1420,27 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateRelationshipColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; + const data = { + key: 'fullName', + type: 'string', + status: 'available', + error: 'string', + required: true, + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + relatedTable: 'table', + relationType: 'oneToOne|oneToMany|manyToOne|manyToMany', + twoWay: true, + twoWayKey: 'string', + onDelete: 'restrict|cascade|setNull', + side: 'parent|child', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateRelationshipColumn( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1548,13 +1448,12 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method listIndexes()', async () => { - const data = { - 'total': 5, - 'indexes': [],}; + const data = { + total: 5, + indexes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.listIndexes( '', '', @@ -1565,24 +1464,23 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + columns: [], + lengths: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createIndex( '', '', - '', + '', 'key', [], ); @@ -1592,24 +1490,23 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method getIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + columns: [], + lengths: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.getIndex( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1617,15 +1514,13 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method deleteIndex()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.deleteIndex( '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1633,35 +1528,30 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method listRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; + const data = { + total: 5, + rows: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listRows( - '', - '', - ); + const response = await tablesDB.listRows('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$tableId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createRow( '', '', @@ -1674,13 +1564,12 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method createRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; + const data = { + total: 5, + rows: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.createRows( '', '', @@ -1692,13 +1581,12 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method upsertRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; + const data = { + total: 5, + rows: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.upsertRows( '', '', @@ -1710,13 +1598,12 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; + const data = { + total: 5, + rows: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateRows( '', '', @@ -1727,13 +1614,12 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method deleteRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; + const data = { + total: 5, + rows: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.deleteRows( '', '', @@ -1744,18 +1630,17 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method getRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$tableId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.getRow( '', '', @@ -1767,18 +1652,17 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method upsertRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$tableId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.upsertRow( '', '', @@ -1790,18 +1674,17 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method updateRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$tableId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.updateRow( '', '', @@ -1813,11 +1696,9 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method deleteRow()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.deleteRow( '', '', @@ -1829,23 +1710,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method decrementRowColumn()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$tableId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.decrementRowColumn( '', '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1853,23 +1733,22 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - test('test method incrementRowColumn()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$tableId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tablesDB.incrementRowColumn( '', '', '', - '', + '', ); // Remove custom toString method on the objects to allow for clean data comparison. @@ -1877,4 +1756,4 @@ describe('TablesDB', () => { expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/teams.test.js b/test/services/teams.test.js index dfa5365..7dcf744 100644 --- a/test/services/teams.test.js +++ b/test/services/teams.test.js @@ -1,135 +1,116 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Teams } = require("../../dist/services/teams"); +const { Client } = require('../../dist/client'); +const { Teams } = require('../../dist/services/teams'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Teams', () => { const client = new Client(); const teams = new Teams(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'teams': [],}; + const data = { + total: 5, + teams: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.list( - ); + const response = await teams.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'VIP', + total: 7, + prefs: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.create( - '', - '', - ); + const response = await teams.create('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'VIP', + total: 7, + prefs: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.get( - '', - ); + const response = await teams.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateName()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'VIP', + total: 7, + prefs: {}, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.updateName( - '', - '', - ); + const response = await teams.updateName('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.delete( - '', - ); + const response = await teams.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listInstallations()', async () => { - const data = { - 'total': 5, - 'installations': [],}; + const data = { + total: 5, + installations: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.listInstallations( - '', - ); + const response = await teams.listInstallations(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createInstallation()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'teamId': '5e5ea5c16897e', - 'scopes': [], - 'authorizationDetails': {}, - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + teamId: '5e5ea5c16897e', + scopes: [], + authorizationDetails: [], + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.createInstallation( '', '', @@ -140,20 +121,19 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method getInstallation()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'teamId': '5e5ea5c16897e', - 'scopes': [], - 'authorizationDetails': {}, - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + teamId: '5e5ea5c16897e', + scopes: [], + authorizationDetails: [], + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.getInstallation( '', '', @@ -164,20 +144,19 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method updateInstallation()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'teamId': '5e5ea5c16897e', - 'scopes': [], - 'authorizationDetails': {}, - 'createdById': '5e5ea5c16897e', - 'createdByName': 'Walter White',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + appId: '5e5ea5c16897e', + teamId: '5e5ea5c16897e', + scopes: [], + authorizationDetails: [], + createdById: '5e5ea5c16897e', + createdByName: 'Walter White', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.updateInstallation( '', '', @@ -188,11 +167,9 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method deleteInstallation()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.deleteInstallation( '', '', @@ -203,72 +180,64 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method listMemberships()', async () => { - const data = { - 'total': 5, - 'memberships': [],}; + const data = { + total: 5, + memberships: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.listMemberships( - '', - ); + const response = await teams.listMemberships(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'roles': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + userName: 'John Doe', + userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', + teamId: '5e5ea5c16897e', + teamName: 'VIP', + invited: '2020-10-15T06:38:00.000+00:00', + joined: '2020-10-15T06:38:00.000+00:00', + confirm: true, + mfa: true, + userAccessedAt: '2020-10-15T06:38:00.000+00:00', + roles: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.createMembership( - '', - [], - ); + const response = await teams.createMembership('', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'roles': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + userName: 'John Doe', + userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', + teamId: '5e5ea5c16897e', + teamName: 'VIP', + invited: '2020-10-15T06:38:00.000+00:00', + joined: '2020-10-15T06:38:00.000+00:00', + confirm: true, + mfa: true, + userAccessedAt: '2020-10-15T06:38:00.000+00:00', + roles: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.getMembership( '', '', @@ -279,26 +248,25 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method updateMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'roles': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + userName: 'John Doe', + userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', + teamId: '5e5ea5c16897e', + teamName: 'VIP', + invited: '2020-10-15T06:38:00.000+00:00', + joined: '2020-10-15T06:38:00.000+00:00', + confirm: true, + mfa: true, + userAccessedAt: '2020-10-15T06:38:00.000+00:00', + roles: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.updateMembership( '', '', @@ -310,11 +278,9 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method deleteMembership()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.deleteMembership( '', '', @@ -325,26 +291,25 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method updateMembershipStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'userAccessedAt': '2020-10-15T06:38:00.000+00:00', - 'roles': [],}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c16897e', + userName: 'John Doe', + userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', + teamId: '5e5ea5c16897e', + teamName: 'VIP', + invited: '2020-10-15T06:38:00.000+00:00', + joined: '2020-10-15T06:38:00.000+00:00', + confirm: true, + mfa: true, + userAccessedAt: '2020-10-15T06:38:00.000+00:00', + roles: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await teams.updateMembershipStatus( '', '', @@ -357,33 +322,24 @@ describe('Teams', () => { expect(response).toEqual(data); }); - test('test method getPrefs()', async () => { - const data = {}; + const data = {}; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.getPrefs( - '', - ); + const response = await teams.getPrefs(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePrefs()', async () => { - const data = {}; + const data = {}; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.updatePrefs( - '', - {}, - ); + const response = await teams.updatePrefs('', {}); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/tokens.test.js b/test/services/tokens.test.js index 491ddbf..323ab93 100644 --- a/test/services/tokens.test.js +++ b/test/services/tokens.test.js @@ -1,43 +1,40 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Tokens } = require("../../dist/services/tokens"); +const { Client } = require('../../dist/client'); +const { Tokens } = require('../../dist/services/tokens'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Tokens', () => { const client = new Client(); const tokens = new Tokens(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'tokens': [],}; + const data = { + total: 5, + tokens: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.list( - '', - '', - ); + const response = await tokens.list('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createFileToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + resourceId: '5e5ea5c168bb8:5e5ea5c168bb8', + resourceType: 'files', + expire: '2020-10-15T06:38:00.000+00:00', + secret: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await tokens.createFileToken( '', '', @@ -48,60 +45,50 @@ describe('Tokens', () => { expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + resourceId: '5e5ea5c168bb8:5e5ea5c168bb8', + resourceType: 'files', + expire: '2020-10-15T06:38:00.000+00:00', + secret: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.get( - '', - ); + const response = await tokens.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + resourceId: '5e5ea5c168bb8:5e5ea5c168bb8', + resourceType: 'files', + expire: '2020-10-15T06:38:00.000+00:00', + secret: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.update( - '', - ); + const response = await tokens.update(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.delete( - '', - ); + const response = await tokens.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/users.test.js b/test/services/users.test.js index 04ef422..0e61c5f 100644 --- a/test/services/users.test.js +++ b/test/services/users.test.js @@ -1,80 +1,76 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Users } = require("../../dist/services/users"); +const { Client } = require('../../dist/client'); +const { Users } = require('../../dist/services/users'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Users', () => { const client = new Client(); const users = new Users(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'users': [],}; + const data = { + total: 5, + users: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.list( - ); + const response = await users.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.create( - '', - ); + const response = await users.create(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createArgon2User()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createArgon2User( '', 'email@example.com', @@ -86,27 +82,26 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method createBcryptUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createBcryptUser( '', 'email@example.com', @@ -118,56 +113,49 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method listIdentities()', async () => { - const data = { - 'total': 5, - 'identities': [],}; + const data = { + total: 5, + identities: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listIdentities( - ); + const response = await users.listIdentities(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteIdentity()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteIdentity( - '', - ); + const response = await users.deleteIdentity(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMD5User()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createMD5User( '', 'email@example.com', @@ -179,27 +167,26 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method createPHPassUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createPHPassUser( '', 'email@example.com', @@ -211,27 +198,26 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method createScryptUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createScryptUser( '', 'email@example.com', @@ -248,27 +234,26 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method createScryptModifiedUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createScryptModifiedUser( '', 'email@example.com', @@ -283,27 +268,26 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method createSHAUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createSHAUser( '', 'email@example.com', @@ -315,71 +299,63 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.get( - '', - ); + const response = await users.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.delete( - '', - ); + const response = await users.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.updateEmail( '', 'email@example.com', @@ -390,182 +366,155 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method updateImpersonator()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateImpersonator( - '', - true, - ); + const response = await users.updateImpersonator('', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createJWT()', async () => { - const data = { - 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; + const data = { + jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createJWT( - '', - ); + const response = await users.createJWT(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateLabels()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateLabels( - '', - [], - ); + const response = await users.updateLabels('', []); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; + const data = { + total: 5, + logs: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listLogs( - '', - ); + const response = await users.listLogs(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listMemberships()', async () => { - const data = { - 'total': 5, - 'memberships': [],}; + const data = { + total: 5, + memberships: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listMemberships( - '', - ); + const response = await users.listMemberships(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMfa()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMfa( - '', - true, - ); + const response = await users.updateMfa('', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMFA()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMFA( - '', - true, - ); + const response = await users.updateMFA('', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteMfaAuthenticator()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.deleteMfaAuthenticator( '', 'totp', @@ -576,11 +525,9 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method deleteMFAAuthenticator()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.deleteMFAAuthenticator( '', 'totp', @@ -591,16 +538,15 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method getMFAChallenge()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'code': '446372',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + expire: '2020-10-15T06:38:00.000+00:00', + code: '446372', + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.getMFAChallenge( '', '', @@ -611,404 +557,336 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method listMfaFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - 'custom': true,}; + const data = { + totp: true, + phone: true, + email: true, + recoveryCode: true, + custom: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listMfaFactors( - '', - ); + const response = await users.listMfaFactors(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listMFAFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - 'custom': true,}; + const data = { + totp: true, + phone: true, + email: true, + recoveryCode: true, + custom: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listMFAFactors( - '', - ); + const response = await users.listMFAFactors(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getMfaRecoveryCodes( - '', - ); + const response = await users.getMfaRecoveryCodes(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getMFARecoveryCodes( - '', - ); + const response = await users.getMFARecoveryCodes(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMfaRecoveryCodes( - '', - ); + const response = await users.updateMfaRecoveryCodes(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMFARecoveryCodes( - '', - ); + const response = await users.updateMFARecoveryCodes(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createMfaRecoveryCodes( - '', - ); + const response = await users.createMfaRecoveryCodes(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; + const data = { + recoveryCodes: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createMFARecoveryCodes( - '', - ); + const response = await users.createMFARecoveryCodes(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateName()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateName( - '', - '', - ); + const response = await users.updateName('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePassword()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePassword( - '', - 'password', - ); + const response = await users.updatePassword('', 'password'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePhone()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePhone( - '', - '+12065550100', - ); + const response = await users.updatePhone('', '+12065550100'); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method getPrefs()', async () => { - const data = {}; + const data = {}; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getPrefs( - '', - ); + const response = await users.getPrefs(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePrefs()', async () => { - const data = {}; + const data = {}; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePrefs( - '', - {}, - ); + const response = await users.updatePrefs('', {}); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listSessions()', async () => { - const data = { - 'total': 5, - 'sessions': [],}; + const data = { + total: 5, + sessions: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listSessions( - '', - ); + const response = await users.listSessions(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createSession( - '', - ); + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5bb8c16897e', + expire: '2020-10-15T06:38:00.000+00:00', + provider: 'email', + providerUid: 'user@example.com', + providerAccessToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + providerAccessTokenExpiry: '2020-10-15T06:38:00.000+00:00', + providerRefreshToken: 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + ip: '127.0.0.1', + osCode: 'Mac', + osName: 'Mac', + osVersion: 'Mac', + clientType: 'browser', + clientCode: 'CM', + clientName: 'Chrome Mobile iOS', + clientVersion: '84.0', + clientEngine: 'WebKit', + clientEngineVersion: '605.1.15', + deviceName: 'smartphone', + deviceBrand: 'Google', + deviceModel: 'Nexus 5', + countryCode: 'US', + countryName: 'United States', + current: true, + factors: [], + secret: '5e5bb8c16897e', + mfaUpdatedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await users.createSession(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteSessions()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteSessions( - '', - ); + const response = await users.deleteSessions(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteSession()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteSession( - '', - '', - ); + const response = await users.deleteSession('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateStatus( - '', - true, - ); + const response = await users.updateStatus('', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method listTargets()', async () => { - const data = { - 'total': 5, - 'targets': [],}; + const data = { + total: 5, + targets: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listTargets( - '', - ); + const response = await users.listTargets(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createTarget()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Apple iPhone 12', + userId: '259125845563242502', + providerType: 'email', + identifier: 'token', + expired: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await users.createTarget( '', '', @@ -1021,147 +899,123 @@ describe('Users', () => { expect(response).toEqual(data); }); - test('test method getTarget()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Apple iPhone 12', + userId: '259125845563242502', + providerType: 'email', + identifier: 'token', + expired: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getTarget( - '', - '', - ); + const response = await users.getTarget('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateTarget()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'Apple iPhone 12', + userId: '259125845563242502', + providerType: 'email', + identifier: 'token', + expired: true, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateTarget( - '', - '', - ); + const response = await users.updateTarget('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method deleteTarget()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteTarget( - '', - '', - ); + const response = await users.deleteTarget('', ''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method createToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + const data = { + '\\$id': 'bb8ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + userId: '5e5ea5c168bb8', + secret: '', + expire: '2020-10-15T06:38:00.000+00:00', + phrase: 'Golden Fox', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createToken( - '', - ); + const response = await users.createToken(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateEmailVerification()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateEmailVerification( - '', - true, - ); + const response = await users.updateEmailVerification('', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updatePhoneVerification()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePhoneVerification( - '', - true, - ); + const response = await users.updatePhoneVerification('', true); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/test/services/vectors-d-b.test.js b/test/services/vectors-d-b.test.js new file mode 100644 index 0000000..c36293a --- /dev/null +++ b/test/services/vectors-d-b.test.js @@ -0,0 +1,695 @@ +const { Client } = require('../../dist/client'); +const { VectorsDB } = require('../../dist/services/vectors-db'); + +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); + +describe('VectorsDB', () => { + const client = new Client(); + const vectorsDB = new VectorsDB(client); + + test('test method list()', async () => { + const data = { + total: 5, + databases: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.list(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method create()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.create('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listSpecifications()', async () => { + const data = { + specifications: [], + total: 9, + pricing: {}, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.listSpecifications(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listTransactions()', async () => { + const data = { + total: 5, + transactions: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.listTransactions(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createTransaction()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createTransaction(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getTransaction()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.getTransaction(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateTransaction()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.updateTransaction(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteTransaction()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.deleteTransaction(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createOperations()', async () => { + const data = { + '\\$id': '259125845563242502', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + status: 'pending', + operations: 5, + expiresAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createOperations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method get()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.get(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method update()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + name: 'My Database', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + enabled: true, + type: 'legacy', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.update('', ''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method delete()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.delete(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listCollections()', async () => { + const data = { + total: 5, + collections: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.listCollections(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createCollection()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + dimension: 1536, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createCollection( + '', + '', + '', + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getCollection()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + dimension: 1536, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.getCollection( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateCollection()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + databaseId: '5e5ea5c16897e', + name: 'My Collection', + enabled: true, + documentSecurity: true, + attributes: [], + indexes: [], + bytesMax: 65535, + bytesUsed: 1500, + dimension: 1536, + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.updateCollection( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteCollection()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.deleteCollection( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.listDocuments( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createDocument( + '', + '', + '', + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createDocuments( + '', + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method upsertDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.upsertDocuments( + '', + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.updateDocuments( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteDocuments()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.deleteDocuments( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createQuery()', async () => { + const data = { + total: 5, + documents: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createQuery( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.getDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method upsertDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.upsertDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method updateDocument()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$sequence': '1', + '\\$collectionId': '5e5ea5c15117e', + '\\$databaseId': '5e5ea5c15117e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\\$permissions': [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.updateDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteDocument()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.deleteDocument( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listIndexes()', async () => { + const data = { + total: 5, + indexes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.listIndexes( + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createIndex()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + attributes: [], + lengths: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createIndex( + '', + '', + '', + 'hnsw_euclidean', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getIndex()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + key: 'index1', + type: 'primary', + status: 'available', + error: 'string', + attributes: [], + lengths: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.getIndex( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deleteIndex()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.deleteIndex( + '', + '', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method createFailover()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + projectId: '5e5ea5c16897e', + name: 'My Production Database', + api: 'postgresql', + engine: 'postgresql', + version: '16', + specification: 's-2vcpu-2gb', + backend: 'edge', + hostname: 'db-myproject-mydb.fra.appwrite.center', + connectionPort: 5432, + connectionUser: 'appwrite_user', + connectionPassword: '••••••••', + connectionString: + 'postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require', + ssl: true, + status: 'ready', + containerStatus: 'active', + lifecycleState: 'active', + idleTimeoutMinutes: 15, + cpu: 2000, + memory: 4096, + storage: 100, + storageClass: 'ssd', + storageMaxGb: 100, + nodePool: 'db-pool-4vcpu-8gb', + replicas: 2, + syncMode: 'async', + networkMaxConnections: 500, + networkIdleTimeoutSeconds: 900, + networkIPAllowlist: [], + backupEnabled: true, + pitr: true, + pitrRetentionDays: 14, + storageAutoscaling: true, + storageAutoscalingThresholdPercent: 85, + storageAutoscalingMaxGb: 500, + maintenanceWindowDay: 'sun', + maintenanceWindowHourUtc: 3, + metricsEnabled: true, + sqlApiEnabled: true, + sqlApiAllowedStatements: [], + sqlApiMaxRows: 10000, + sqlApiMaxBytes: 10485760, + sqlApiTimeoutSeconds: 30, + error: '', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.createFailover(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method listOperations()', async () => { + const data = { + total: 5, + operations: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.listOperations(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getReplicas()', async () => { + const data = { + replicas: 2, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + members: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.getReplicas(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method getStatus()', async () => { + const data = { + health: 'healthy', + ready: true, + engine: 'postgresql', + version: '17', + uptime: 86400, + connections: {}, + syncMode: 'async', + syncDegraded: true, + syncAcknowledgements: 1, + syncStandbyCount: 2, + replicas: [], + volumes: [], + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await vectorsDB.getStatus(''); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); +}); diff --git a/test/services/webhooks.test.js b/test/services/webhooks.test.js index 46382da..7f7e54b 100644 --- a/test/services/webhooks.test.js +++ b/test/services/webhooks.test.js @@ -1,50 +1,49 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Webhooks } = require("../../dist/services/webhooks"); +const { Client } = require('../../dist/client'); +const { Webhooks } = require('../../dist/services/webhooks'); -const { fetch: mockedFetch, Response } = require("undici"); -jest.mock('undici', () => ({ ...jest.requireActual('undici'), fetch: jest.fn() })); +const { fetch: mockedFetch, Response } = require('undici'); +jest.mock('undici', () => ({ + ...jest.requireActual('undici'), + fetch: jest.fn(), +})); describe('Webhooks', () => { const client = new Client(); const webhooks = new Webhooks(client); - test('test method list()', async () => { - const data = { - 'total': 5, - 'webhooks': [],}; + const data = { + total: 5, + webhooks: [], + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.list( - ); + const response = await webhooks.list(); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'webhook-password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Webhook', + url: 'https://example.com/webhook', + events: [], + tls: true, + authUsername: 'username', + authPassword: 'webhook-password', + secret: 'ad3d581ca230e2b7059c545e5a', + enabled: true, + logs: 'Failed to connect to remote server.', + attempts: 10, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await webhooks.create( '', - '', + 'https://example.com/webhook', '', [], ); @@ -54,55 +53,51 @@ describe('Webhooks', () => { expect(response).toEqual(data); }); - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'webhook-password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Webhook', + url: 'https://example.com/webhook', + events: [], + tls: true, + authUsername: 'username', + authPassword: 'webhook-password', + secret: 'ad3d581ca230e2b7059c545e5a', + enabled: true, + logs: 'Failed to connect to remote server.', + attempts: 10, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.get( - '', - ); + const response = await webhooks.get(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'webhook-password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Webhook', + url: 'https://example.com/webhook', + events: [], + tls: true, + authUsername: 'username', + authPassword: 'webhook-password', + secret: 'ad3d581ca230e2b7059c545e5a', + enabled: true, + logs: 'Failed to connect to remote server.', + attempts: 10, + }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await webhooks.update( '', '', - '', + 'https://example.com/webhook', [], ); @@ -111,45 +106,38 @@ describe('Webhooks', () => { expect(response).toEqual(data); }); - test('test method delete()', async () => { - const data = {message: ""}; + const data = { message: '' }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.delete( - '', - ); + const response = await webhooks.delete(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - test('test method updateSecret()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'webhook-password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'My Webhook', + url: 'https://example.com/webhook', + events: [], + tls: true, + authUsername: 'username', + authPassword: 'webhook-password', + secret: 'ad3d581ca230e2b7059c545e5a', + enabled: true, + logs: 'Failed to connect to remote server.', + attempts: 10, + }; mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.updateSecret( - '', - ); + const response = await webhooks.updateSecret(''); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; expect(response).toEqual(data); }); - }) +}); diff --git a/tsconfig.json b/tsconfig.json index 45afe7d..a323d4f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,4 +15,4 @@ "compileOnSave": false, "exclude": ["node_modules", "dist"], "include": ["src"] -} \ No newline at end of file +} diff --git a/tsup.config.ts b/tsup.config.ts index d39e2c5..964f156 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,27 +1,27 @@ -import { defineConfig, type Options } from "tsup"; -import { esbuildPluginFilePathExtensions } from "esbuild-plugin-file-path-extensions"; +import { defineConfig, type Options } from 'tsup'; +import { esbuildPluginFilePathExtensions } from 'esbuild-plugin-file-path-extensions'; const commonConfig: Options = { - sourcemap: true, - clean: true, - dts: true, - treeshake: true, - target: "node16", - entry: ["src/**/*.ts"], - outDir: "dist", + sourcemap: true, + clean: true, + dts: true, + treeshake: true, + target: 'node16', + entry: ['src/**/*.ts'], + outDir: 'dist', }; export default defineConfig([ - { - ...commonConfig, - format: "esm", - esbuildPlugins: [esbuildPluginFilePathExtensions({ filter: /^\./ })], - bundle: true, - // Yes, bundle: true => https://github.com/favware/esbuild-plugin-file-path-extensions?tab=readme-ov-file#usage - }, - { - ...commonConfig, - format: "cjs", - bundle: false, - }, + { + ...commonConfig, + format: 'esm', + esbuildPlugins: [esbuildPluginFilePathExtensions({ filter: /^\./ })], + bundle: true, + // Yes, bundle: true => https://github.com/favware/esbuild-plugin-file-path-extensions?tab=readme-ov-file#usage + }, + { + ...commonConfig, + format: 'cjs', + bundle: false, + }, ]); From 442fe62d15d06022e3aff19e361b99432b005fea Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 27 Aug 2026 18:27:31 +0530 Subject: [PATCH 11/11] chore: update Node.js SDK to 29.0.0-rc.1 --- CHANGELOG.md | 6 +- package-lock.json | 576 ++++++++++++++++++++++++---------------------- package.json | 2 +- src/client.ts | 4 +- 4 files changed, 308 insertions(+), 280 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba0202b..7d247dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # Change Log -## 28.1.0-rc.1 +## 29.0.0-rc.1 +* Breaking: `Execution.functionId` is replaced by `resourceId` and `resourceType`, now that executions cover both functions and sites +* Breaking: `AppInstallation.authorizationDetails` is now an array instead of an object +* Breaking: removed `dedicatedDatabases.execute` from `ProjectKeyScopes` +* Breaking: `EmbeddingModel` no longer offers `embedding-gemma` or `bge-small` * Added: `documentsDB`, `vectorsDB`, `mysql`, `postgresql`, and `mongo` services, no longer hidden from server SDKs * Added: `DocumentsDBIndexType` and `VectorsDBIndexType` enums * Added: dedicated database models for branches, backups, restorations, poolers, PITR windows, extensions, and executions diff --git a/package-lock.json b/package-lock.json index e273f88..d1bb80e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "node-appwrite", - "version": "28.1.0-rc.1", + "version": "29.0.0-rc.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "28.1.0-rc.1", + "version": "29.0.0-rc.1", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0", @@ -1061,22 +1061,6 @@ "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@eslint/config-array/node_modules/minimatch": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", - "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.8" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@eslint/config-helpers": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", @@ -1249,6 +1233,62 @@ "node": ">=8" } }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@istanbuljs/schema": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz", @@ -1668,9 +1708,9 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.2.tgz", - "integrity": "sha512-JfB4kuJQjaoHuCTseIINHtHWeJnvgEcxjwA5t/Y00ZgaOO1Crz3fjT/p8kT28zA/Caz7oiUMn3d6H2yOVCVwuw==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.3.tgz", + "integrity": "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q==", "dev": true, "license": "MIT", "optional": true, @@ -1685,8 +1725,8 @@ "url": "https://github.com/sponsors/Brooooooklyn" }, "peerDependencies": { - "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", - "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "node_modules/@pkgjs/parseargs": { @@ -1714,9 +1754,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.4.tgz", - "integrity": "sha512-RrPokAb7dmbxFoeO3TloqHyOjgye8RkBhSqmp4aJMIex4c9r46ZstPnleDQOq1t46VOVjwIuwNogIqbodV1Vvg==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.5.tgz", + "integrity": "sha512-jfkGfTwhQpsiSckPF8r9bU3pn3vyd72NlWaO+TgEO6WPSDnUhXzrNYCHBMOYj0ACaUgjm6eERLF+XV9a6RstoA==", "cpu": [ "arm" ], @@ -1728,9 +1768,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.4.tgz", - "integrity": "sha512-JKuJc+pnpks2pjy7L/N3v/cAkZxYlnmuZoD840ldbMI5KDbC4iO9NKwPKYdjYFCMAIIlBzYSFHxIJVYzRo2/8A==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.5.tgz", + "integrity": "sha512-oGVqyQlxnrz9/ty89oHpU857VUHEl5/Xu4R2lS+aivCTrNnSsbiENzTnNaBsjxH0CNWGPhzHArOLFwo+oKXveA==", "cpu": [ "arm64" ], @@ -1742,9 +1782,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.4.tgz", - "integrity": "sha512-krw5uS2STmvJ02x0uTXHbqQNuz+9eZ1iw+qXk9dmW2gvV4jV7O2hEoOnuhFrpOPiel1mBFtqbxYZZtC46hXLOw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.5.tgz", + "integrity": "sha512-bW7B8xMEq8n99Q3ieEcPRGuphurdZAaFzQc9Efyyw3FL6DZO6pMy9xhdN+kBoD7Sy05xNXSr4OyPPnpkYriS/A==", "cpu": [ "arm64" ], @@ -1756,9 +1796,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.4.tgz", - "integrity": "sha512-wsTxtgApb4PrOsNJIm0FZ1h3WvCC+k9uxLJ4ad75hgoS4NiRes2SoJFlDAyMwiUY8IssDqGcHbXuN0sx1tfF1A==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.5.tgz", + "integrity": "sha512-YSwBS86QeHOGlrxJ1PSOIZSkzRL/JmKeunhc+lV6M1a6En8QuVCD/T/qIA0J4Gd2Y86RIOBYrLcOUtqGh9+/1w==", "cpu": [ "x64" ], @@ -1770,9 +1810,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.4.tgz", - "integrity": "sha512-GUOnQlyZe3yAXhWOtOMsn5Qkrv5E5mZXa0thbARWi5Ei2szlVXJFQhddZ4HbAzh8q92w5twp+CQvs/eFanz9YQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.5.tgz", + "integrity": "sha512-2fST8lILgl7cKbme/1KDdPCmbXbG+gqoV3bHp19L0ypX/3akYMBVdOunPleRCwonoLnXOZ/0F+Mt/v8POFmfcQ==", "cpu": [ "arm64" ], @@ -1784,9 +1824,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.4.tgz", - "integrity": "sha512-/Y7f3QuxjzPKsjA/rfEDa3+0vXqyjmJ50Ln8dPpCmWkKTrUoWHG1cWhTqaAMLob2m2nESWuC7yGrREz019Ztqg==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.5.tgz", + "integrity": "sha512-cpIxQCP9J+EVad0a6LO1kY3ZGODlk80VlI+2I96B8xMcdHZ4pLVhfQ49JFpYqjPF91FFkQWftf57YlDcTiw9yQ==", "cpu": [ "x64" ], @@ -1798,9 +1838,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.4.tgz", - "integrity": "sha512-81wiiX3v7aqy+T+bT61TJ78yJjRquqFFTTbAPt08imfQQzkPIW8t6aJbkTagtCCrXMNc9D66+geqlK7ydLPNqA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.5.tgz", + "integrity": "sha512-r9fGh3eFs3e/udWh5ZjXQtxiYK/xoFxQaYR/cELxac/Udkl5Th+IsFm0CX3Kl9hmUH/we7EoMpjJgeQNnE0+IA==", "cpu": [ "arm" ], @@ -1812,9 +1852,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.4.tgz", - "integrity": "sha512-9kmDIvNZqdoHOBZgNtpTBeLWYO/LVipM3H/j62P8848/l/VPEQL6N3uxU9pvP1oZAsXyC2MEnFP3ovRjo7WYNQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.5.tgz", + "integrity": "sha512-xdvFdp7OM6KLJviJT2g/YuRSUjnZgGHk4RNgwIbN7X6cPugOucV60DdHXWzsBVCUdrGb6qSXnJQrrAKMmQuj3Q==", "cpu": [ "arm" ], @@ -1826,9 +1866,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.4.tgz", - "integrity": "sha512-CcnXHWnXg69g+DX5VWL3FHts3qMRN2uVEHX+BZvGLdd07/gXkn3ePjYtO1LDJvxkGKVHMclKBRa1QUTH+6toYQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.5.tgz", + "integrity": "sha512-rRqILAndyzHzP7T9NFQrq+4HFWNhqkqkKur7eiBpfLmz01PO0JKx5Vchu3YllE4YXI/Ftgq/szrDWg5GJ0mI8g==", "cpu": [ "arm64" ], @@ -1840,9 +1880,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.4.tgz", - "integrity": "sha512-iFOibiHnTRuhrWLlRsOQFdZJJIa7S8OwkneJr4ocALP16u5yk6lWLINFwhHaEqBFMsKDUZofLkGos7+CPzGB3g==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.5.tgz", + "integrity": "sha512-Gf4X3qVMucayUvux6aXXPgXovocSFUC0rrffDuPI/S2nHhNMhjcZxsrAFYCOF350PRreW1XwzFj3CT/3bKsWCw==", "cpu": [ "arm64" ], @@ -1854,9 +1894,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.4.tgz", - "integrity": "sha512-XnWYMI7euHlb5a871xPja+Gm7DRCFU+FGRrtS2sMq9N8FvqtpagUy6gD4YOemC5MRk9xbh8+jYMEJbigFQwsgA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.5.tgz", + "integrity": "sha512-+s5qA0TNM0qm8PK/a5gt/1Hpx+NV08uSuCncvhziIlQzT6AEV2fnUQo7eBtFTFO0nA9scauvoR2HusfXmQnO4w==", "cpu": [ "loong64" ], @@ -1868,9 +1908,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.4.tgz", - "integrity": "sha512-qGDAlO0U8xedCcsdRm9oaoQY8DAx/QT7uIxJWhCdx0ceIWX783UC9QSYkdpzAe29wNiVfp24+bZdQmn49o45SQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.5.tgz", + "integrity": "sha512-ybb6QvWwWJCbBWqERpc8K3pYVGIrXlG8MEQ8IIuJY6Y9KdHQxoFoNyfkAOtKn1VHu3KuLidXvwrvGR1mEjeWCw==", "cpu": [ "loong64" ], @@ -1882,9 +1922,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.4.tgz", - "integrity": "sha512-ru4H6ezD7ysA5EiEK6qkkaEb4modH8CTej6kUy/gQi20u3kB3G7Zn8snXXkeJSCOFKG/rbPPtM/+9Wgas1961w==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.5.tgz", + "integrity": "sha512-nZb1DtnOyhCmYvsC8A2CwOkopVg+IS1+fPUa7rMOAXtNw5+lLCLLPqd6XAiNrGtoQKsbvIBOwsHnBH/3wnb4HQ==", "cpu": [ "ppc64" ], @@ -1896,9 +1936,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.4.tgz", - "integrity": "sha512-2W4MO5WQVJnbJaZdvDb9rhBDuFU1nKIepPFpJUBsTh2k1YY2g+ODViaWuyOAjQ5cOP7NvrvLzt3wvHOoiAvc7w==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.5.tgz", + "integrity": "sha512-yMbj63Sp89ryrXLWyz+sy+fYD2HpOnMCLGbe4Oa1smclFSUukdtD/BgdiHaAetJNb74URD8U4hM+qG5KVzMEkg==", "cpu": [ "ppc64" ], @@ -1910,9 +1950,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.4.tgz", - "integrity": "sha512-+fxjfuoAmVMCYV5QyjoIpu0cp5DOiOTeqYFk1AVaxGr+/ravWLX89XfQmptsoWcaVy/TGf2hexzbUOrCQIL1CQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.5.tgz", + "integrity": "sha512-mhoan3OJw2kYV/e1jtIdmvUZgyBFeA6zGWsOswmR0Tg19TQbowZuR+JMLID6spbbBN7Zee2ejrgmy3+FxGrIdA==", "cpu": [ "riscv64" ], @@ -1924,9 +1964,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.4.tgz", - "integrity": "sha512-jTn8JfHGL4djjFxPuM06LmNUJDsst2jeVlsd9OmIH6zc5sC9K6rIuO4YajXatLUpBmBKl6b35ro1QZocLi+tcA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.5.tgz", + "integrity": "sha512-5ZTLmjWbb1VZdjuyhe83K/8QO0/h11midQCBP+X5OYn32ra7eOBoM0ZqtaY4nkgNsYgmdVhMYPoyVPTjUpHf3w==", "cpu": [ "riscv64" ], @@ -1938,9 +1978,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.4.tgz", - "integrity": "sha512-oCJCJL4pXsoDcP2QZ+JVlPTIRc6266zsIaeJJsWImmF7HO0W8nb6HuSgZlMWxJwaPf8ehbSw8yo0EUw925hKsA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.5.tgz", + "integrity": "sha512-m53kG+br6PGxOTmgBEM2DHSDs9RVjsyEbUwjJPJGTFm1grWOG8EKJggDCTb60unD4Tjby8fi7/m9XfkEWasVWg==", "cpu": [ "s390x" ], @@ -1952,9 +1992,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.4.tgz", - "integrity": "sha512-W69hukhZ3KKNRCaMIEzKvcFye42hh0FE1+YoYaf5+Ikacuftoco6yO/xouz0hc5d5W/s3yBro5jRiuEE/Q5vUw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.5.tgz", + "integrity": "sha512-6RHPJR1g/uvdYU8uXBnfq3nlqyZCP82Fr6NHgfGoaIeSh0YEqnX/x6uA9MmJJbnSH7swqX4F+CkGdUF+6doiQA==", "cpu": [ "x64" ], @@ -1966,9 +2006,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.4.tgz", - "integrity": "sha512-qiXbGG2jkjXhzXpsFZSR2Xpb8DN/UaxYsbb/STbuR/6fpaDgRmmaq1B/LmtF2wQFOFOSsK2jdE0RZ3a0zHn4QA==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.5.tgz", + "integrity": "sha512-xs+OXQtEXgpXT0DmA5+U3qnRZHdCST/5HRQxS8wSPZTUZN/EMWeHuSIod32LQklTBZBV9DyfncKBQ8n5V3eFdw==", "cpu": [ "x64" ], @@ -1980,9 +2020,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.4.tgz", - "integrity": "sha512-nWeM//hxv8mIo6jD7Hu4o48DVmV9pbV6gsKaWU+4NFyqHoPKwrkRiZGLKUhOBk8qNmDmpwFtPKg80Bo/Tn4xiQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.5.tgz", + "integrity": "sha512-e7hD+sl3s+mcLQDZ8pbudBVsdG6r5yN4w3LqG2TJ8sQHDpblWj5lrJs/3m01Cvlxbt4x13zu5thLjgypgtkYzw==", "cpu": [ "x64" ], @@ -1994,9 +2034,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.4.tgz", - "integrity": "sha512-s62SQ/vgsRSvMwDkOEfTqfgASF0f26ZNaQuTA6Aok5lrikf89yI2W0gFHvZb2Jpgc6N8JnOKZgCK2iciO3CsxQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.5.tgz", + "integrity": "sha512-GiyJaCf+WpMub/17aPcKk27QMl5W6f+KhdPTjlFOn5akH5Wa/DCM9Stdx5cDfmasyKB08MqpVQ1uJE2RkkpbXg==", "cpu": [ "arm64" ], @@ -2008,9 +2048,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.4.tgz", - "integrity": "sha512-J6wGf8TVGbXJq+HH+ttTvrcfNKPbuZecV6KT1B8I18BC5IURUh5kl4Yl5OEP5eFIUoI5BWxCsyYMhFsDx8kekw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.5.tgz", + "integrity": "sha512-+OQ8U2DdoEfXl8T4Fb18AjmEwbXMerKDKCL8yCPAYhKCEEKoul7rkbeGCBFCbAlaGaa7pmtRTpkAJM2LE/i5FA==", "cpu": [ "arm64" ], @@ -2022,9 +2062,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.4.tgz", - "integrity": "sha512-zmfrQd/0wu6oJs8Vq8KwY/YtsKSsLtKe/HwAP4Wqy8LhWjeT55fHRAkOhYQ12wI3ayS4Tt12d5CDRD7N96SAYQ==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.5.tgz", + "integrity": "sha512-KanvAZrPKbDBFwrgiU9yEVpQoox9QPV1WZOXX7HudJQY+eSlu82CtWxDU8WtuRRvtN5EGkLczkd6Y6DTcvm9wA==", "cpu": [ "ia32" ], @@ -2036,9 +2076,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.4.tgz", - "integrity": "sha512-qPzHqdj9rfUD+w79dtE07zi/kFwKyCJqplp5K5ygeLTp7jLpAoc16OAH39HSmRC9UpozaecsleI8uAdEj6v2yw==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.5.tgz", + "integrity": "sha512-1aC3UEWTtRl3RK3VpDJ/Tqk1XI4SLTmXIthAq6wRWo8XiSXJNd+VprJM4/1P4+i6HIaFEFlVi9sTTziniD2tOQ==", "cpu": [ "x64" ], @@ -2050,9 +2090,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.4.tgz", - "integrity": "sha512-zD6NdeWEByGE9QF9vCrlJ5YQB4oq9q91kPZS37Jwj5hOkvR1lTBSpsKhKDw4IJtbQ35LsTS1HD9DZYGKIshU1Q==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.5.tgz", + "integrity": "sha512-/gDJaRs4gl0NPIwqCz+6PkpmhhjRAD2j6P4rSNHBzUkO3naEx2mIU0pRle1vUNRQ7mE/+8OOeXLTv/J56FKiQg==", "cpu": [ "x64" ], @@ -2423,22 +2463,6 @@ "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", - "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.8" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { "version": "7.8.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", @@ -2871,9 +2895,9 @@ } }, "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", "dev": true, "license": "MIT", "engines": { @@ -3050,9 +3074,9 @@ } }, "node_modules/baseline-browser-mapping": { - "version": "2.11.13", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.13.tgz", - "integrity": "sha512-k9HNuUVMlqVjQ9UHzfPjIqiDbWw7WqT1AoT7GL8VwvF3r0ZfArtgiSPAlmupyNquNgOJHTuH4CKYf8ttMTWBTQ==", + "version": "2.11.19", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.19.tgz", + "integrity": "sha512-Grytf1xOxOEMTGRwx6rLGKkTabd4vMg3VrKdj/7joCmV0qgh4QwMMO6xh34YEXQqirAuUdgQGa5orJQQ+69RBw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -3182,9 +3206,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001809", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001809.tgz", - "integrity": "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ==", + "version": "1.0.30001810", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", + "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", "dev": true, "funding": [ { @@ -3262,9 +3286,9 @@ } }, "node_modules/cjs-module-lexer": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.0.tgz", - "integrity": "sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.2.1.tgz", + "integrity": "sha512-Ca8swihM+/4yKecYHY52kgJd300hi2lADU/a1RxNTRe+RJ9jvqQlESpbz9DnG9mowez8qwXHB8qYdIUw9e+F5Q==", "dev": true, "license": "MIT" }, @@ -3501,9 +3525,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.404", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.404.tgz", - "integrity": "sha512-3WJtd7/lVq2Jnuz6wed1l9+1ZD2u2Tet1/1NBc4Iedkmgbu+I7YuAqdAQ8T+VZtnwysMsAf3IqSq9D1gyZjA2g==", + "version": "1.5.413", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.413.tgz", + "integrity": "sha512-F1XPKvt7HVfly5WND90ec16nFsdr4g5x/cVUP3EqjeyXynupabGDqpMa84wwvuYGDnldXLBz6DLXyZXWO9TPvw==", "dev": true, "license": "ISC" }, @@ -3601,13 +3625,16 @@ } }, "node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint": { @@ -3701,84 +3728,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/minimatch": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", - "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.8" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/eslint/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/espree": { "version": "11.2.0", "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", @@ -3965,17 +3914,20 @@ } }, "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "license": "MIT", "dependencies": { - "locate-path": "^5.0.0", + "locate-path": "^6.0.0", "path-exists": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/fix-dts-default-cjs-exports": { @@ -4128,6 +4080,22 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/globals": { "version": "16.5.0", "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", @@ -5165,16 +5133,19 @@ } }, "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "license": "MIT", "dependencies": { - "p-locate": "^4.1.0" + "p-locate": "^5.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/lru-cache": { @@ -5254,16 +5225,16 @@ } }, "node_modules/minimatch": { - "version": "9.0.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", - "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.2" + "brace-expansion": "^5.0.8" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -5445,29 +5416,16 @@ } }, "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-locate/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "license": "MIT", "dependencies": { - "p-try": "^2.0.0" + "p-limit": "^3.0.2" }, "engines": { - "node": ">=6" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5578,9 +5536,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { @@ -5613,6 +5571,62 @@ "node": ">=8" } }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/pkg-types": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", @@ -5814,9 +5828,9 @@ } }, "node_modules/rollup": { - "version": "4.62.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.4.tgz", - "integrity": "sha512-RXOqwaPsBGjMNMa4sQjDjHieHEZDFoj/Rdr46l2MU5DfEs16wHJPC2RPTPHWhNl+M3aI472LLqFkFKut4SblOg==", + "version": "4.62.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.5.tgz", + "integrity": "sha512-/tqMfgP7GPA3PHhCmuiS4vIjrSVhHLgY++i+dhbG462euyAj7FpM4D9uq1X3BgjlqRdpcOrYhcQtfiQLNc8tqw==", "dev": true, "license": "MIT", "dependencies": { @@ -5831,31 +5845,31 @@ }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", - "@rollup/rollup-android-arm-eabi": "4.62.4", - "@rollup/rollup-android-arm64": "4.62.4", - "@rollup/rollup-darwin-arm64": "4.62.4", - "@rollup/rollup-darwin-x64": "4.62.4", - "@rollup/rollup-freebsd-arm64": "4.62.4", - "@rollup/rollup-freebsd-x64": "4.62.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.62.4", - "@rollup/rollup-linux-arm-musleabihf": "4.62.4", - "@rollup/rollup-linux-arm64-gnu": "4.62.4", - "@rollup/rollup-linux-arm64-musl": "4.62.4", - "@rollup/rollup-linux-loong64-gnu": "4.62.4", - "@rollup/rollup-linux-loong64-musl": "4.62.4", - "@rollup/rollup-linux-ppc64-gnu": "4.62.4", - "@rollup/rollup-linux-ppc64-musl": "4.62.4", - "@rollup/rollup-linux-riscv64-gnu": "4.62.4", - "@rollup/rollup-linux-riscv64-musl": "4.62.4", - "@rollup/rollup-linux-s390x-gnu": "4.62.4", - "@rollup/rollup-linux-x64-gnu": "4.62.4", - "@rollup/rollup-linux-x64-musl": "4.62.4", - "@rollup/rollup-openbsd-x64": "4.62.4", - "@rollup/rollup-openharmony-arm64": "4.62.4", - "@rollup/rollup-win32-arm64-msvc": "4.62.4", - "@rollup/rollup-win32-ia32-msvc": "4.62.4", - "@rollup/rollup-win32-x64-gnu": "4.62.4", - "@rollup/rollup-win32-x64-msvc": "4.62.4", + "@rollup/rollup-android-arm-eabi": "4.62.5", + "@rollup/rollup-android-arm64": "4.62.5", + "@rollup/rollup-darwin-arm64": "4.62.5", + "@rollup/rollup-darwin-x64": "4.62.5", + "@rollup/rollup-freebsd-arm64": "4.62.5", + "@rollup/rollup-freebsd-x64": "4.62.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.5", + "@rollup/rollup-linux-arm-musleabihf": "4.62.5", + "@rollup/rollup-linux-arm64-gnu": "4.62.5", + "@rollup/rollup-linux-arm64-musl": "4.62.5", + "@rollup/rollup-linux-loong64-gnu": "4.62.5", + "@rollup/rollup-linux-loong64-musl": "4.62.5", + "@rollup/rollup-linux-ppc64-gnu": "4.62.5", + "@rollup/rollup-linux-ppc64-musl": "4.62.5", + "@rollup/rollup-linux-riscv64-gnu": "4.62.5", + "@rollup/rollup-linux-riscv64-musl": "4.62.5", + "@rollup/rollup-linux-s390x-gnu": "4.62.5", + "@rollup/rollup-linux-x64-gnu": "4.62.5", + "@rollup/rollup-linux-x64-musl": "4.62.5", + "@rollup/rollup-openbsd-x64": "4.62.5", + "@rollup/rollup-openharmony-arm64": "4.62.5", + "@rollup/rollup-win32-arm64-msvc": "4.62.5", + "@rollup/rollup-win32-ia32-msvc": "4.62.5", + "@rollup/rollup-win32-x64-gnu": "4.62.5", + "@rollup/rollup-win32-x64-msvc": "4.62.5", "fsevents": "~2.3.2" } }, @@ -5949,6 +5963,16 @@ "node": ">=10" } }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", diff --git a/package.json b/package.json index fb24dcb..baec786 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "28.1.0-rc.1", + "version": "29.0.0-rc.1", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index db7ce13..e83744d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -80,7 +80,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/28.1.0-rc.1'; + let ua = 'AppwriteNodeJSSDK/29.0.0-rc.1'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -142,7 +142,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '28.1.0-rc.1', + 'x-sdk-version': '29.0.0-rc.1', 'user-agent': getUserAgent(), 'X-Appwrite-Response-Format': '1.9.6', };