diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 47ba2484..e6ea266e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v6 + uses: actions/setup-node@v4 with: node-version: '24.14.1' registry-url: 'https://registry.npmjs.org' diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c0f0a1a..01e735ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 12.2.0 + +* Added: Introduced `bigint` create/update APIs for legacy Databases attributes +* Added: Introduced `bigint` create/update APIs for `TablesDB` columns +* Updated: Extended key-list query filters with `key`, `resourceType`, `resourceId`, and `secret` + ## 12.1.0 * Added: `setSession` method on `Client` for `X-Appwrite-Session` authentication diff --git a/README.md b/README.md index 5fe2f0fd..4341de8f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Console SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.3-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) @@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/console/create-program-membership.md b/docs/examples/console/create-program-membership.md index 23ed45d7..fa19b0c8 100644 --- a/docs/examples/console/create-program-membership.md +++ b/docs/examples/console/create-program-membership.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.createProgramMembership({ +const result = await console.createProgramMembership({ programId: '' }); diff --git a/docs/examples/console/create-source.md b/docs/examples/console/create-source.md index b6307b1d..a5283da5 100644 --- a/docs/examples/console/create-source.md +++ b/docs/examples/console/create-source.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.createSource({ +const result = await console.createSource({ ref: '', // optional referrer: 'https://example.com', // optional utmSource: '', // optional diff --git a/docs/examples/console/get-campaign.md b/docs/examples/console/get-campaign.md index e9d41aeb..703c6e31 100644 --- a/docs/examples/console/get-campaign.md +++ b/docs/examples/console/get-campaign.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.getCampaign({ +const result = await console.getCampaign({ campaignId: '' }); diff --git a/docs/examples/console/get-coupon.md b/docs/examples/console/get-coupon.md index 716d26a5..74c7a579 100644 --- a/docs/examples/console/get-coupon.md +++ b/docs/examples/console/get-coupon.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.getCoupon({ +const result = await console.getCoupon({ couponId: '' }); diff --git a/docs/examples/console/get-plan.md b/docs/examples/console/get-plan.md index 7171de67..4c860725 100644 --- a/docs/examples/console/get-plan.md +++ b/docs/examples/console/get-plan.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.getPlan({ +const result = await console.getPlan({ planId: '' }); diff --git a/docs/examples/console/get-plans.md b/docs/examples/console/get-plans.md index c5d846a4..546c7286 100644 --- a/docs/examples/console/get-plans.md +++ b/docs/examples/console/get-plans.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.getPlans({ +const result = await console.getPlans({ platform: Platform.Appwrite // optional }); diff --git a/docs/examples/console/get-program.md b/docs/examples/console/get-program.md index 5e19bcf0..038cf5f3 100644 --- a/docs/examples/console/get-program.md +++ b/docs/examples/console/get-program.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.getProgram({ +const result = await console.getProgram({ programId: '' }); diff --git a/docs/examples/console/get-resource.md b/docs/examples/console/get-resource.md index 699a83dd..706d96ea 100644 --- a/docs/examples/console/get-resource.md +++ b/docs/examples/console/get-resource.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.getResource({ +const result = await console.getResource({ value: '', type: ConsoleResourceType.Rules }); diff --git a/docs/examples/console/list-o-auth-2-providers.md b/docs/examples/console/list-o-auth-2-providers.md index 278d16da..d26800b2 100644 --- a/docs/examples/console/list-o-auth-2-providers.md +++ b/docs/examples/console/list-o-auth-2-providers.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.listOAuth2Providers(); +const result = await console.listOAuth2Providers(); console.log(result); ``` diff --git a/docs/examples/console/list-project-scopes.md b/docs/examples/console/list-project-scopes.md index f59300a3..b1cb8034 100644 --- a/docs/examples/console/list-project-scopes.md +++ b/docs/examples/console/list-project-scopes.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.listProjectScopes(); +const result = await console.listProjectScopes(); console.log(result); ``` diff --git a/docs/examples/console/list-regions.md b/docs/examples/console/list-regions.md index ef750a85..5d49fee7 100644 --- a/docs/examples/console/list-regions.md +++ b/docs/examples/console/list-regions.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.listRegions(); +const result = await console.listRegions(); console.log(result); ``` diff --git a/docs/examples/console/suggest-columns.md b/docs/examples/console/suggest-columns.md index 50e866ed..32daa104 100644 --- a/docs/examples/console/suggest-columns.md +++ b/docs/examples/console/suggest-columns.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.suggestColumns({ +const result = await console.suggestColumns({ databaseId: '', tableId: '', context: '', // optional diff --git a/docs/examples/console/suggest-indexes.md b/docs/examples/console/suggest-indexes.md index 3014fc3d..e59e3377 100644 --- a/docs/examples/console/suggest-indexes.md +++ b/docs/examples/console/suggest-indexes.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.suggestIndexes({ +const result = await console.suggestIndexes({ databaseId: '', tableId: '', min: 1, // optional diff --git a/docs/examples/console/suggest-queries.md b/docs/examples/console/suggest-queries.md index cbffccc2..7e00cea7 100644 --- a/docs/examples/console/suggest-queries.md +++ b/docs/examples/console/suggest-queries.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.suggestQueries({ +const result = await console.suggestQueries({ resource: QuerySuggestionResource.Activities, input: '', databaseId: '', // optional diff --git a/docs/examples/console/variables.md b/docs/examples/console/variables.md index 3eafec11..d8c4077d 100644 --- a/docs/examples/console/variables.md +++ b/docs/examples/console/variables.md @@ -5,9 +5,9 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const xconsole = new Console(client); +const console = new Console(client); -const result = await xconsole.variables(); +const result = await console.variables(); console.log(result); ``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md new file mode 100644 index 00000000..f122c7c4 --- /dev/null +++ b/docs/examples/databases/create-big-int-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createBigIntAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 42bfa489..08c3b1b3 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createBooleanAttribute({ collectionId: '', key: '', required: false, - default: false, // optional + xdefault: false, // optional array: false // optional }); diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index b7ba76dd..65849d9a 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createDatetimeAttribute({ collectionId: '', key: '', required: false, - default: '2020-10-15T06:38:00.000+00:00', // optional + xdefault: '2020-10-15T06:38:00.000+00:00', // optional array: false // optional }); diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 2e519cec..d4b61f88 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createEmailAttribute({ collectionId: '', key: '', required: false, - default: 'email@example.com', // optional + xdefault: 'email@example.com', // optional array: false // optional }); diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 25e914a1..57794717 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -13,7 +13,7 @@ const result = await databases.createEnumAttribute({ key: '', elements: [], required: false, - default: '', // optional + xdefault: '', // optional array: false // optional }); diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 0234ad10..2b47891d 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -14,7 +14,7 @@ const result = await databases.createFloatAttribute({ required: false, min: null, // optional max: null, // optional - default: null, // optional + xdefault: null, // optional array: false // optional }); diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index fad81d79..346d3c42 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -14,7 +14,7 @@ const result = await databases.createIntegerAttribute({ required: false, min: null, // optional max: null, // optional - default: null, // optional + xdefault: null, // optional array: false // optional }); diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 1aa3a6c1..028ce6d8 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createIpAttribute({ collectionId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false // optional }); diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 2ea9e813..4edfa325 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createLineAttribute({ collectionId: '', key: '', required: false, - default: [[1, 2], [3, 4], [5, 6]] // optional + xdefault: [[1, 2], [3, 4], [5, 6]] // optional }); console.log(result); diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index 2a453501..69e397a6 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createLongtextAttribute({ collectionId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 6d47b00f..2f0a47bb 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createMediumtextAttribute({ collectionId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 37b500a1..a42e0961 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createPointAttribute({ collectionId: '', key: '', required: false, - default: [1, 2] // optional + xdefault: [1, 2] // optional }); console.log(result); diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index 736e9c52..0c1be0f2 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createPolygonAttribute({ collectionId: '', key: '', required: false, - default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional }); console.log(result); diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index e5a3de86..2c33d118 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -13,7 +13,7 @@ const result = await databases.createStringAttribute({ key: '', size: 1, required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index d883c36b..e301a34b 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createTextAttribute({ collectionId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index c059cd8f..3886c900 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -12,7 +12,7 @@ const result = await databases.createUrlAttribute({ collectionId: '', key: '', required: false, - default: 'https://example.com', // optional + xdefault: 'https://example.com', // optional array: false // optional }); diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index 9b3d2a49..d6a6664f 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -13,7 +13,7 @@ const result = await databases.createVarcharAttribute({ key: '', size: 1, required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md new file mode 100644 index 00000000..48af1566 --- /dev/null +++ b/docs/examples/databases/update-big-int-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateBigIntAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index d95cd30e..89b2038b 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateBooleanAttribute({ collectionId: '', key: '', required: false, - default: false, + xdefault: false, newKey: '' // optional }); diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 578d9e35..d83ce78d 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateDatetimeAttribute({ collectionId: '', key: '', required: false, - default: '2020-10-15T06:38:00.000+00:00', + xdefault: '2020-10-15T06:38:00.000+00:00', newKey: '' // optional }); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index d2cbd192..12d6155a 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateEmailAttribute({ collectionId: '', key: '', required: false, - default: 'email@example.com', + xdefault: 'email@example.com', newKey: '' // optional }); diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index fcc0f84f..660ccef2 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -13,7 +13,7 @@ const result = await databases.updateEnumAttribute({ key: '', elements: [], required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 4727581e..44b217e1 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateFloatAttribute({ collectionId: '', key: '', required: false, - default: null, + xdefault: null, min: null, // optional max: null, // optional newKey: '' // optional diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index d3f65130..44060d73 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateIntegerAttribute({ collectionId: '', key: '', required: false, - default: null, + xdefault: null, min: null, // optional max: null, // optional newKey: '' // optional diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index c940c81d..ad835da3 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateIpAttribute({ collectionId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index a7a68785..728e06d2 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateLineAttribute({ collectionId: '', key: '', required: false, - default: [[1, 2], [3, 4], [5, 6]], // 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 d92bb148..71424460 100644 --- a/docs/examples/databases/update-longtext-attribute.md +++ b/docs/examples/databases/update-longtext-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateLongtextAttribute({ collectionId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md index 37474b53..691a346f 100644 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateMediumtextAttribute({ collectionId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index 346fbab1..040c8f68 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updatePointAttribute({ collectionId: '', key: '', required: false, - default: [1, 2], // optional + xdefault: [1, 2], // optional newKey: '' // optional }); diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 13617139..a35fbbd8 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updatePolygonAttribute({ collectionId: '', key: '', required: false, - default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional newKey: '' // optional }); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 56c743ab..1c9e91c5 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateStringAttribute({ collectionId: '', key: '', required: false, - default: '', + xdefault: '', size: 1, // optional newKey: '' // optional }); diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md index f0299e90..e12557e1 100644 --- a/docs/examples/databases/update-text-attribute.md +++ b/docs/examples/databases/update-text-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateTextAttribute({ collectionId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 3b76a3f0..df026f35 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateUrlAttribute({ collectionId: '', key: '', required: false, - default: 'https://example.com', + xdefault: 'https://example.com', newKey: '' // optional }); diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md index f369d3e9..0ce1a55a 100644 --- a/docs/examples/databases/update-varchar-attribute.md +++ b/docs/examples/databases/update-varchar-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateVarcharAttribute({ collectionId: '', key: '', required: false, - default: '', + xdefault: '', size: 1, // optional newKey: '' // optional }); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 4a9f62bb..2707b790 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -11,7 +11,7 @@ const result = await functions.createExecution({ functionId: '', body: '', // optional async: false, // optional - path: '', // optional + xpath: '', // optional method: ExecutionMethod.GET, // optional headers: {}, // optional scheduledAt: '' // optional diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 2310f83d..444a0c6c 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -9,6 +9,7 @@ const functions = new Functions(client); const result = await functions.createVariable({ functionId: '', + variableId: '', key: '', value: '', secret: false // optional diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 854cff95..9407b8ef 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -8,7 +8,9 @@ const client = new Client() const functions = new Functions(client); const result = await functions.listVariables({ - functionId: '' + functionId: '', + queries: [], // optional + total: false // optional }); console.log(result); diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 383e9c05..5d7dc9aa 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -10,7 +10,7 @@ const functions = new Functions(client); const result = await functions.updateVariable({ functionId: '', variableId: '', - key: '', + key: '', // optional value: '', // optional secret: false // optional }); diff --git a/docs/examples/migrations/create-appwrite-migration.md b/docs/examples/migrations/create-appwrite-migration.md index d0f61541..9729806f 100644 --- a/docs/examples/migrations/create-appwrite-migration.md +++ b/docs/examples/migrations/create-appwrite-migration.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Migrations, AppwriteMigrationResource } from "@appwrite.io/console"; +import { Client, Migrations, AppwriteMigrationResource, OnDuplicate } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -11,7 +11,8 @@ const result = await migrations.createAppwriteMigration({ resources: [AppwriteMigrationResource.User], endpoint: 'https://example.com', projectId: '', - apiKey: '' + apiKey: '', + onDuplicate: OnDuplicate.Fail // optional }); console.log(result); diff --git a/docs/examples/migrations/create-csv-import.md b/docs/examples/migrations/create-csv-import.md index f39b1030..d24792b6 100644 --- a/docs/examples/migrations/create-csv-import.md +++ b/docs/examples/migrations/create-csv-import.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations, OnDuplicate } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -11,7 +11,8 @@ const result = await migrations.createCSVImport({ bucketId: '', fileId: '', resourceId: '', - internalFile: false // optional + internalFile: false, // optional + onDuplicate: OnDuplicate.Fail // optional }); console.log(result); diff --git a/docs/examples/migrations/create-json-import.md b/docs/examples/migrations/create-json-import.md index d0631117..f55fc8ff 100644 --- a/docs/examples/migrations/create-json-import.md +++ b/docs/examples/migrations/create-json-import.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Migrations } from "@appwrite.io/console"; +import { Client, Migrations, OnDuplicate } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -11,7 +11,8 @@ const result = await migrations.createJSONImport({ bucketId: '', fileId: '', resourceId: '', - internalFile: false // optional + internalFile: false, // optional + onDuplicate: OnDuplicate.Fail // optional }); console.log(result); diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index e1514f60..c41bb809 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -9,7 +9,7 @@ const project = new Project(client); const result = await project.createEphemeralKey({ scopes: [Scopes.ProjectRead], - duration: 1 + duration: 600 }); console.log(result); diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index a667c820..cb07b451 100644 --- a/docs/examples/project/get-o-auth-2-provider.md +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Project } from "@appwrite.io/console"; +import { Client, Project, OAuthProvider } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -8,7 +8,7 @@ const client = new Client() const project = new Project(client); const result = await project.getOAuth2Provider({ - provider: '' + providerId: OAuthProvider.Amazon }); console.log(result); diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index be9b5151..45fec071 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Project, PolicyId } from "@appwrite.io/console"; +import { Client, Project, ProjectPolicy } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -8,7 +8,7 @@ const client = new Client() const project = new Project(client); const result = await project.getPolicy({ - policyId: PolicyId.PasswordDictionary + policyId: ProjectPolicy.PasswordDictionary }); console.log(result); diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md index f4e6545b..3c8d5ea6 100644 --- a/docs/examples/project/list-o-auth-2-providers.md +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -7,7 +7,10 @@ const client = new Client() const project = new Project(client); -const result = await project.listOAuth2Providers(); +const result = await project.listOAuth2Providers({ + queries: [], // optional + total: false // optional +}); console.log(result); ``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md index 802d1d2b..fc0dfdfd 100644 --- a/docs/examples/project/update-auth-method.md +++ b/docs/examples/project/update-auth-method.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Project, MethodId } from "@appwrite.io/console"; +import { Client, Project, AuthMethod } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -8,7 +8,7 @@ const client = new Client() const project = new Project(client); const result = await project.updateAuthMethod({ - methodId: MethodId.EmailPassword, + methodId: AuthMethod.EmailPassword, enabled: false }); diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md index 29b8536e..4f97fb2f 100644 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -12,8 +12,8 @@ const result = await project.updateOAuth2Oidc({ clientSecret: '', // optional wellKnownURL: 'https://example.com', // optional authorizationURL: 'https://example.com', // optional - tokenUrl: 'https://example.com', // optional - userInfoUrl: 'https://example.com', // optional + tokenURL: 'https://example.com', // optional + userInfoURL: 'https://example.com', // optional enabled: false // optional }); diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md index 83a661f0..b4bd8701 100644 --- a/docs/examples/proxy/list-rules.md +++ b/docs/examples/proxy/list-rules.md @@ -9,7 +9,6 @@ const proxy = new Proxy(client); const result = await proxy.listRules({ queries: [], // optional - search: '', // optional total: false // optional }); diff --git a/docs/examples/proxy/update-rule-verification.md b/docs/examples/proxy/update-rule-status.md similarity index 86% rename from docs/examples/proxy/update-rule-verification.md rename to docs/examples/proxy/update-rule-status.md index 6eccae87..39310888 100644 --- a/docs/examples/proxy/update-rule-verification.md +++ b/docs/examples/proxy/update-rule-status.md @@ -7,7 +7,7 @@ const client = new Client() const proxy = new Proxy(client); -const result = await proxy.updateRuleVerification({ +const result = await proxy.updateRuleStatus({ ruleId: '' }); diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index d255a025..73f2f2d9 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -9,6 +9,7 @@ const sites = new Sites(client); const result = await sites.createVariable({ siteId: '', + variableId: '', key: '', value: '', secret: false // optional diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index e0f5717d..ae7626c1 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -8,7 +8,9 @@ const client = new Client() const sites = new Sites(client); const result = await sites.listVariables({ - siteId: '' + siteId: '', + queries: [], // optional + total: false // optional }); console.log(result); diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 6dcb5421..df1aeaf7 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -10,7 +10,7 @@ const sites = new Sites(client); const result = await sites.updateVariable({ siteId: '', variableId: '', - key: '', + key: '', // optional value: '', // optional secret: false // optional }); diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md new file mode 100644 index 00000000..c00adcc4 --- /dev/null +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createBigIntColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 7c61e928..9945d4c1 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createBooleanColumn({ tableId: '', key: '', required: false, - default: false, // optional + xdefault: false, // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index d9a1feca..2c71780b 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createDatetimeColumn({ tableId: '', key: '', required: false, - default: '2020-10-15T06:38:00.000+00:00', // optional + xdefault: '2020-10-15T06:38:00.000+00:00', // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index 876da2fa..4a10aeb8 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createEmailColumn({ tableId: '', key: '', required: false, - default: 'email@example.com', // optional + xdefault: 'email@example.com', // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index 31700e02..38aa95a6 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -13,7 +13,7 @@ const result = await tablesDB.createEnumColumn({ key: '', elements: [], required: false, - default: '', // optional + xdefault: '', // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index 68aa906f..bae50920 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -14,7 +14,7 @@ const result = await tablesDB.createFloatColumn({ required: false, min: null, // optional max: null, // optional - default: null, // optional + xdefault: null, // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index fc9d6080..f8104508 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -14,7 +14,7 @@ const result = await tablesDB.createIntegerColumn({ required: false, min: null, // optional max: null, // optional - default: null, // optional + xdefault: null, // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 89c29c00..71810e88 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createIpColumn({ tableId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index d2deeb4a..75136874 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createLineColumn({ tableId: '', key: '', required: false, - default: [[1, 2], [3, 4], [5, 6]] // optional + xdefault: [[1, 2], [3, 4], [5, 6]] // optional }); console.log(result); diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 89603a47..adc47e70 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createLongtextColumn({ tableId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index aef3b404..416cb048 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createMediumtextColumn({ tableId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 58fd9237..40ab6a44 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createPointColumn({ tableId: '', key: '', required: false, - default: [1, 2] // optional + xdefault: [1, 2] // optional }); console.log(result); diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index 54e02abe..5ad3723b 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createPolygonColumn({ tableId: '', key: '', required: false, - default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional }); console.log(result); diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index dec6e7d2..1e1c7710 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -13,7 +13,7 @@ const result = await tablesDB.createStringColumn({ key: '', size: 1, required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index 763e2df8..0ca82673 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createTextColumn({ tableId: '', key: '', required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index 127354ae..ffdb6e4f 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.createUrlColumn({ tableId: '', key: '', required: false, - default: 'https://example.com', // optional + xdefault: 'https://example.com', // optional array: false // optional }); diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index eee225d8..e143cc82 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -13,7 +13,7 @@ const result = await tablesDB.createVarcharColumn({ key: '', size: 1, required: false, - default: '', // optional + xdefault: '', // optional array: false, // optional encrypt: false // optional }); diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md new file mode 100644 index 00000000..578e813c --- /dev/null +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateBigIntColumn({ + databaseId: '', + tableId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index 6dade8f9..67380638 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateBooleanColumn({ tableId: '', key: '', required: false, - default: false, + xdefault: false, newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 34a70f97..89ec138f 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateDatetimeColumn({ tableId: '', key: '', required: false, - default: '2020-10-15T06:38:00.000+00:00', + xdefault: '2020-10-15T06:38:00.000+00:00', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 29e59fe7..981e5dd5 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateEmailColumn({ tableId: '', key: '', required: false, - default: 'email@example.com', + xdefault: 'email@example.com', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index 182eba09..493e9f3a 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -13,7 +13,7 @@ const result = await tablesDB.updateEnumColumn({ key: '', elements: [], required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index b6c827a8..0f655fd8 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateFloatColumn({ tableId: '', key: '', required: false, - default: null, + xdefault: null, min: null, // optional max: null, // optional newKey: '' // optional diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index f4fb54c4..e42a7142 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateIntegerColumn({ tableId: '', key: '', required: false, - default: null, + xdefault: null, min: null, // optional max: null, // optional newKey: '' // optional diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index 513b1141..d96b0121 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateIpColumn({ tableId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 3b0f8a73..ffc3813b 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateLineColumn({ tableId: '', key: '', required: false, - default: [[1, 2], [3, 4], [5, 6]], // 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 d444e8b1..6e3fda80 100644 --- a/docs/examples/tablesdb/update-longtext-column.md +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateLongtextColumn({ tableId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md index 10366e7d..dc994757 100644 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateMediumtextColumn({ tableId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index 9706918d..eac241e8 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updatePointColumn({ tableId: '', key: '', required: false, - default: [1, 2], // optional + xdefault: [1, 2], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 1639129d..854db0bd 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updatePolygonColumn({ tableId: '', key: '', required: false, - default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index e997d71c..3be9e866 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateStringColumn({ tableId: '', key: '', required: false, - default: '', + xdefault: '', size: 1, // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md index 30db18db..f5bd5abd 100644 --- a/docs/examples/tablesdb/update-text-column.md +++ b/docs/examples/tablesdb/update-text-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateTextColumn({ tableId: '', key: '', required: false, - default: '', + xdefault: '', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index cde0cb23..6af45cd0 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateUrlColumn({ tableId: '', key: '', required: false, - default: 'https://example.com', + xdefault: 'https://example.com', newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md index 6cbdc9c5..0b46befe 100644 --- a/docs/examples/tablesdb/update-varchar-column.md +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateVarcharColumn({ tableId: '', key: '', required: false, - default: '', + xdefault: '', size: 1, // optional newKey: '' // optional }); diff --git a/docs/examples/vcs/create-repository.md b/docs/examples/vcs/create-repository.md index 41707e65..a64eef87 100644 --- a/docs/examples/vcs/create-repository.md +++ b/docs/examples/vcs/create-repository.md @@ -10,7 +10,7 @@ const vcs = new Vcs(client); const result = await vcs.createRepository({ installationId: '', name: '', - private: false + xprivate: false }); console.log(result); diff --git a/docs/examples/vcs/list-repository-branches.md b/docs/examples/vcs/list-repository-branches.md index 4c85339e..97bf9296 100644 --- a/docs/examples/vcs/list-repository-branches.md +++ b/docs/examples/vcs/list-repository-branches.md @@ -9,7 +9,9 @@ const vcs = new Vcs(client); const result = await vcs.listRepositoryBranches({ installationId: '', - providerRepositoryId: '' + providerRepositoryId: '', + search: '', // optional + queries: '' // optional }); console.log(result); diff --git a/package-lock.json b/package-lock.json index c78c3218..d260ac4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@appwrite.io/console", - "version": "12.1.0", + "version": "12.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@appwrite.io/console", - "version": "12.1.0", + "version": "12.2.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index 17dec575..6ff1b316 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@appwrite.io/console", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "12.1.0", + "version": "12.2.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 7ba90334..fcd273d1 100644 --- a/src/client.ts +++ b/src/client.ts @@ -366,6 +366,7 @@ class Client { impersonateuserphone: string; platform: string; selfSigned: boolean; + session?: string; } = { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', @@ -382,6 +383,7 @@ class Client { impersonateuserphone: '', platform: '', selfSigned: false, + session: undefined, }; /** * Custom headers for API requests. @@ -390,8 +392,8 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '12.1.0', - 'X-Appwrite-Response-Format': '1.9.3', + 'x-sdk-version': '12.2.0', + 'X-Appwrite-Response-Format': '1.9.4', }; /** diff --git a/src/enums/method-id.ts b/src/enums/auth-method.ts similarity index 88% rename from src/enums/method-id.ts rename to src/enums/auth-method.ts index 062d0d0e..d5800ad9 100644 --- a/src/enums/method-id.ts +++ b/src/enums/auth-method.ts @@ -1,4 +1,4 @@ -export enum MethodId { +export enum AuthMethod { Emailpassword = 'email-password', Magicurl = 'magic-url', Emailotp = 'email-otp', diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index cc9e340b..06189633 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -42,4 +42,6 @@ export enum OAuthProvider { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', + GithubImagine = 'githubImagine', + GoogleImagine = 'googleImagine', } \ No newline at end of file diff --git a/src/enums/on-duplicate.ts b/src/enums/on-duplicate.ts new file mode 100644 index 00000000..9ab3dc85 --- /dev/null +++ b/src/enums/on-duplicate.ts @@ -0,0 +1,5 @@ +export enum OnDuplicate { + Fail = 'fail', + Skip = 'skip', + Overwrite = 'overwrite', +} \ No newline at end of file diff --git a/src/enums/policy-id.ts b/src/enums/project-policy.ts similarity index 93% rename from src/enums/policy-id.ts rename to src/enums/project-policy.ts index ab1c4cd2..d52bf99a 100644 --- a/src/enums/policy-id.ts +++ b/src/enums/project-policy.ts @@ -1,4 +1,4 @@ -export enum PolicyId { +export enum ProjectPolicy { Passworddictionary = 'password-dictionary', Passwordhistory = 'password-history', Passwordpersonaldata = 'password-personal-data', diff --git a/src/enums/proxy-rule-status.ts b/src/enums/proxy-rule-status.ts index 91896004..67b8e4cb 100644 --- a/src/enums/proxy-rule-status.ts +++ b/src/enums/proxy-rule-status.ts @@ -1,6 +1,5 @@ export enum ProxyRuleStatus { - Created = 'created', + Unverified = 'unverified', Verifying = 'verifying', Verified = 'verified', - Unverified = 'unverified', } \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 71badb40..532eb75c 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -64,6 +64,8 @@ export enum Scopes { TargetsWrite = 'targets.write', MessagesRead = 'messages.read', MessagesWrite = 'messages.write', + RulesRead = 'rules.read', + RulesWrite = 'rules.write', WebhooksRead = 'webhooks.read', WebhooksWrite = 'webhooks.write', LocaleRead = 'locale.read', @@ -76,8 +78,6 @@ export enum Scopes { SchedulesWrite = 'schedules.write', VcsRead = 'vcs.read', VcsWrite = 'vcs.write', - RulesRead = 'rules.read', - RulesWrite = 'rules.write', BackupsPoliciesRead = 'backups.policies.read', BackupsPoliciesWrite = 'backups.policies.write', ArchivesRead = 'archives.read', diff --git a/src/index.ts b/src/index.ts index afd9a364..3bf3bc1b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,12 +79,13 @@ export { ResourceType } from './enums/resource-type'; export { MessagePriority } from './enums/message-priority'; export { SmtpEncryption } from './enums/smtp-encryption'; export { AppwriteMigrationResource } from './enums/appwrite-migration-resource'; +export { OnDuplicate } from './enums/on-duplicate'; export { FirebaseMigrationResource } from './enums/firebase-migration-resource'; export { NHostMigrationResource } from './enums/n-host-migration-resource'; export { SupabaseMigrationResource } from './enums/supabase-migration-resource'; export { Addon } from './enums/addon'; -export { MethodId } from './enums/method-id'; -export { PolicyId } from './enums/policy-id'; +export { AuthMethod } from './enums/auth-method'; +export { ProjectPolicy } from './enums/project-policy'; export { ProtocolId } from './enums/protocol-id'; export { ServiceId } from './enums/service-id'; export { Secure } from './enums/secure'; diff --git a/src/models.ts b/src/models.ts index cf07e8ed..8164b782 100644 --- a/src/models.ts +++ b/src/models.ts @@ -915,7 +915,7 @@ export namespace Models { /** * Collection attributes. */ - attributes: (Models.AttributeBoolean | 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. */ @@ -941,7 +941,7 @@ export namespace Models { /** * List of attributes. */ - attributes: (Models.AttributeBoolean | 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)[]; } /** @@ -1044,6 +1044,56 @@ export namespace Models { default?: number; } + /** + * AttributeBigInt + */ + export type AttributeBigint = { + /** + * 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; + /** + * Minimum value to enforce for new documents. + */ + min?: number | bigint; + /** + * Maximum value to enforce for new documents. + */ + max?: number | bigint; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: number | bigint; + } + /** * AttributeFloat */ @@ -2081,7 +2131,7 @@ export namespace Models { /** * Table columns. */ - columns: (Models.ColumnBoolean | 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. */ @@ -2107,7 +2157,7 @@ export namespace Models { /** * List of columns. */ - columns: (Models.ColumnBoolean | 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)[]; } /** @@ -2210,6 +2260,56 @@ export namespace Models { default?: number; } + /** + * ColumnBigInt + */ + export type ColumnBigint = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number | bigint; + /** + * Maximum value to enforce for new documents. + */ + max?: number | bigint; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: number | bigint; + } + /** * ColumnFloat */ @@ -6292,11 +6392,11 @@ export namespace Models { /** * OpenID Connect token endpoint URL. */ - tokenUrl: string; + tokenURL: string; /** * OpenID Connect user info endpoint URL. */ - userInfoUrl: string; + userInfoURL: string; } /** @@ -8140,7 +8240,7 @@ export namespace Models { */ deploymentResourceType?: ProxyRuleDeploymentResourceType; /** - * ID deployment's resource. Used if type is "deployment" + * ID of deployment's resource (site or function ID). Used if type is "deployment" */ deploymentResourceId: string; /** @@ -8148,7 +8248,7 @@ export namespace Models { */ deploymentVcsProviderBranch: string; /** - * Domain verification status. Possible values are "created", "verifying", "verified" and "unverified" + * Domain verification status. Possible values are "unverified", "verifying", "verified" */ status: ProxyRuleStatus; /** @@ -9226,7 +9326,7 @@ export namespace Models { */ size: number; /** - * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed. + * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. */ status: string; /** diff --git a/src/services/databases.ts b/src/services/databases.ts index 6cc264a5..e21b9918 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1190,6 +1190,228 @@ export class Databases { ); } + /** + * Create a bigint attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise} + * @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; + /** + * Create a bigint attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise} + * @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)?] + ): 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 }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a bigint attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @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; + /** + * Update a bigint attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @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)?] + ): 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 }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** * Create a boolean attribute. * diff --git a/src/services/functions.ts b/src/services/functions.ts index 0e2c07e2..6bef57e6 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1892,33 +1892,42 @@ export class Functions { * Get a list of all variables of a specific function. * * @param {string} params.functionId - Function unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listVariables(params: { functionId: string }): Promise; + listVariables(params: { functionId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of all variables of a specific function. * * @param {string} functionId - Function unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(functionId: string): Promise; + listVariables(functionId: string, queries?: string[], total?: boolean): Promise; listVariables( - paramsOrFirst: { functionId: string } | string + paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { functionId: string }; + let params: { functionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string }; + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; } else { params = { - functionId: paramsOrFirst as string + functionId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean }; } const functionId = params.functionId; + const queries = params.queries; + const total = params.total; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); @@ -1926,6 +1935,12 @@ export class Functions { const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1943,17 +1958,19 @@ export class Functions { * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} params.key - Variable key. Max length: 255 chars. * @param {string} params.value - Variable value. Max length: 8192 chars. * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. * @throws {AppwriteException} * @returns {Promise} */ - createVariable(params: { functionId: 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} 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. @@ -1961,25 +1978,27 @@ export class Functions { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createVariable(functionId: string, key: string, value: string, secret?: boolean): Promise; + createVariable(functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise; createVariable( - paramsOrFirst: { functionId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + paramsOrFirst: { functionId: string, variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] ): Promise { - let params: { functionId: 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, key: string, value: string, secret?: boolean }; + params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; } else { params = { functionId: paramsOrFirst as string, - key: rest[0] as string, - value: rest[1] as string, - secret: rest[2] as boolean + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean }; } const functionId = params.functionId; + const variableId = params.variableId; const key = params.key; const value = params.value; const secret = params.secret; @@ -1987,6 +2006,9 @@ export class Functions { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); } @@ -1996,6 +2018,9 @@ export class Functions { const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; + } if (typeof key !== 'undefined') { payload['key'] = key; } @@ -2089,7 +2114,7 @@ export class Functions { * @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. * @@ -2102,15 +2127,15 @@ export class Functions { * @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(functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise; updateVariable( - paramsOrFirst: { functionId: string, variableId: string, key: string, value?: string, secret?: boolean } | string, + 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 }; + 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 }; + params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; } else { params = { functionId: paramsOrFirst as string, @@ -2133,9 +2158,6 @@ export class Functions { if (typeof variableId === 'undefined') { throw new AppwriteException('Missing required parameter: "variableId"'); } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); const payload: Payload = {}; diff --git a/src/services/migrations.ts b/src/services/migrations.ts index b4b8e483..1874744f 100644 --- a/src/services/migrations.ts +++ b/src/services/migrations.ts @@ -3,6 +3,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; import { AppwriteMigrationResource } from '../enums/appwrite-migration-resource'; +import { OnDuplicate } from '../enums/on-duplicate'; import { FirebaseMigrationResource } from '../enums/firebase-migration-resource'; import { NHostMigrationResource } from '../enums/n-host-migration-resource'; import { SupabaseMigrationResource } from '../enums/supabase-migration-resource'; @@ -87,10 +88,11 @@ export class Migrations { * @param {string} params.endpoint - Source Appwrite endpoint * @param {string} params.projectId - Source Project ID * @param {string} params.apiKey - Source API Key + * @param {OnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} */ - createAppwriteMigration(params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string }): Promise; + createAppwriteMigration(params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate }): Promise; /** * Migrate data from another Appwrite project to your current project. This endpoint allows you to migrate resources like databases, collections, documents, users, and files from an existing Appwrite project. * @@ -98,25 +100,27 @@ export class Migrations { * @param {string} endpoint - Source Appwrite endpoint * @param {string} projectId - Source Project ID * @param {string} apiKey - Source API Key + * @param {OnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createAppwriteMigration(resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string): Promise; + createAppwriteMigration(resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate): Promise; createAppwriteMigration( - paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string } | AppwriteMigrationResource[], - ...rest: [(string)?, (string)?, (string)?] + paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate } | AppwriteMigrationResource[], + ...rest: [(string)?, (string)?, (string)?, (OnDuplicate)?] ): Promise { - let params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string }; + let params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate }; - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'projectId' in paramsOrFirst || 'apiKey' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string }; + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'projectId' in paramsOrFirst || 'apiKey' in paramsOrFirst || 'onDuplicate' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate }; } else { params = { resources: paramsOrFirst as AppwriteMigrationResource[], endpoint: rest[0] as string, projectId: rest[1] as string, - apiKey: rest[2] as string + apiKey: rest[2] as string, + onDuplicate: rest[3] as OnDuplicate }; } @@ -124,6 +128,7 @@ export class Migrations { const endpoint = params.endpoint; const projectId = params.projectId; const apiKey = params.apiKey; + const onDuplicate = params.onDuplicate; if (typeof resources === 'undefined') { throw new AppwriteException('Missing required parameter: "resources"'); @@ -152,6 +157,9 @@ export class Migrations { if (typeof apiKey !== 'undefined') { payload['apiKey'] = apiKey; } + if (typeof onDuplicate !== 'undefined') { + payload['onDuplicate'] = onDuplicate; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -373,10 +381,11 @@ export class Migrations { * @param {string} params.fileId - File ID. * @param {string} params.resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} params.internalFile - Is the file stored in an internal bucket? + * @param {OnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} */ - createCSVImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }): Promise; + createCSVImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }): Promise; /** * Import documents from a CSV file into your Appwrite database. This endpoint allows you to import documents from a CSV file uploaded to Appwrite Storage bucket. * @@ -384,25 +393,27 @@ export class Migrations { * @param {string} fileId - File ID. * @param {string} resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} internalFile - Is the file stored in an internal bucket? + * @param {OnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createCSVImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean): Promise; + createCSVImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate): Promise; createCSVImport( - paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate } | string, + ...rest: [(string)?, (string)?, (boolean)?, (OnDuplicate)?] ): Promise { - let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; + let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, resourceId: rest[1] as string, - internalFile: rest[2] as boolean + internalFile: rest[2] as boolean, + onDuplicate: rest[3] as OnDuplicate }; } @@ -410,6 +421,7 @@ export class Migrations { const fileId = params.fileId; const resourceId = params.resourceId; const internalFile = params.internalFile; + const onDuplicate = params.onDuplicate; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -435,6 +447,9 @@ export class Migrations { if (typeof internalFile !== 'undefined') { payload['internalFile'] = internalFile; } + if (typeof onDuplicate !== 'undefined') { + payload['onDuplicate'] = onDuplicate; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -677,10 +692,11 @@ export class Migrations { * @param {string} params.fileId - File ID. * @param {string} params.resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} params.internalFile - Is the file stored in an internal bucket? + * @param {OnDuplicate} params.onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} */ - createJSONImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }): Promise; + createJSONImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }): Promise; /** * Import documents from a JSON file into your Appwrite database. This endpoint allows you to import documents from a JSON file uploaded to Appwrite Storage bucket. * @@ -689,25 +705,27 @@ export class Migrations { * @param {string} fileId - File ID. * @param {string} resourceId - Composite ID in the format {databaseId:collectionId}, identifying a collection within a database. * @param {boolean} internalFile - Is the file stored in an internal bucket? + * @param {OnDuplicate} onDuplicate - Behavior when a row with an existing $id is encountered. "fail" (default): abort on first conflict. "skip": silently ignore. "overwrite": replace existing row. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createJSONImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean): Promise; + createJSONImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate): Promise; createJSONImport( - paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate } | string, + ...rest: [(string)?, (string)?, (boolean)?, (OnDuplicate)?] ): Promise { - let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; + let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, resourceId: rest[1] as string, - internalFile: rest[2] as boolean + internalFile: rest[2] as boolean, + onDuplicate: rest[3] as OnDuplicate }; } @@ -715,6 +733,7 @@ export class Migrations { const fileId = params.fileId; const resourceId = params.resourceId; const internalFile = params.internalFile; + const onDuplicate = params.onDuplicate; if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); @@ -740,6 +759,9 @@ export class Migrations { if (typeof internalFile !== 'undefined') { payload['internalFile'] = internalFile; } + if (typeof onDuplicate !== 'undefined') { + payload['onDuplicate'] = onDuplicate; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/project.ts b/src/services/project.ts index 114c0cd0..5ef653a2 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2,9 +2,10 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { MethodId } from '../enums/method-id'; +import { AuthMethod } from '../enums/auth-method'; import { Scopes } from '../enums/scopes'; -import { PolicyId } from '../enums/policy-id'; +import { OAuthProvider } from '../enums/o-auth-provider'; +import { ProjectPolicy } from '../enums/project-policy'; import { ProtocolId } from '../enums/protocol-id'; import { ServiceId } from '../enums/service-id'; import { Secure } from '../enums/secure'; @@ -46,33 +47,33 @@ export class Project { /** * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. * - * @param {MethodId} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {AuthMethod} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone * @param {boolean} params.enabled - Auth method status. * @throws {AppwriteException} * @returns {Promise} */ - updateAuthMethod(params: { methodId: MethodId, enabled: boolean }): Promise; + updateAuthMethod(params: { methodId: AuthMethod, enabled: boolean }): Promise; /** * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. * - * @param {MethodId} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {AuthMethod} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone * @param {boolean} enabled - Auth method status. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateAuthMethod(methodId: MethodId, enabled: boolean): Promise; + updateAuthMethod(methodId: AuthMethod, enabled: boolean): Promise; updateAuthMethod( - paramsOrFirst: { methodId: MethodId, enabled: boolean } | MethodId, + paramsOrFirst: { methodId: AuthMethod, enabled: boolean } | AuthMethod, ...rest: [(boolean)?] ): Promise { - let params: { methodId: MethodId, enabled: boolean }; + let params: { methodId: AuthMethod, enabled: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { methodId: MethodId, enabled: boolean }; + params = (paramsOrFirst || {}) as { methodId: AuthMethod, enabled: boolean }; } else { params = { - methodId: paramsOrFirst as MethodId, + methodId: paramsOrFirst as AuthMethod, enabled: rest[0] as boolean }; } @@ -1019,13 +1020,49 @@ export class Project { /** * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listOAuth2Providers(): 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. + * + * @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. + */ + listOAuth2Providers(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 }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + const apiPath = '/project/oauth2'; const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1043,7 +1080,7 @@ export class Project { * Update the project OAuth2 Amazon configuration. * * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: * @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} @@ -1053,7 +1090,7 @@ export class Project { * Update the project OAuth2 Amazon configuration. * * @param {string} clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: * @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} @@ -1191,7 +1228,7 @@ export class Project { * Update the project OAuth2 Auth0 configuration. * * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1202,7 +1239,7 @@ export class Project { * Update the project OAuth2 Auth0 configuration. * * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1265,7 +1302,7 @@ export class Project { * Update the project OAuth2 Authentik configuration. * * @param {string} params.clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: * @param {string} params.endpoint - Domain of Authentik instance. For example: example.authentik.com * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1276,7 +1313,7 @@ export class Project { * Update the project OAuth2 Authentik configuration. * * @param {string} clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: * @param {string} endpoint - Domain of Authentik instance. For example: example.authentik.com * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1339,7 +1376,7 @@ export class Project { * Update the project OAuth2 Autodesk configuration. * * @param {string} params.clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: * @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} @@ -1349,7 +1386,7 @@ export class Project { * Update the project OAuth2 Autodesk configuration. * * @param {string} clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: * @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} @@ -1406,7 +1443,7 @@ export class Project { * Update the project OAuth2 Bitbucket configuration. * * @param {string} params.key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: * @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} @@ -1416,7 +1453,7 @@ export class Project { * Update the project OAuth2 Bitbucket configuration. * * @param {string} key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: * @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} @@ -1473,7 +1510,7 @@ export class Project { * Update the project OAuth2 Bitly configuration. * * @param {string} params.clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: * @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} @@ -1483,7 +1520,7 @@ export class Project { * Update the project OAuth2 Bitly configuration. * * @param {string} clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: * @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} @@ -1540,7 +1577,7 @@ export class Project { * Update the project OAuth2 Box configuration. * * @param {string} params.clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: * @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} @@ -1550,7 +1587,7 @@ export class Project { * Update the project OAuth2 Box configuration. * * @param {string} clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: * @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} @@ -1607,7 +1644,7 @@ export class Project { * Update the project OAuth2 Dailymotion configuration. * * @param {string} params.apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: * @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} @@ -1617,7 +1654,7 @@ export class Project { * Update the project OAuth2 Dailymotion configuration. * * @param {string} apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: * @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} @@ -1674,7 +1711,7 @@ export class Project { * Update the project OAuth2 Discord configuration. * * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: * @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} @@ -1684,7 +1721,7 @@ export class Project { * Update the project OAuth2 Discord configuration. * * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: * @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} @@ -1741,7 +1778,7 @@ export class Project { * Update the project OAuth2 Disqus configuration. * * @param {string} params.publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: * @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} @@ -1751,7 +1788,7 @@ export class Project { * Update the project OAuth2 Disqus configuration. * * @param {string} publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: * @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} @@ -1808,7 +1845,7 @@ export class Project { * Update the project OAuth2 Dropbox configuration. * * @param {string} params.appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: * @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} @@ -1818,7 +1855,7 @@ export class Project { * Update the project OAuth2 Dropbox configuration. * * @param {string} appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: * @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} @@ -1875,7 +1912,7 @@ export class Project { * Update the project OAuth2 Etsy configuration. * * @param {string} params.keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: * @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} @@ -1885,7 +1922,7 @@ export class Project { * Update the project OAuth2 Etsy configuration. * * @param {string} keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: * @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} @@ -1942,7 +1979,7 @@ export class Project { * Update the project OAuth2 Facebook configuration. * * @param {string} params.appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: * @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} @@ -1952,7 +1989,7 @@ export class Project { * Update the project OAuth2 Facebook configuration. * * @param {string} appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: * @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} @@ -2009,7 +2046,7 @@ export class Project { * Update the project OAuth2 Figma configuration. * * @param {string} params.clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: * @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} @@ -2019,7 +2056,7 @@ export class Project { * Update the project OAuth2 Figma configuration. * * @param {string} clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: * @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} @@ -2076,7 +2113,7 @@ export class Project { * Update the project OAuth2 FusionAuth configuration. * * @param {string} params.clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: * @param {string} params.endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2087,7 +2124,7 @@ export class Project { * Update the project OAuth2 FusionAuth configuration. * * @param {string} clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: * @param {string} endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2150,7 +2187,7 @@ export class Project { * Update the project OAuth2 GitHub configuration. * * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: * @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} @@ -2160,7 +2197,7 @@ export class Project { * Update the project OAuth2 GitHub configuration. * * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: * @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} @@ -2217,7 +2254,7 @@ export class Project { * Update the project OAuth2 Gitlab configuration. * * @param {string} params.applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: * @param {string} params.endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2228,7 +2265,7 @@ export class Project { * Update the project OAuth2 Gitlab configuration. * * @param {string} applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: * @param {string} endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2291,7 +2328,7 @@ export class Project { * Update the project OAuth2 Google configuration. * * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: * @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} @@ -2301,7 +2338,7 @@ export class Project { * Update the project OAuth2 Google configuration. * * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: * @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} @@ -2358,7 +2395,7 @@ export class Project { * Update the project OAuth2 Keycloak configuration. * * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: * @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. @@ -2370,7 +2407,7 @@ export class Project { * Update the project OAuth2 Keycloak configuration. * * @param {string} clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: * @param {string} endpoint - Domain of Keycloak instance. For example: keycloak.example.com * @param {string} realmName - Keycloak realm name. For example: appwrite-realm * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2439,7 +2476,7 @@ export class Project { * Update the project OAuth2 Kick configuration. * * @param {string} params.clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: * @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} @@ -2449,7 +2486,7 @@ export class Project { * Update the project OAuth2 Kick configuration. * * @param {string} clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: * @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} @@ -2506,7 +2543,7 @@ export class Project { * Update the project OAuth2 Linkedin configuration. * * @param {string} params.clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: * @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} @@ -2516,7 +2553,7 @@ export class Project { * Update the project OAuth2 Linkedin configuration. * * @param {string} clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: * @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} @@ -2573,7 +2610,7 @@ export class Project { * Update the project OAuth2 Microsoft configuration. * * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2584,7 +2621,7 @@ export class Project { * Update the project OAuth2 Microsoft configuration. * * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2647,7 +2684,7 @@ export class Project { * Update the project OAuth2 Notion configuration. * * @param {string} params.oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: * @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} @@ -2657,7 +2694,7 @@ export class Project { * Update the project OAuth2 Notion configuration. * * @param {string} oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: * @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} @@ -2714,47 +2751,47 @@ export class Project { * Update the project OAuth2 Oidc configuration. * * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} params.tokenUrl - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} params.userInfoUrl - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {string} params.tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} params.userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} */ - updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean }): Promise; + updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }): Promise; /** * Update the project OAuth2 Oidc configuration. * * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} tokenUrl - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} userInfoUrl - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {string} tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean): Promise; + updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean): Promise; updateOAuth2Oidc( - paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean } | string, + paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] ): Promise { - let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean }; + let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenUrl?: string, userInfoUrl?: string, enabled?: boolean }; + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; } else { params = { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, wellKnownURL: rest[1] as string, authorizationURL: rest[2] as string, - tokenUrl: rest[3] as string, - userInfoUrl: rest[4] as string, + tokenURL: rest[3] as string, + userInfoURL: rest[4] as string, enabled: rest[5] as boolean }; } @@ -2763,8 +2800,8 @@ export class Project { const clientSecret = params.clientSecret; const wellKnownURL = params.wellKnownURL; const authorizationURL = params.authorizationURL; - const tokenUrl = params.tokenUrl; - const userInfoUrl = params.userInfoUrl; + const tokenURL = params.tokenURL; + const userInfoURL = params.userInfoURL; const enabled = params.enabled; @@ -2782,11 +2819,11 @@ export class Project { if (typeof authorizationURL !== 'undefined') { payload['authorizationURL'] = authorizationURL; } - if (typeof tokenUrl !== 'undefined') { - payload['tokenUrl'] = tokenUrl; + if (typeof tokenURL !== 'undefined') { + payload['tokenURL'] = tokenURL; } - if (typeof userInfoUrl !== 'undefined') { - payload['userInfoUrl'] = userInfoUrl; + if (typeof userInfoURL !== 'undefined') { + payload['userInfoURL'] = userInfoURL; } if (typeof enabled !== 'undefined') { payload['enabled'] = enabled; @@ -2809,7 +2846,7 @@ export class Project { * Update the project OAuth2 Okta configuration. * * @param {string} params.clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2821,7 +2858,7 @@ export class Project { * Update the project OAuth2 Okta configuration. * * @param {string} clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2890,7 +2927,7 @@ export class Project { * Update the project OAuth2 Paypal configuration. * * @param {string} params.clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: * @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} @@ -2900,7 +2937,7 @@ export class Project { * Update the project OAuth2 Paypal configuration. * * @param {string} clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: * @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} @@ -2957,7 +2994,7 @@ export class Project { * Update the project OAuth2 PaypalSandbox configuration. * * @param {string} params.clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: * @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} @@ -2967,7 +3004,7 @@ export class Project { * Update the project OAuth2 PaypalSandbox configuration. * * @param {string} clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: * @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} @@ -3024,7 +3061,7 @@ export class Project { * Update the project OAuth2 Podio configuration. * * @param {string} params.clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: * @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} @@ -3034,7 +3071,7 @@ export class Project { * Update the project OAuth2 Podio configuration. * * @param {string} clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: * @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} @@ -3091,7 +3128,7 @@ export class Project { * Update the project OAuth2 Salesforce configuration. * * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: * @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} @@ -3101,7 +3138,7 @@ export class Project { * Update the project OAuth2 Salesforce configuration. * * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: * @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} @@ -3158,7 +3195,7 @@ export class Project { * Update the project OAuth2 Slack configuration. * * @param {string} params.clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: * @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} @@ -3168,7 +3205,7 @@ export class Project { * Update the project OAuth2 Slack configuration. * * @param {string} clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: * @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} @@ -3225,7 +3262,7 @@ export class Project { * Update the project OAuth2 Spotify configuration. * * @param {string} params.clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: * @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} @@ -3235,7 +3272,7 @@ export class Project { * Update the project OAuth2 Spotify configuration. * * @param {string} clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: * @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} @@ -3292,7 +3329,7 @@ export class Project { * Update the project OAuth2 Stripe configuration. * * @param {string} params.clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: * @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} @@ -3302,7 +3339,7 @@ export class Project { * Update the project OAuth2 Stripe configuration. * * @param {string} clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: * @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} @@ -3359,7 +3396,7 @@ export class Project { * Update the project OAuth2 Tradeshift configuration. * * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: * @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} @@ -3369,7 +3406,7 @@ export class Project { * Update the project OAuth2 Tradeshift configuration. * * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: * @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} @@ -3426,7 +3463,7 @@ export class Project { * Update the project OAuth2 Tradeshift Sandbox configuration. * * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: * @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} @@ -3436,7 +3473,7 @@ export class Project { * Update the project OAuth2 Tradeshift Sandbox configuration. * * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: * @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} @@ -3493,7 +3530,7 @@ export class Project { * Update the project OAuth2 Twitch configuration. * * @param {string} params.clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: * @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} @@ -3503,7 +3540,7 @@ export class Project { * Update the project OAuth2 Twitch configuration. * * @param {string} clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: * @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} @@ -3560,7 +3597,7 @@ export class Project { * Update the project OAuth2 WordPress configuration. * * @param {string} params.clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: * @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} @@ -3570,7 +3607,7 @@ export class Project { * Update the project OAuth2 WordPress configuration. * * @param {string} clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: * @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} @@ -3627,7 +3664,7 @@ export class Project { * Update the project OAuth2 X configuration. * * @param {string} params.customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: * @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} @@ -3637,7 +3674,7 @@ export class Project { * Update the project OAuth2 X configuration. * * @param {string} customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: * @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} @@ -3694,7 +3731,7 @@ export class Project { * Update the project OAuth2 Yahoo configuration. * * @param {string} params.clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: * @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} @@ -3704,7 +3741,7 @@ export class Project { * Update the project OAuth2 Yahoo configuration. * * @param {string} clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: * @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} @@ -3761,7 +3798,7 @@ export class Project { * Update the project OAuth2 Yandex configuration. * * @param {string} params.clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: * @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} @@ -3771,7 +3808,7 @@ export class Project { * Update the project OAuth2 Yandex configuration. * * @param {string} clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: * @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} @@ -3828,7 +3865,7 @@ export class Project { * Update the project OAuth2 Zoho configuration. * * @param {string} params.clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: * @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} @@ -3838,7 +3875,7 @@ export class Project { * Update the project OAuth2 Zoho configuration. * * @param {string} clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: * @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} @@ -3895,7 +3932,7 @@ export class Project { * Update the project OAuth2 Zoom configuration. * * @param {string} params.clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - * @param {string} params.clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {string} params.clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: * @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} @@ -3905,7 +3942,7 @@ export class Project { * Update the project OAuth2 Zoom configuration. * * @param {string} clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: * @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} @@ -3961,40 +3998,40 @@ export class Project { /** * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {string} params.provider - OAuth2 provider key. For example: github, google, apple. + * @param {OAuthProvider} params.providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} * @returns {Promise} */ - getOAuth2Provider(params: { provider: string }): Promise; + getOAuth2Provider(params: { providerId: OAuthProvider }): Promise; /** * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {string} provider - OAuth2 provider key. For example: github, google, apple. + * @param {OAuthProvider} providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getOAuth2Provider(provider: string): Promise; + getOAuth2Provider(providerId: OAuthProvider): Promise; getOAuth2Provider( - paramsOrFirst: { provider: string } | string + paramsOrFirst: { providerId: OAuthProvider } | OAuthProvider ): Promise { - let params: { provider: string }; + let params: { providerId: OAuthProvider }; - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { provider: string }; + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: OAuthProvider }; } else { params = { - provider: paramsOrFirst as string + providerId: paramsOrFirst as OAuthProvider }; } - const provider = params.provider; + const providerId = params.providerId; - if (typeof provider === 'undefined') { - throw new AppwriteException('Missing required parameter: "provider"'); + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); } - const apiPath = '/project/oauth2/{provider}'.replace('{provider}', provider); + const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', providerId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -5503,30 +5540,30 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {PolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicy} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. * @throws {AppwriteException} * @returns {Promise} */ - getPolicy(params: { policyId: PolicyId }): Promise; + getPolicy(params: { policyId: ProjectPolicy }): Promise; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {PolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicy} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: PolicyId): Promise; + getPolicy(policyId: ProjectPolicy): Promise; getPolicy( - paramsOrFirst: { policyId: PolicyId } | PolicyId + paramsOrFirst: { policyId: ProjectPolicy } | ProjectPolicy ): Promise { - let params: { policyId: PolicyId }; + let params: { policyId: ProjectPolicy }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: PolicyId }; + params = (paramsOrFirst || {}) as { policyId: ProjectPolicy }; } else { params = { - policyId: paramsOrFirst as PolicyId + policyId: paramsOrFirst as ProjectPolicy }; } @@ -6205,7 +6242,7 @@ export class Project { /** * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. * - * @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.variableId - Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} params.key - Variable key. Max length: 255 chars. * @param {string} params.value - Variable value. Max length: 8192 chars. * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. @@ -6216,7 +6253,7 @@ export class Project { /** * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. * - * @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} variableId - Variable unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} key - Variable key. Max length: 255 chars. * @param {string} value - Variable value. Max length: 8192 chars. * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. @@ -6288,7 +6325,7 @@ export class Project { /** * Get a variable by its unique ID. * - * @param {string} params.variableId - Variable ID. + * @param {string} params.variableId - Variable unique ID. * @throws {AppwriteException} * @returns {Promise} */ @@ -6296,7 +6333,7 @@ export class Project { /** * Get a variable by its unique ID. * - * @param {string} variableId - Variable ID. + * @param {string} variableId - Variable unique ID. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. @@ -6339,7 +6376,7 @@ export class Project { /** * Update variable by its unique ID. * - * @param {string} params.variableId - Variable ID. + * @param {string} params.variableId - Variable unique ID. * @param {string} params.key - Variable key. Max length: 255 chars. * @param {string} params.value - Variable value. Max length: 8192 chars. * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. @@ -6350,7 +6387,7 @@ export class Project { /** * Update variable by its unique ID. * - * @param {string} variableId - Variable ID. + * @param {string} variableId - Variable unique ID. * @param {string} key - Variable key. Max length: 255 chars. * @param {string} value - Variable value. Max length: 8192 chars. * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. @@ -6413,7 +6450,7 @@ export class Project { /** * Delete a variable by its unique ID. * - * @param {string} params.variableId - Variable ID. + * @param {string} params.variableId - Variable unique ID. * @throws {AppwriteException} * @returns {Promise<{}>} */ @@ -6421,7 +6458,7 @@ export class Project { /** * Delete a variable by its unique ID. * - * @param {string} variableId - Variable ID. + * @param {string} variableId - Variable unique ID. * @throws {AppwriteException} * @returns {Promise<{}>} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/services/proxy.ts b/src/services/proxy.ts index 4ca610aa..a5a86736 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -16,41 +16,37 @@ export class Proxy { * Get a list of all the proxy rules. You can use the query params to filter your results. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch - * @param {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} */ - listRules(params?: { queries?: string[], search?: 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. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch - * @param {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. */ - listRules(queries?: string[], search?: string, total?: boolean): Promise; + listRules(queries?: string[], total?: boolean): Promise; listRules( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] ): Promise { - let params: { queries?: string[], search?: string, total?: boolean }; + let params: { queries?: string[], total?: boolean }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; } else { params = { queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean + total: rest[0] as boolean }; } const queries = params.queries; - const search = params.search; const total = params.total; @@ -59,9 +55,6 @@ export class Proxy { if (typeof queries !== 'undefined') { payload['queries'] = queries; } - if (typeof search !== 'undefined') { - payload['search'] = search; - } if (typeof total !== 'undefined') { payload['total'] = total; } @@ -80,6 +73,8 @@ export class Proxy { /** * Create a new proxy rule for serving Appwrite's API on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. * * @param {string} params.domain - Domain name. * @throws {AppwriteException} @@ -88,6 +83,8 @@ 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. * @throws {AppwriteException} @@ -135,6 +132,8 @@ export class Proxy { /** * Create a new proxy rule for executing Appwrite Function on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. * * @param {string} params.domain - Domain name. * @param {string} params.functionId - ID of function to be executed. @@ -145,6 +144,8 @@ export class Proxy { 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. * @param {string} functionId - ID of function to be executed. @@ -208,6 +209,8 @@ export class Proxy { /** * Create a new proxy rule for to redirect from custom domain to another domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. * * @param {string} params.domain - Domain name. * @param {string} params.url - Target URL of redirection @@ -220,6 +223,8 @@ export class Proxy { 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. * @param {string} url - Target URL of redirection @@ -304,6 +309,8 @@ export class Proxy { /** * Create a new proxy rule for serving Appwrite Site on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. * * @param {string} params.domain - Domain name. * @param {string} params.siteId - ID of site to be executed. @@ -314,6 +321,8 @@ export class Proxy { 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. * @param {string} siteId - ID of site to be executed. @@ -479,23 +488,23 @@ export class Proxy { } /** - * Retry getting verification process of a proxy rule. This endpoint triggers domain verification by checking DNS records (CNAME) against the configured target domain. If verification is successful, a TLS certificate will be automatically provisioned for the domain. + * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. * * @param {string} params.ruleId - Rule ID. * @throws {AppwriteException} * @returns {Promise} */ - updateRuleVerification(params: { ruleId: string }): Promise; + updateRuleStatus(params: { ruleId: string }): Promise; /** - * Retry getting verification process of a proxy rule. This endpoint triggers domain verification by checking DNS records (CNAME) against the configured target domain. If verification is successful, a TLS certificate will be automatically provisioned for the domain. + * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. * * @param {string} ruleId - Rule ID. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateRuleVerification(ruleId: string): Promise; - updateRuleVerification( + updateRuleStatus(ruleId: string): Promise; + updateRuleStatus( paramsOrFirst: { ruleId: string } | string ): Promise { let params: { ruleId: string }; @@ -514,7 +523,7 @@ export class Proxy { throw new AppwriteException('Missing required parameter: "ruleId"'); } - const apiPath = '/proxy/rules/{ruleId}/verification'.replace('{ruleId}', ruleId); + const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', 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 1330ddd2..e56c2d74 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -1799,33 +1799,42 @@ export class Sites { * Get a list of all variables of a specific site. * * @param {string} params.siteId - Site unique ID. + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} */ - listVariables(params: { siteId: string }): Promise; + listVariables(params: { siteId: string, queries?: string[], total?: boolean }): Promise; /** * Get a list of all variables of a specific site. * * @param {string} siteId - Site unique ID. + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, resourceType, resourceId, secret + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(siteId: string): Promise; + listVariables(siteId: string, queries?: string[], total?: boolean): Promise; listVariables( - paramsOrFirst: { siteId: string } | string + paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] ): Promise { - let params: { siteId: string }; + let params: { siteId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string }; + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; } else { params = { - siteId: paramsOrFirst as string + siteId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean }; } const siteId = params.siteId; + const queries = params.queries; + const total = params.total; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); @@ -1833,6 +1842,12 @@ export class Sites { const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1850,17 +1865,19 @@ export class Sites { * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. * * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} params.key - Variable key. Max length: 255 chars. * @param {string} params.value - Variable value. Max length: 8192 chars. * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. * @throws {AppwriteException} * @returns {Promise} */ - createVariable(params: { siteId: 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} 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. @@ -1868,25 +1885,27 @@ export class Sites { * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createVariable(siteId: string, key: string, value: string, secret?: boolean): Promise; + createVariable(siteId: string, variableId: string, key: string, value: string, secret?: boolean): Promise; createVariable( - paramsOrFirst: { siteId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] + paramsOrFirst: { siteId: string, variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] ): Promise { - let params: { siteId: 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, key: string, value: string, secret?: boolean }; + params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; } else { params = { siteId: paramsOrFirst as string, - key: rest[0] as string, - value: rest[1] as string, - secret: rest[2] as boolean + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean }; } const siteId = params.siteId; + const variableId = params.variableId; const key = params.key; const value = params.value; const secret = params.secret; @@ -1894,6 +1913,9 @@ export class Sites { if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } if (typeof key === 'undefined') { throw new AppwriteException('Missing required parameter: "key"'); } @@ -1903,6 +1925,9 @@ export class Sites { const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; + } if (typeof key !== 'undefined') { payload['key'] = key; } @@ -1996,7 +2021,7 @@ export class Sites { * @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. * @@ -2009,15 +2034,15 @@ export class Sites { * @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(siteId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise; updateVariable( - paramsOrFirst: { siteId: string, variableId: string, key: string, value?: string, secret?: boolean } | string, + 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 }; + 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 }; + params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; } else { params = { siteId: paramsOrFirst as string, @@ -2040,9 +2065,6 @@ export class Sites { if (typeof variableId === 'undefined') { throw new AppwriteException('Missing required parameter: "variableId"'); } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); const payload: Payload = {}; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 83667c47..d9a8364b 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -1178,6 +1178,226 @@ export class TablesDB { ); } + /** + * Create a bigint column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise} + */ + 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. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise} + * @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)?] + ): 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 }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a bigint column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + */ + 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. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise} + * @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)?] + ): 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 }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** * Create a boolean column. * diff --git a/src/services/vcs.ts b/src/services/vcs.ts index 95d1b32f..6bbaa411 100644 --- a/src/services/vcs.ts +++ b/src/services/vcs.ts @@ -300,43 +300,51 @@ export class Vcs { } /** - * Get a list of all branches from a GitHub repository in your installation. This endpoint returns the names of all branches in the repository and their total count. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work. + * Get a list of branches from a GitHub repository in your installation. This endpoint supports filtering by a search term and pagination using query strings such as `Query.limit()`, `Query.offset()`, `Query.cursorAfter()`, and `Query.cursorBefore()`. It returns branch names along with the total number of matches. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work. * * * @param {string} params.installationId - Installation Id * @param {string} params.providerRepositoryId - Repository Id + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @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, offset, cursorAfter, and cursorBefore * @throws {AppwriteException} * @returns {Promise} */ - listRepositoryBranches(params: { installationId: string, providerRepositoryId: string }): Promise; + listRepositoryBranches(params: { installationId: string, providerRepositoryId: string, search?: string, queries?: string }): Promise; /** - * Get a list of all branches from a GitHub repository in your installation. This endpoint returns the names of all branches in the repository and their total count. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work. + * Get a list of branches from a GitHub repository in your installation. This endpoint supports filtering by a search term and pagination using query strings such as `Query.limit()`, `Query.offset()`, `Query.cursorAfter()`, and `Query.cursorBefore()`. It returns branch names along with the total number of matches. The GitHub installation must be properly configured and have access to the requested repository for this endpoint to work. * * * @param {string} installationId - Installation Id * @param {string} providerRepositoryId - Repository Id + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @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, offset, cursorAfter, and cursorBefore * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - listRepositoryBranches(installationId: string, providerRepositoryId: string): Promise; + listRepositoryBranches(installationId: string, providerRepositoryId: string, search?: string, queries?: string): Promise; listRepositoryBranches( - paramsOrFirst: { installationId: string, providerRepositoryId: string } | string, - ...rest: [(string)?] + paramsOrFirst: { installationId: string, providerRepositoryId: string, search?: string, queries?: string } | string, + ...rest: [(string)?, (string)?, (string)?] ): Promise { - let params: { installationId: string, providerRepositoryId: string }; + let params: { installationId: string, providerRepositoryId: string, search?: string, queries?: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { installationId: string, providerRepositoryId: string }; + params = (paramsOrFirst || {}) as { installationId: string, providerRepositoryId: string, search?: string, queries?: string }; } else { params = { installationId: paramsOrFirst as string, - providerRepositoryId: rest[0] as string + providerRepositoryId: rest[0] as string, + search: rest[1] as string, + queries: rest[2] as string }; } const installationId = params.installationId; const providerRepositoryId = params.providerRepositoryId; + const search = params.search; + const queries = params.queries; if (typeof installationId === 'undefined') { throw new AppwriteException('Missing required parameter: "installationId"'); @@ -347,6 +355,12 @@ export class Vcs { const apiPath = '/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/branches'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId); const payload: Payload = {}; + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = {