From 4b9bd5c89afdbcbfece169e52e0b3186d1550449 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 7 May 2026 08:33:21 +0000 Subject: [PATCH 01/15] chore: update Console SDK to 12.2.0 --- CHANGELOG.md | 6 + README.md | 6 +- .../databases/create-big-int-attribute.md | 22 ++ .../databases/update-big-int-attribute.md | 22 ++ docs/examples/functions/create-variable.md | 1 + docs/examples/functions/list-variables.md | 4 +- docs/examples/functions/update-variable.md | 2 +- docs/examples/project/create-ephemeral-key.md | 2 +- .../examples/project/get-o-auth-2-provider.md | 4 +- .../project/list-o-auth-2-providers.md | 5 +- docs/examples/project/update-o-auth-2-oidc.md | 4 +- docs/examples/proxy/list-rules.md | 1 - ...-verification.md => update-rule-status.md} | 2 +- docs/examples/sites/create-variable.md | 1 + docs/examples/sites/list-variables.md | 4 +- docs/examples/sites/update-variable.md | 2 +- .../tablesdb/create-big-int-column.md | 22 ++ .../tablesdb/update-big-int-column.md | 22 ++ package-lock.json | 4 +- package.json | 2 +- src/client.ts | 4 +- src/enums/provider-id.ts | 49 ++++ src/enums/proxy-rule-status.ts | 3 +- src/enums/scopes.ts | 4 +- src/index.ts | 1 + src/models.ts | 116 ++++++++- src/services/databases.ts | 222 ++++++++++++++++++ src/services/functions.ts | 68 ++++-- src/services/project.ts | 194 +++++++++------ src/services/proxy.ts | 49 ++-- src/services/sites.ts | 68 ++++-- src/services/tables-db.ts | 220 +++++++++++++++++ 32 files changed, 961 insertions(+), 175 deletions(-) create mode 100644 docs/examples/databases/create-big-int-attribute.md create mode 100644 docs/examples/databases/update-big-int-attribute.md rename docs/examples/proxy/{update-rule-verification.md => update-rule-status.md} (86%) create mode 100644 docs/examples/tablesdb/create-big-int-column.md create mode 100644 docs/examples/tablesdb/update-big-int-column.md create mode 100644 src/enums/provider-id.ts 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..83406b74 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # 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) -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -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/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md new file mode 100644 index 00000000..4685cc41 --- /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 + default: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md new file mode 100644 index 00000000..02e92ea6 --- /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, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` 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/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..d3e2e984 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, ProviderId } 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: ProviderId.Amazon }); 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-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..3a3995db --- /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 + default: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md new file mode 100644 index 00000000..10a6b0cc --- /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, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // 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..77a14b78 100644 --- a/src/client.ts +++ b/src/client.ts @@ -390,8 +390,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/provider-id.ts b/src/enums/provider-id.ts new file mode 100644 index 00000000..943d7334 --- /dev/null +++ b/src/enums/provider-id.ts @@ -0,0 +1,49 @@ +export enum ProviderId { + Amazon = 'amazon', + Apple = 'apple', + Auth0 = 'auth0', + Authentik = 'authentik', + Autodesk = 'autodesk', + Bitbucket = 'bitbucket', + Bitly = 'bitly', + Box = 'box', + Dailymotion = 'dailymotion', + Discord = 'discord', + Disqus = 'disqus', + Dropbox = 'dropbox', + Etsy = 'etsy', + Facebook = 'facebook', + Figma = 'figma', + Fusionauth = 'fusionauth', + Github = 'github', + Gitlab = 'gitlab', + Google = 'google', + Keycloak = 'keycloak', + Kick = 'kick', + Linkedin = 'linkedin', + Microsoft = 'microsoft', + Notion = 'notion', + Oidc = 'oidc', + Okta = 'okta', + Paypal = 'paypal', + PaypalSandbox = 'paypalSandbox', + Podio = 'podio', + Salesforce = 'salesforce', + Slack = 'slack', + Spotify = 'spotify', + Stripe = 'stripe', + Tradeshift = 'tradeshift', + TradeshiftBox = 'tradeshiftBox', + Twitch = 'twitch', + Wordpress = 'wordpress', + X = 'x', + Yahoo = 'yahoo', + Yammer = 'yammer', + Yandex = 'yandex', + Zoho = 'zoho', + Zoom = 'zoom', + Mock = 'mock', + Mockunverified = 'mock-unverified', + GithubImagine = 'githubImagine', + GoogleImagine = 'googleImagine', +} \ No newline at end of file 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..841b14e2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,6 +84,7 @@ 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 { ProviderId } from './enums/provider-id'; export { PolicyId } from './enums/policy-id'; export { ProtocolId } from './enums/protocol-id'; export { ServiceId } from './enums/service-id'; diff --git a/src/models.ts b/src/models.ts index cf07e8ed..d59cb2ab 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; /** 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/project.ts b/src/services/project.ts index 114c0cd0..981052f2 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -4,6 +4,7 @@ import type { Models } from '../models'; import { MethodId } from '../enums/method-id'; import { Scopes } from '../enums/scopes'; +import { ProviderId } from '../enums/provider-id'; import { PolicyId } from '../enums/policy-id'; import { ProtocolId } from '../enums/protocol-id'; import { ServiceId } from '../enums/service-id'; @@ -1019,13 +1020,103 @@ 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(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(): Promise { + 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 } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. + * + * @param {ProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. + * @throws {AppwriteException} + * @returns {Promise} + */ + getOAuth2Provider(params: { providerId: ProviderId }): Promise; + /** + * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. + * + * @param {ProviderId} providerId - OAuth2 provider key. For example: github, google, apple. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getOAuth2Provider(providerId: ProviderId): Promise; + getOAuth2Provider( + paramsOrFirst: { providerId: ProviderId } | ProviderId + ): Promise { + let params: { providerId: ProviderId }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: ProviderId }; + } else { + params = { + providerId: paramsOrFirst as ProviderId + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/project/oauth2/:provider'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2717,13 +2808,13 @@ export class Project { * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} params.tokenUrl - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} params.userInfoUrl - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {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. * @@ -2731,30 +2822,30 @@ export class Project { * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} tokenUrl - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} userInfoUrl - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {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 +2854,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 +2873,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; @@ -3958,57 +4049,6 @@ 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. - * @throws {AppwriteException} - * @returns {Promise} - */ - getOAuth2Provider(params: { provider: string }): 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. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getOAuth2Provider(provider: string): Promise; - getOAuth2Provider( - paramsOrFirst: { provider: string } | string - ): Promise { - let params: { provider: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { provider: string }; - } else { - params = { - provider: paramsOrFirst as string - }; - } - - const provider = params.provider; - - if (typeof provider === 'undefined') { - throw new AppwriteException('Missing required parameter: "provider"'); - } - - const apiPath = '/project/oauth2/{provider}'.replace('{provider}', provider); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - /** * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. * @@ -6205,7 +6245,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 +6256,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 +6328,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 +6336,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 +6379,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 +6390,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 +6453,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 +6461,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. * From 352d9a501c1b2eea294de575befc3ff39eb06c5e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 7 May 2026 11:35:14 +0000 Subject: [PATCH 02/15] chore: update Console SDK to 12.2.0 --- .../migrations/create-appwrite-migration.md | 5 +- docs/examples/migrations/create-csv-import.md | 5 +- .../examples/migrations/create-json-import.md | 5 +- .../examples/project/get-o-auth-2-provider.md | 4 +- docs/examples/project/get-policy.md | 4 +- docs/examples/project/update-auth-method.md | 4 +- src/enums/{method-id.ts => auth-method.ts} | 2 +- src/enums/o-auth-provider.ts | 2 + src/enums/on-duplicate.ts | 5 ++ .../{policy-id.ts => project-policy-id.ts} | 2 +- src/enums/provider-id.ts | 49 -------------- src/index.ts | 6 +- src/services/migrations.ts | 66 ++++++++++++------- src/services/project.ts | 54 +++++++-------- 14 files changed, 98 insertions(+), 115 deletions(-) rename src/enums/{method-id.ts => auth-method.ts} (88%) create mode 100644 src/enums/on-duplicate.ts rename src/enums/{policy-id.ts => project-policy-id.ts} (92%) delete mode 100644 src/enums/provider-id.ts 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/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index d3e2e984..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, ProviderId } 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({ - providerId: ProviderId.Amazon + providerId: OAuthProvider.Amazon }); console.log(result); diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index be9b5151..be06807f 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, ProjectPolicyId } 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: ProjectPolicyId.PasswordDictionary }); 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/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-id.ts similarity index 92% rename from src/enums/policy-id.ts rename to src/enums/project-policy-id.ts index ab1c4cd2..2031ce9b 100644 --- a/src/enums/policy-id.ts +++ b/src/enums/project-policy-id.ts @@ -1,4 +1,4 @@ -export enum PolicyId { +export enum ProjectPolicyId { Passworddictionary = 'password-dictionary', Passwordhistory = 'password-history', Passwordpersonaldata = 'password-personal-data', diff --git a/src/enums/provider-id.ts b/src/enums/provider-id.ts deleted file mode 100644 index 943d7334..00000000 --- a/src/enums/provider-id.ts +++ /dev/null @@ -1,49 +0,0 @@ -export enum ProviderId { - Amazon = 'amazon', - Apple = 'apple', - Auth0 = 'auth0', - Authentik = 'authentik', - Autodesk = 'autodesk', - Bitbucket = 'bitbucket', - Bitly = 'bitly', - Box = 'box', - Dailymotion = 'dailymotion', - Discord = 'discord', - Disqus = 'disqus', - Dropbox = 'dropbox', - Etsy = 'etsy', - Facebook = 'facebook', - Figma = 'figma', - Fusionauth = 'fusionauth', - Github = 'github', - Gitlab = 'gitlab', - Google = 'google', - Keycloak = 'keycloak', - Kick = 'kick', - Linkedin = 'linkedin', - Microsoft = 'microsoft', - Notion = 'notion', - Oidc = 'oidc', - Okta = 'okta', - Paypal = 'paypal', - PaypalSandbox = 'paypalSandbox', - Podio = 'podio', - Salesforce = 'salesforce', - Slack = 'slack', - Spotify = 'spotify', - Stripe = 'stripe', - Tradeshift = 'tradeshift', - TradeshiftBox = 'tradeshiftBox', - Twitch = 'twitch', - Wordpress = 'wordpress', - X = 'x', - Yahoo = 'yahoo', - Yammer = 'yammer', - Yandex = 'yandex', - Zoho = 'zoho', - Zoom = 'zoom', - Mock = 'mock', - Mockunverified = 'mock-unverified', - GithubImagine = 'githubImagine', - GoogleImagine = 'googleImagine', -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 841b14e2..8587b02e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,13 +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 { ProviderId } from './enums/provider-id'; -export { PolicyId } from './enums/policy-id'; +export { AuthMethod } from './enums/auth-method'; +export { ProjectPolicyId } from './enums/project-policy-id'; export { ProtocolId } from './enums/protocol-id'; export { ServiceId } from './enums/service-id'; export { Secure } from './enums/secure'; 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 981052f2..642233ff 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2,10 +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 { ProviderId } from '../enums/provider-id'; -import { PolicyId } from '../enums/policy-id'; +import { OAuthProvider } from '../enums/o-auth-provider'; +import { ProjectPolicyId } from '../enums/project-policy-id'; import { ProtocolId } from '../enums/protocol-id'; import { ServiceId } from '../enums/service-id'; import { Secure } from '../enums/secure'; @@ -47,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 }; } @@ -1079,30 +1079,30 @@ export class Project { /** * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {ProviderId} params.providerId - 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: { providerId: ProviderId }): 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 {ProviderId} providerId - 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(providerId: ProviderId): Promise; + getOAuth2Provider(providerId: OAuthProvider): Promise; getOAuth2Provider( - paramsOrFirst: { providerId: ProviderId } | ProviderId + paramsOrFirst: { providerId: OAuthProvider } | OAuthProvider ): Promise { - let params: { providerId: ProviderId }; + let params: { providerId: OAuthProvider }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: ProviderId }; + params = (paramsOrFirst || {}) as { providerId: OAuthProvider }; } else { params = { - providerId: paramsOrFirst as ProviderId + providerId: paramsOrFirst as OAuthProvider }; } @@ -5543,30 +5543,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 {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. * @throws {AppwriteException} * @returns {Promise} */ - getPolicy(params: { policyId: PolicyId }): Promise; + getPolicy(params: { policyId: ProjectPolicyId }): Promise; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {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 {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: PolicyId): Promise; + getPolicy(policyId: ProjectPolicyId): Promise; getPolicy( - paramsOrFirst: { policyId: PolicyId } | PolicyId + paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId ): Promise { - let params: { policyId: PolicyId }; + let params: { policyId: ProjectPolicyId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: PolicyId }; + params = (paramsOrFirst || {}) as { policyId: ProjectPolicyId }; } else { params = { - policyId: paramsOrFirst as PolicyId + policyId: paramsOrFirst as ProjectPolicyId }; } From 06b709dd4a584c6502d70849ad06703a3b7f86fd Mon Sep 17 00:00:00 2001 From: root Date: Thu, 7 May 2026 11:46:30 +0000 Subject: [PATCH 03/15] chore: update Console SDK to 12.2.0 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83406b74..4341de8f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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) -**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** +**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) From 4313b0e8a50d61843e7e1700652f06cc2431f869 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 7 May 2026 11:49:34 +0000 Subject: [PATCH 04/15] chore: update Console SDK to 12.2.0 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4341de8f..83406b74 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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) -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) From 34da6f311f56a87280eeae0317a99a7ca911db3d Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 7 May 2026 18:49:57 +0530 Subject: [PATCH 05/15] chore: refresh sdk for latest spec (sanitized oauth examples) --- CHANGELOG.md | 6 ------ README.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/client.ts | 2 +- src/services/project.ts | 12 ++++++------ 6 files changed, 11 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01e735ac..6c0f0a1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,5 @@ # 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 83406b74..166a2a20 100644 --- a/README.md +++ b/README.md @@ -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/package-lock.json b/package-lock.json index d260ac4e..c78c3218 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@appwrite.io/console", - "version": "12.2.0", + "version": "12.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@appwrite.io/console", - "version": "12.2.0", + "version": "12.1.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index 6ff1b316..17dec575 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.2.0", + "version": "12.1.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 77a14b78..88f7f842 100644 --- a/src/client.ts +++ b/src/client.ts @@ -390,7 +390,7 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '12.2.0', + 'x-sdk-version': '12.1.0', 'X-Appwrite-Response-Format': '1.9.4', }; diff --git a/src/services/project.ts b/src/services/project.ts index 642233ff..52444227 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2381,8 +2381,8 @@ 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.clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2391,8 +2391,8 @@ 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} clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2597,7 +2597,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: your-linkedin-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2607,7 +2607,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: your-linkedin-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} From dcfff2a2aae16c35fac395da82b7bf6891e4d64d Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 7 May 2026 18:57:40 +0530 Subject: [PATCH 06/15] chore: refresh sdk for latest spec (sanitized oauth examples) --- CHANGELOG.md | 6 ++++++ README.md | 2 +- docs/examples/project/get-policy.md | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- src/client.ts | 2 +- ...{project-policy-id.ts => project-policy.ts} | 2 +- src/index.ts | 2 +- src/services/project.ts | 18 +++++++++--------- 9 files changed, 24 insertions(+), 18 deletions(-) rename src/enums/{project-policy-id.ts => project-policy.ts} (92%) 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 166a2a20..83406b74 100644 --- a/README.md +++ b/README.md @@ -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/project/get-policy.md b/docs/examples/project/get-policy.md index be06807f..45fec071 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Project, ProjectPolicyId } 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: ProjectPolicyId.PasswordDictionary + policyId: ProjectPolicy.PasswordDictionary }); 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 88f7f842..77a14b78 100644 --- a/src/client.ts +++ b/src/client.ts @@ -390,7 +390,7 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '12.1.0', + 'x-sdk-version': '12.2.0', 'X-Appwrite-Response-Format': '1.9.4', }; diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy.ts similarity index 92% rename from src/enums/project-policy-id.ts rename to src/enums/project-policy.ts index 2031ce9b..d52bf99a 100644 --- a/src/enums/project-policy-id.ts +++ b/src/enums/project-policy.ts @@ -1,4 +1,4 @@ -export enum ProjectPolicyId { +export enum ProjectPolicy { Passworddictionary = 'password-dictionary', Passwordhistory = 'password-history', Passwordpersonaldata = 'password-personal-data', diff --git a/src/index.ts b/src/index.ts index 8587b02e..3bf3bc1b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,7 +85,7 @@ export { NHostMigrationResource } from './enums/n-host-migration-resource'; export { SupabaseMigrationResource } from './enums/supabase-migration-resource'; export { Addon } from './enums/addon'; export { AuthMethod } from './enums/auth-method'; -export { ProjectPolicyId } from './enums/project-policy-id'; +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/services/project.ts b/src/services/project.ts index 52444227..6e84a280 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -5,7 +5,7 @@ import type { Models } from '../models'; import { AuthMethod } from '../enums/auth-method'; import { Scopes } from '../enums/scopes'; import { OAuthProvider } from '../enums/o-auth-provider'; -import { ProjectPolicyId } from '../enums/project-policy-id'; +import { ProjectPolicy } from '../enums/project-policy'; import { ProtocolId } from '../enums/protocol-id'; import { ServiceId } from '../enums/service-id'; import { Secure } from '../enums/secure'; @@ -5543,30 +5543,30 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-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: ProjectPolicyId }): 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 {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @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: ProjectPolicyId): Promise; + getPolicy(policyId: ProjectPolicy): Promise; getPolicy( - paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId + paramsOrFirst: { policyId: ProjectPolicy } | ProjectPolicy ): Promise { - let params: { policyId: ProjectPolicyId }; + let params: { policyId: ProjectPolicy }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: ProjectPolicyId }; + params = (paramsOrFirst || {}) as { policyId: ProjectPolicy }; } else { params = { - policyId: paramsOrFirst as ProjectPolicyId + policyId: paramsOrFirst as ProjectPolicy }; } From b4d2c4e965adfe441c0ba383b856cfbd7b7d2399 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 10:38:08 +0000 Subject: [PATCH 07/15] chore: update Console SDK to 12.3.0 --- README.md | 4 +- .../console/create-program-membership.md | 4 +- docs/examples/console/create-source.md | 4 +- docs/examples/console/get-campaign.md | 4 +- docs/examples/console/get-coupon.md | 4 +- docs/examples/console/get-plan.md | 4 +- docs/examples/console/get-plans.md | 4 +- docs/examples/console/get-program.md | 4 +- docs/examples/console/get-resource.md | 4 +- .../console/list-o-auth-2-providers.md | 4 +- docs/examples/console/list-project-scopes.md | 4 +- docs/examples/console/list-regions.md | 4 +- docs/examples/console/suggest-columns.md | 4 +- docs/examples/console/suggest-indexes.md | 4 +- docs/examples/console/suggest-queries.md | 4 +- docs/examples/console/variables.md | 4 +- .../migrations/create-appwrite-migration.md | 5 +- docs/examples/migrations/create-csv-import.md | 5 +- .../examples/migrations/create-json-import.md | 5 +- docs/examples/presences/delete.md | 15 + docs/examples/presences/get-usage.md | 15 + docs/examples/presences/get.md | 15 + docs/examples/presences/list.md | 17 + docs/examples/presences/update-presence.md | 21 + docs/examples/presences/upsert.md | 20 + .../examples/project/get-o-auth-2-provider.md | 4 +- docs/examples/project/get-policy.md | 4 +- docs/examples/project/update-auth-method.md | 4 +- package-lock.json | 4 +- package.json | 2 +- src/client.ts | 4 +- src/enums/{auth-method.ts => method-id.ts} | 2 +- src/enums/o-auth-provider.ts | 2 - src/enums/on-duplicate.ts | 5 - src/enums/{project-policy.ts => policy-id.ts} | 2 +- src/enums/provider-id.ts | 49 ++ src/enums/query-suggestion-resource.ts | 1 + src/enums/range.ts | 5 + src/enums/scopes.ts | 2 + src/index.ts | 8 +- src/models.ts | 85 +++- src/services/migrations.ts | 66 +-- src/services/presences.ts | 425 ++++++++++++++++++ src/services/project.ts | 66 +-- 44 files changed, 781 insertions(+), 141 deletions(-) create mode 100644 docs/examples/presences/delete.md create mode 100644 docs/examples/presences/get-usage.md create mode 100644 docs/examples/presences/get.md create mode 100644 docs/examples/presences/list.md create mode 100644 docs/examples/presences/update-presence.md create mode 100644 docs/examples/presences/upsert.md rename src/enums/{auth-method.ts => method-id.ts} (88%) delete mode 100644 src/enums/on-duplicate.ts rename src/enums/{project-policy.ts => policy-id.ts} (93%) create mode 100644 src/enums/provider-id.ts create mode 100644 src/enums/range.ts create mode 100644 src/services/presences.ts diff --git a/README.md b/README.md index 83406b74..22425678 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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) -**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** +**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) @@ -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/migrations/create-appwrite-migration.md b/docs/examples/migrations/create-appwrite-migration.md index 9729806f..d0f61541 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, OnDuplicate } from "@appwrite.io/console"; +import { Client, Migrations, AppwriteMigrationResource } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -11,8 +11,7 @@ const result = await migrations.createAppwriteMigration({ resources: [AppwriteMigrationResource.User], endpoint: 'https://example.com', projectId: '', - apiKey: '', - onDuplicate: OnDuplicate.Fail // optional + apiKey: '' }); console.log(result); diff --git a/docs/examples/migrations/create-csv-import.md b/docs/examples/migrations/create-csv-import.md index d24792b6..f39b1030 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, OnDuplicate } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -11,8 +11,7 @@ const result = await migrations.createCSVImport({ bucketId: '', fileId: '', resourceId: '', - internalFile: false, // optional - onDuplicate: OnDuplicate.Fail // optional + internalFile: false // optional }); console.log(result); diff --git a/docs/examples/migrations/create-json-import.md b/docs/examples/migrations/create-json-import.md index f55fc8ff..d0631117 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, OnDuplicate } from "@appwrite.io/console"; +import { Client, Migrations } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -11,8 +11,7 @@ const result = await migrations.createJSONImport({ bucketId: '', fileId: '', resourceId: '', - internalFile: false, // optional - onDuplicate: OnDuplicate.Fail // optional + internalFile: false // optional }); console.log(result); diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 00000000..7773d3a2 --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Presences } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const presences = new Presences(client); + +const result = await presences.delete({ + presenceId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/presences/get-usage.md b/docs/examples/presences/get-usage.md new file mode 100644 index 00000000..e88a5dbe --- /dev/null +++ b/docs/examples/presences/get-usage.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Presences, Range } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const presences = new Presences(client); + +const result = await presences.getUsage({ + range: Range.24h // optional +}); + +console.log(result); +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 00000000..c2d4ca0d --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Presences } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const presences = new Presences(client); + +const result = await presences.get({ + presenceId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 00000000..5cd70b44 --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Presences } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const presences = new Presences(client); + +const result = await presences.list({ + queries: [], // optional + total: false, // optional + ttl: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 00000000..f735ef39 --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Presences, Permission, Role } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const presences = new Presences(client); + +const result = await presences.updatePresence({ + presenceId: '', + userId: '', + status: '', // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {}, // optional + permissions: [Permission.read(Role.any())], // optional + purge: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 00000000..fa7d6cba --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Presences, Permission, Role } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const presences = new Presences(client); + +const result = await presences.upsert({ + presenceId: '', + userId: '', + status: '', + permissions: [Permission.read(Role.any())], // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {} // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index cb07b451..d3e2e984 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, OAuthProvider } from "@appwrite.io/console"; +import { Client, Project, ProviderId } 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({ - providerId: OAuthProvider.Amazon + providerId: ProviderId.Amazon }); console.log(result); diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index 45fec071..be9b5151 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -1,5 +1,5 @@ ```javascript -import { Client, Project, ProjectPolicy } from "@appwrite.io/console"; +import { Client, Project, PolicyId } 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: ProjectPolicy.PasswordDictionary + policyId: PolicyId.PasswordDictionary }); console.log(result); diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md index fc0dfdfd..802d1d2b 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, AuthMethod } from "@appwrite.io/console"; +import { Client, Project, MethodId } 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: AuthMethod.EmailPassword, + methodId: MethodId.EmailPassword, enabled: false }); diff --git a/package-lock.json b/package-lock.json index d260ac4e..858a05e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@appwrite.io/console", - "version": "12.2.0", + "version": "12.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@appwrite.io/console", - "version": "12.2.0", + "version": "12.3.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index 6ff1b316..f81550df 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.2.0", + "version": "12.3.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 77a14b78..365535d1 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,7 +392,7 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '12.2.0', + 'x-sdk-version': '12.3.0', 'X-Appwrite-Response-Format': '1.9.4', }; diff --git a/src/enums/auth-method.ts b/src/enums/method-id.ts similarity index 88% rename from src/enums/auth-method.ts rename to src/enums/method-id.ts index d5800ad9..062d0d0e 100644 --- a/src/enums/auth-method.ts +++ b/src/enums/method-id.ts @@ -1,4 +1,4 @@ -export enum AuthMethod { +export enum MethodId { Emailpassword = 'email-password', Magicurl = 'magic-url', Emailotp = 'email-otp', diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index 06189633..cc9e340b 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -42,6 +42,4 @@ export enum OAuthProvider { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', - GithubImagine = 'githubImagine', - GoogleImagine = 'googleImagine', } \ No newline at end of file diff --git a/src/enums/on-duplicate.ts b/src/enums/on-duplicate.ts deleted file mode 100644 index 9ab3dc85..00000000 --- a/src/enums/on-duplicate.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum OnDuplicate { - Fail = 'fail', - Skip = 'skip', - Overwrite = 'overwrite', -} \ No newline at end of file diff --git a/src/enums/project-policy.ts b/src/enums/policy-id.ts similarity index 93% rename from src/enums/project-policy.ts rename to src/enums/policy-id.ts index d52bf99a..ab1c4cd2 100644 --- a/src/enums/project-policy.ts +++ b/src/enums/policy-id.ts @@ -1,4 +1,4 @@ -export enum ProjectPolicy { +export enum PolicyId { Passworddictionary = 'password-dictionary', Passwordhistory = 'password-history', Passwordpersonaldata = 'password-personal-data', diff --git a/src/enums/provider-id.ts b/src/enums/provider-id.ts new file mode 100644 index 00000000..943d7334 --- /dev/null +++ b/src/enums/provider-id.ts @@ -0,0 +1,49 @@ +export enum ProviderId { + Amazon = 'amazon', + Apple = 'apple', + Auth0 = 'auth0', + Authentik = 'authentik', + Autodesk = 'autodesk', + Bitbucket = 'bitbucket', + Bitly = 'bitly', + Box = 'box', + Dailymotion = 'dailymotion', + Discord = 'discord', + Disqus = 'disqus', + Dropbox = 'dropbox', + Etsy = 'etsy', + Facebook = 'facebook', + Figma = 'figma', + Fusionauth = 'fusionauth', + Github = 'github', + Gitlab = 'gitlab', + Google = 'google', + Keycloak = 'keycloak', + Kick = 'kick', + Linkedin = 'linkedin', + Microsoft = 'microsoft', + Notion = 'notion', + Oidc = 'oidc', + Okta = 'okta', + Paypal = 'paypal', + PaypalSandbox = 'paypalSandbox', + Podio = 'podio', + Salesforce = 'salesforce', + Slack = 'slack', + Spotify = 'spotify', + Stripe = 'stripe', + Tradeshift = 'tradeshift', + TradeshiftBox = 'tradeshiftBox', + Twitch = 'twitch', + Wordpress = 'wordpress', + X = 'x', + Yahoo = 'yahoo', + Yammer = 'yammer', + Yandex = 'yandex', + Zoho = 'zoho', + Zoom = 'zoom', + Mock = 'mock', + Mockunverified = 'mock-unverified', + GithubImagine = 'githubImagine', + GoogleImagine = 'googleImagine', +} \ No newline at end of file diff --git a/src/enums/query-suggestion-resource.ts b/src/enums/query-suggestion-resource.ts index 5663198a..a0deb726 100644 --- a/src/enums/query-suggestion-resource.ts +++ b/src/enums/query-suggestion-resource.ts @@ -70,5 +70,6 @@ export enum QuerySuggestionResource { ResourceTokens = 'resourcetokens', Transactions = 'transactions', TransactionLogs = 'transactionlogs', + Stats = 'presencelogs', Stats = 'stats', } \ No newline at end of file diff --git a/src/enums/range.ts b/src/enums/range.ts new file mode 100644 index 00000000..d929603f --- /dev/null +++ b/src/enums/range.ts @@ -0,0 +1,5 @@ +export enum Range { + 24h = '24h', + 30d = '30d', + 90d = '90d', +} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 532eb75c..c383ef9b 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -78,6 +78,8 @@ export enum Scopes { SchedulesWrite = 'schedules.write', VcsRead = 'vcs.read', VcsWrite = 'vcs.write', + PresencesRead = 'presences.read', + PresencesWrite = 'presences.write', BackupsPoliciesRead = 'backups.policies.read', BackupsPoliciesWrite = 'backups.policies.write', ArchivesRead = 'archives.read', diff --git a/src/index.ts b/src/index.ts index 3bf3bc1b..8f53910f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,7 @@ export { Manager } from './services/manager'; export { Messaging } from './services/messaging'; export { Migrations } from './services/migrations'; export { Organizations } from './services/organizations'; +export { Presences } from './services/presences'; export { Project } from './services/project'; export { Projects } from './services/projects'; export { Proxy } from './services/proxy'; @@ -79,13 +80,14 @@ 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 { AuthMethod } from './enums/auth-method'; -export { ProjectPolicy } from './enums/project-policy'; +export { Range } from './enums/range'; +export { MethodId } from './enums/method-id'; +export { ProviderId } from './enums/provider-id'; +export { PolicyId } from './enums/policy-id'; 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 d59cb2ab..9535be89 100644 --- a/src/models.ts +++ b/src/models.ts @@ -52,6 +52,20 @@ export namespace Models { documents: Document[]; } + /** + * Presences List + */ + export type PresenceList = { + /** + * Total number of presences that matched your query. + */ + total: number; + /** + * List of presences. + */ + presences: Presence[]; + } + /** * Tables List */ @@ -3182,6 +3196,57 @@ export namespace Models { [__default]: true; }; + /** + * Presence + */ + export type Presence = { + /** + * Presence ID. + */ + $id: string; + /** + * Presence sequence ID. + */ + $sequence: string; + /** + * Presence creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Presence update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * User internal ID. + */ + userInternalId: string; + /** + * User ID. + */ + userId: string; + /** + * Presence status. + */ + status?: string; + /** + * Presence source. + */ + source: string; + /** + * Presence expiry date in ISO 8601 format. + */ + expiresAt?: string; + } + + export type DefaultPresence = Presence & { + [key: string]: any; + [__default]: true; + }; + /** * Log */ @@ -7317,6 +7382,24 @@ export namespace Models { sessions: Metric[]; } + /** + * UsagePresence + */ + export type UsagePresence = { + /** + * Time range of the usage stats. + */ + range: string; + /** + * Current total number of online users. + */ + usersOnlineTotal: number; + /** + * Aggregated number of online users per period. + */ + presences: Metric[]; + } + /** * StorageUsage */ @@ -9326,7 +9409,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/migrations.ts b/src/services/migrations.ts index 1874744f..b4b8e483 100644 --- a/src/services/migrations.ts +++ b/src/services/migrations.ts @@ -3,7 +3,6 @@ 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'; @@ -88,11 +87,10 @@ 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, onDuplicate?: OnDuplicate }): Promise; + createAppwriteMigration(params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string }): 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. * @@ -100,27 +98,25 @@ 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, onDuplicate?: OnDuplicate): Promise; + createAppwriteMigration(resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string): Promise; createAppwriteMigration( - paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate } | AppwriteMigrationResource[], - ...rest: [(string)?, (string)?, (string)?, (OnDuplicate)?] + paramsOrFirst: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string } | AppwriteMigrationResource[], + ...rest: [(string)?, (string)?, (string)?] ): Promise { - let params: { resources: AppwriteMigrationResource[], endpoint: string, projectId: string, apiKey: string, onDuplicate?: OnDuplicate }; + let params: { 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 }; + 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 }; } else { params = { resources: paramsOrFirst as AppwriteMigrationResource[], endpoint: rest[0] as string, projectId: rest[1] as string, - apiKey: rest[2] as string, - onDuplicate: rest[3] as OnDuplicate + apiKey: rest[2] as string }; } @@ -128,7 +124,6 @@ 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"'); @@ -157,9 +152,6 @@ 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 } = { @@ -381,11 +373,10 @@ 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, onDuplicate?: OnDuplicate }): Promise; + createCSVImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }): 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. * @@ -393,27 +384,25 @@ 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, onDuplicate?: OnDuplicate): Promise; + createCSVImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean): Promise; createCSVImport( - paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate } | string, - ...rest: [(string)?, (string)?, (boolean)?, (OnDuplicate)?] + paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] ): Promise { - let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; + let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, resourceId: rest[1] as string, - internalFile: rest[2] as boolean, - onDuplicate: rest[3] as OnDuplicate + internalFile: rest[2] as boolean }; } @@ -421,7 +410,6 @@ 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"'); @@ -447,9 +435,6 @@ 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 } = { @@ -692,11 +677,10 @@ 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, onDuplicate?: OnDuplicate }): Promise; + createJSONImport(params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }): 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. * @@ -705,27 +689,25 @@ 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, onDuplicate?: OnDuplicate): Promise; + createJSONImport(bucketId: string, fileId: string, resourceId: string, internalFile?: boolean): Promise; createJSONImport( - paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate } | string, - ...rest: [(string)?, (string)?, (boolean)?, (OnDuplicate)?] + paramsOrFirst: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] ): Promise { - let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; + let params: { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean, onDuplicate?: OnDuplicate }; + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, resourceId: string, internalFile?: boolean }; } else { params = { bucketId: paramsOrFirst as string, fileId: rest[0] as string, resourceId: rest[1] as string, - internalFile: rest[2] as boolean, - onDuplicate: rest[3] as OnDuplicate + internalFile: rest[2] as boolean }; } @@ -733,7 +715,6 @@ 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"'); @@ -759,9 +740,6 @@ 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/presences.ts b/src/services/presences.ts new file mode 100644 index 00000000..11645506 --- /dev/null +++ b/src/services/presences.ts @@ -0,0 +1,425 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { Range } from '../enums/range'; + +export class Presences { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List presence logs. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + */ + list(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise>; + /** + * List presence logs. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean, ttl?: number): Promise>; + list( + paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], + ...rest: [(boolean)?, (number)?] + ): Promise> { + let params: { queries?: string[], total?: boolean, ttl?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean, ttl?: number }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean, + ttl: rest[1] as number + }; + } + + const queries = params.queries; + const total = params.total; + const ttl = params.ttl; + + + const apiPath = '/presences'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get presence usage metrics and statistics, including the current total of online users and historical online user counts for the selected time range. + * + * @param {Range} params.range - Date range. + * @throws {AppwriteException} + * @returns {Promise} + */ + getUsage(params?: { range?: Range }): Promise; + /** + * Get presence usage metrics and statistics, including the current total of online users and historical online user counts for the selected time range. + * + * @param {Range} range - Date range. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getUsage(range?: Range): Promise; + getUsage( + paramsOrFirst?: { range?: Range } | Range + ): Promise { + let params: { range?: Range }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { range?: Range }; + } else { + params = { + range: paramsOrFirst as Range + }; + } + + const range = params.range; + + + const apiPath = '/presences/usage'; + const payload: Payload = {}; + if (typeof range !== 'undefined') { + payload['range'] = range; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a presence log by its unique ID. + * + * @param {string} params.presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { presenceId: string }): Promise; + /** + * Get a presence log by its unique ID. + * + * @param {string} presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(presenceId: string): Promise; + get( + paramsOrFirst: { presenceId: string } | string + ): Promise { + let params: { presenceId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string }; + } else { + params = { + presenceId: paramsOrFirst as string + }; + } + + const presenceId = params.presenceId; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create or update a presence log by its unique ID. + * + * @param {string} params.presenceId - Presence unique ID. + * @param {string} params.userId - User ID. + * @param {string} params.status - Presence status. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.expiresAt - Presence expiry datetime. + * @param {object} params.metadata - Presence metadata object. + * @throws {AppwriteException} + * @returns {Promise} + */ + upsert(params: { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise; + /** + * Create or update a presence log by its unique ID. + * + * @param {string} presenceId - Presence unique ID. + * @param {string} userId - User ID. + * @param {string} status - Presence status. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} expiresAt - Presence expiry datetime. + * @param {object} metadata - Presence metadata object. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsert(presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise; + upsert( + paramsOrFirst: { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] + ): Promise { + let params: { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + } else { + params = { + presenceId: paramsOrFirst as string, + userId: rest[0] as string, + status: rest[1] as string, + permissions: rest[2] as string[], + expiresAt: rest[3] as string, + metadata: rest[4] as object + }; + } + + const presenceId = params.presenceId; + const userId = params.userId; + const status = params.status; + const permissions = params.permissions; + const expiresAt = params.expiresAt; + const metadata = params.metadata; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof expiresAt !== 'undefined') { + payload['expiresAt'] = expiresAt; + } + if (typeof metadata !== 'undefined') { + payload['metadata'] = metadata; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a presence log by its unique ID. + * + * @param {string} params.presenceId - Presence unique ID. + * @param {string} params.userId - User ID. + * @param {string} params.status - Presence status. + * @param {string} params.expiresAt - Presence expiry datetime. + * @param {object} params.metadata - Presence metadata object. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.purge - When true, purge cached responses used by list presences endpoint. + * @throws {AppwriteException} + * @returns {Promise} + */ + updatePresence(params: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise; + /** + * Update a presence log by its unique ID. + * + * @param {string} presenceId - Presence unique ID. + * @param {string} userId - User ID. + * @param {string} status - Presence status. + * @param {string} expiresAt - Presence expiry datetime. + * @param {object} metadata - Presence metadata object. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} purge - When true, purge cached responses used by list presences endpoint. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePresence(presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise; + updatePresence( + paramsOrFirst: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (object)?, (string[])?, (boolean)?] + ): Promise { + let params: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + } else { + params = { + presenceId: paramsOrFirst as string, + userId: rest[0] as string, + status: rest[1] as string, + expiresAt: rest[2] as string, + metadata: rest[3] as object, + permissions: rest[4] as string[], + purge: rest[5] as boolean + }; + } + + const presenceId = params.presenceId; + const userId = params.userId; + const status = params.status; + const expiresAt = params.expiresAt; + const metadata = params.metadata; + const permissions = params.permissions; + const purge = params.purge; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof expiresAt !== 'undefined') { + payload['expiresAt'] = expiresAt; + } + if (typeof metadata !== 'undefined') { + payload['metadata'] = metadata; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a presence log by its unique ID. + * + * @param {string} params.presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { presenceId: string }): Promise<{}>; + /** + * Delete a presence log by its unique ID. + * + * @param {string} presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(presenceId: string): Promise<{}>; + delete( + paramsOrFirst: { presenceId: string } | string + ): Promise<{}> { + let params: { presenceId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string }; + } else { + params = { + presenceId: paramsOrFirst as string + }; + } + + const presenceId = params.presenceId; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/project.ts b/src/services/project.ts index 6e84a280..981052f2 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2,10 +2,10 @@ import { Service } from '../service'; import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { AuthMethod } from '../enums/auth-method'; +import { MethodId } from '../enums/method-id'; import { Scopes } from '../enums/scopes'; -import { OAuthProvider } from '../enums/o-auth-provider'; -import { ProjectPolicy } from '../enums/project-policy'; +import { ProviderId } from '../enums/provider-id'; +import { PolicyId } from '../enums/policy-id'; import { ProtocolId } from '../enums/protocol-id'; import { ServiceId } from '../enums/service-id'; import { Secure } from '../enums/secure'; @@ -47,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 {AuthMethod} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {MethodId} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone * @param {boolean} params.enabled - Auth method status. * @throws {AppwriteException} * @returns {Promise} */ - updateAuthMethod(params: { methodId: AuthMethod, enabled: boolean }): Promise; + updateAuthMethod(params: { methodId: MethodId, enabled: boolean }): Promise; /** * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. * - * @param {AuthMethod} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {MethodId} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone * @param {boolean} enabled - Auth method status. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - updateAuthMethod(methodId: AuthMethod, enabled: boolean): Promise; + updateAuthMethod(methodId: MethodId, enabled: boolean): Promise; updateAuthMethod( - paramsOrFirst: { methodId: AuthMethod, enabled: boolean } | AuthMethod, + paramsOrFirst: { methodId: MethodId, enabled: boolean } | MethodId, ...rest: [(boolean)?] ): Promise { - let params: { methodId: AuthMethod, enabled: boolean }; + let params: { methodId: MethodId, enabled: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { methodId: AuthMethod, enabled: boolean }; + params = (paramsOrFirst || {}) as { methodId: MethodId, enabled: boolean }; } else { params = { - methodId: paramsOrFirst as AuthMethod, + methodId: paramsOrFirst as MethodId, enabled: rest[0] as boolean }; } @@ -1079,30 +1079,30 @@ export class Project { /** * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {OAuthProvider} params.providerId - OAuth2 provider key. For example: github, google, apple. + * @param {ProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} * @returns {Promise} */ - getOAuth2Provider(params: { providerId: OAuthProvider }): Promise; + getOAuth2Provider(params: { providerId: ProviderId }): Promise; /** * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. * - * @param {OAuthProvider} providerId - OAuth2 provider key. For example: github, google, apple. + * @param {ProviderId} providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getOAuth2Provider(providerId: OAuthProvider): Promise; + getOAuth2Provider(providerId: ProviderId): Promise; getOAuth2Provider( - paramsOrFirst: { providerId: OAuthProvider } | OAuthProvider + paramsOrFirst: { providerId: ProviderId } | ProviderId ): Promise { - let params: { providerId: OAuthProvider }; + let params: { providerId: ProviderId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: OAuthProvider }; + params = (paramsOrFirst || {}) as { providerId: ProviderId }; } else { params = { - providerId: paramsOrFirst as OAuthProvider + providerId: paramsOrFirst as ProviderId }; } @@ -2381,8 +2381,8 @@ export class Project { /** * Update the project OAuth2 Google configuration. * - * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com - * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret + * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2391,8 +2391,8 @@ export class Project { /** * Update the project OAuth2 Google configuration. * - * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com - * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret + * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2597,7 +2597,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: your-linkedin-client-secret + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2607,7 +2607,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: your-linkedin-client-secret + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -5543,30 +5543,30 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicy} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {PolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. * @throws {AppwriteException} * @returns {Promise} */ - getPolicy(params: { policyId: ProjectPolicy }): Promise; + getPolicy(params: { policyId: PolicyId }): Promise; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicy} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {PolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: ProjectPolicy): Promise; + getPolicy(policyId: PolicyId): Promise; getPolicy( - paramsOrFirst: { policyId: ProjectPolicy } | ProjectPolicy + paramsOrFirst: { policyId: PolicyId } | PolicyId ): Promise { - let params: { policyId: ProjectPolicy }; + let params: { policyId: PolicyId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: ProjectPolicy }; + params = (paramsOrFirst || {}) as { policyId: PolicyId }; } else { params = { - policyId: paramsOrFirst as ProjectPolicy + policyId: paramsOrFirst as PolicyId }; } From d243ecbeadf58ff179376fee9389b06e82e0321d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 10:42:11 +0000 Subject: [PATCH 08/15] chore: update Console SDK to 12.3.0 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 22425678..f7f67c5e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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) -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) From 5e3505e2863ea407266df13d8e7e92fdc5bdfacd Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 10:49:01 +0000 Subject: [PATCH 09/15] chore: update Console SDK to 12.2.0 --- README.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/client.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f7f67c5e..83406b74 100644 --- a/README.md +++ b/README.md @@ -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/package-lock.json b/package-lock.json index 858a05e3..d260ac4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@appwrite.io/console", - "version": "12.3.0", + "version": "12.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@appwrite.io/console", - "version": "12.3.0", + "version": "12.2.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index f81550df..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.3.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 365535d1..fcd273d1 100644 --- a/src/client.ts +++ b/src/client.ts @@ -392,7 +392,7 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '12.3.0', + 'x-sdk-version': '12.2.0', 'X-Appwrite-Response-Format': '1.9.4', }; From e2d9f4ebaa7a524e35941dd4c8e72a889e4c1992 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 11:04:35 +0000 Subject: [PATCH 10/15] chore: remove presences API artifacts --- src/services/project.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/project.ts b/src/services/project.ts index 981052f2..ae208ce3 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2381,8 +2381,8 @@ 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.clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2391,8 +2391,8 @@ 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} clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2597,7 +2597,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: your-linkedin-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2607,7 +2607,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: your-linkedin-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} From 29c99828a36900a9940a5d14a4b8371e50fae339 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 11:13:07 +0000 Subject: [PATCH 11/15] chore: update Console SDK to 12.2.0 --- docs/examples/presences/delete.md | 15 - docs/examples/presences/get-usage.md | 15 - docs/examples/presences/get.md | 15 - docs/examples/presences/list.md | 17 - docs/examples/presences/update-presence.md | 21 - docs/examples/presences/upsert.md | 20 - src/enums/range.ts | 5 - src/index.ts | 2 - src/models.ts | 83 ---- src/services/presences.ts | 425 --------------------- src/services/project.ts | 12 +- 11 files changed, 6 insertions(+), 624 deletions(-) delete mode 100644 docs/examples/presences/delete.md delete mode 100644 docs/examples/presences/get-usage.md delete mode 100644 docs/examples/presences/get.md delete mode 100644 docs/examples/presences/list.md delete mode 100644 docs/examples/presences/update-presence.md delete mode 100644 docs/examples/presences/upsert.md delete mode 100644 src/enums/range.ts delete mode 100644 src/services/presences.ts diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md deleted file mode 100644 index 7773d3a2..00000000 --- a/docs/examples/presences/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Presences } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const presences = new Presences(client); - -const result = await presences.delete({ - presenceId: '' -}); - -console.log(result); -``` diff --git a/docs/examples/presences/get-usage.md b/docs/examples/presences/get-usage.md deleted file mode 100644 index e88a5dbe..00000000 --- a/docs/examples/presences/get-usage.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Presences, Range } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const presences = new Presences(client); - -const result = await presences.getUsage({ - range: Range.24h // optional -}); - -console.log(result); -``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md deleted file mode 100644 index c2d4ca0d..00000000 --- a/docs/examples/presences/get.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Presences } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const presences = new Presences(client); - -const result = await presences.get({ - presenceId: '' -}); - -console.log(result); -``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md deleted file mode 100644 index 5cd70b44..00000000 --- a/docs/examples/presences/list.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Presences } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const presences = new Presences(client); - -const result = await presences.list({ - queries: [], // optional - total: false, // optional - ttl: 0 // optional -}); - -console.log(result); -``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md deleted file mode 100644 index f735ef39..00000000 --- a/docs/examples/presences/update-presence.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Presences, Permission, Role } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const presences = new Presences(client); - -const result = await presences.updatePresence({ - presenceId: '', - userId: '', - status: '', // optional - expiresAt: '2020-10-15T06:38:00.000+00:00', // optional - metadata: {}, // optional - permissions: [Permission.read(Role.any())], // optional - purge: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md deleted file mode 100644 index fa7d6cba..00000000 --- a/docs/examples/presences/upsert.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Presences, Permission, Role } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const presences = new Presences(client); - -const result = await presences.upsert({ - presenceId: '', - userId: '', - status: '', - permissions: [Permission.read(Role.any())], // optional - expiresAt: '2020-10-15T06:38:00.000+00:00', // optional - metadata: {} // optional -}); - -console.log(result); -``` diff --git a/src/enums/range.ts b/src/enums/range.ts deleted file mode 100644 index d929603f..00000000 --- a/src/enums/range.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum Range { - 24h = '24h', - 30d = '30d', - 90d = '90d', -} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 8f53910f..841b14e2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,6 @@ export { Manager } from './services/manager'; export { Messaging } from './services/messaging'; export { Migrations } from './services/migrations'; export { Organizations } from './services/organizations'; -export { Presences } from './services/presences'; export { Project } from './services/project'; export { Projects } from './services/projects'; export { Proxy } from './services/proxy'; @@ -84,7 +83,6 @@ 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 { Range } from './enums/range'; export { MethodId } from './enums/method-id'; export { ProviderId } from './enums/provider-id'; export { PolicyId } from './enums/policy-id'; diff --git a/src/models.ts b/src/models.ts index 9535be89..8164b782 100644 --- a/src/models.ts +++ b/src/models.ts @@ -52,20 +52,6 @@ export namespace Models { documents: Document[]; } - /** - * Presences List - */ - export type PresenceList = { - /** - * Total number of presences that matched your query. - */ - total: number; - /** - * List of presences. - */ - presences: Presence[]; - } - /** * Tables List */ @@ -3196,57 +3182,6 @@ export namespace Models { [__default]: true; }; - /** - * Presence - */ - export type Presence = { - /** - * Presence ID. - */ - $id: string; - /** - * Presence sequence ID. - */ - $sequence: string; - /** - * Presence creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Presence update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * User internal ID. - */ - userInternalId: string; - /** - * User ID. - */ - userId: string; - /** - * Presence status. - */ - status?: string; - /** - * Presence source. - */ - source: string; - /** - * Presence expiry date in ISO 8601 format. - */ - expiresAt?: string; - } - - export type DefaultPresence = Presence & { - [key: string]: any; - [__default]: true; - }; - /** * Log */ @@ -7382,24 +7317,6 @@ export namespace Models { sessions: Metric[]; } - /** - * UsagePresence - */ - export type UsagePresence = { - /** - * Time range of the usage stats. - */ - range: string; - /** - * Current total number of online users. - */ - usersOnlineTotal: number; - /** - * Aggregated number of online users per period. - */ - presences: Metric[]; - } - /** * StorageUsage */ diff --git a/src/services/presences.ts b/src/services/presences.ts deleted file mode 100644 index 11645506..00000000 --- a/src/services/presences.ts +++ /dev/null @@ -1,425 +0,0 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - -import { Range } from '../enums/range'; - -export class Presences { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List presence logs. - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise>} - */ - list(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise>; - /** - * List presence logs. - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], total?: boolean, ttl?: number): Promise>; - list( - paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], - ...rest: [(boolean)?, (number)?] - ): Promise> { - let params: { queries?: string[], total?: boolean, ttl?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean, ttl?: number }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean, - ttl: rest[1] as number - }; - } - - const queries = params.queries; - const total = params.total; - const ttl = params.ttl; - - - const apiPath = '/presences'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get presence usage metrics and statistics, including the current total of online users and historical online user counts for the selected time range. - * - * @param {Range} params.range - Date range. - * @throws {AppwriteException} - * @returns {Promise} - */ - getUsage(params?: { range?: Range }): Promise; - /** - * Get presence usage metrics and statistics, including the current total of online users and historical online user counts for the selected time range. - * - * @param {Range} range - Date range. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getUsage(range?: Range): Promise; - getUsage( - paramsOrFirst?: { range?: Range } | Range - ): Promise { - let params: { range?: Range }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { range?: Range }; - } else { - params = { - range: paramsOrFirst as Range - }; - } - - const range = params.range; - - - const apiPath = '/presences/usage'; - const payload: Payload = {}; - if (typeof range !== 'undefined') { - payload['range'] = range; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a presence log by its unique ID. - * - * @param {string} params.presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - get(params: { presenceId: string }): Promise; - /** - * Get a presence log by its unique ID. - * - * @param {string} presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(presenceId: string): Promise; - get( - paramsOrFirst: { presenceId: string } | string - ): Promise { - let params: { presenceId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string }; - } else { - params = { - presenceId: paramsOrFirst as string - }; - } - - const presenceId = params.presenceId; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create or update a presence log by its unique ID. - * - * @param {string} params.presenceId - Presence unique ID. - * @param {string} params.userId - User ID. - * @param {string} params.status - Presence status. - * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.expiresAt - Presence expiry datetime. - * @param {object} params.metadata - Presence metadata object. - * @throws {AppwriteException} - * @returns {Promise} - */ - upsert(params: { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise; - /** - * Create or update a presence log by its unique ID. - * - * @param {string} presenceId - Presence unique ID. - * @param {string} userId - User ID. - * @param {string} status - Presence status. - * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} expiresAt - Presence expiry datetime. - * @param {object} metadata - Presence metadata object. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - upsert(presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise; - upsert( - paramsOrFirst: { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] - ): Promise { - let params: { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, userId?: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; - } else { - params = { - presenceId: paramsOrFirst as string, - userId: rest[0] as string, - status: rest[1] as string, - permissions: rest[2] as string[], - expiresAt: rest[3] as string, - metadata: rest[4] as object - }; - } - - const presenceId = params.presenceId; - const userId = params.userId; - const status = params.status; - const permissions = params.permissions; - const expiresAt = params.expiresAt; - const metadata = params.metadata; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof expiresAt !== 'undefined') { - payload['expiresAt'] = expiresAt; - } - if (typeof metadata !== 'undefined') { - payload['metadata'] = metadata; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a presence log by its unique ID. - * - * @param {string} params.presenceId - Presence unique ID. - * @param {string} params.userId - User ID. - * @param {string} params.status - Presence status. - * @param {string} params.expiresAt - Presence expiry datetime. - * @param {object} params.metadata - Presence metadata object. - * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.purge - When true, purge cached responses used by list presences endpoint. - * @throws {AppwriteException} - * @returns {Promise} - */ - updatePresence(params: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise; - /** - * Update a presence log by its unique ID. - * - * @param {string} presenceId - Presence unique ID. - * @param {string} userId - User ID. - * @param {string} status - Presence status. - * @param {string} expiresAt - Presence expiry datetime. - * @param {object} metadata - Presence metadata object. - * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} purge - When true, purge cached responses used by list presences endpoint. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePresence(presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise; - updatePresence( - paramsOrFirst: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (object)?, (string[])?, (boolean)?] - ): Promise { - let params: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; - } else { - params = { - presenceId: paramsOrFirst as string, - userId: rest[0] as string, - status: rest[1] as string, - expiresAt: rest[2] as string, - metadata: rest[3] as object, - permissions: rest[4] as string[], - purge: rest[5] as boolean - }; - } - - const presenceId = params.presenceId; - const userId = params.userId; - const status = params.status; - const expiresAt = params.expiresAt; - const metadata = params.metadata; - const permissions = params.permissions; - const purge = params.purge; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - if (typeof expiresAt !== 'undefined') { - payload['expiresAt'] = expiresAt; - } - if (typeof metadata !== 'undefined') { - payload['metadata'] = metadata; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof purge !== 'undefined') { - payload['purge'] = purge; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a presence log by its unique ID. - * - * @param {string} params.presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { presenceId: string }): Promise<{}>; - /** - * Delete a presence log by its unique ID. - * - * @param {string} presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(presenceId: string): Promise<{}>; - delete( - paramsOrFirst: { presenceId: string } | string - ): Promise<{}> { - let params: { presenceId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string }; - } else { - params = { - presenceId: paramsOrFirst as string - }; - } - - const presenceId = params.presenceId; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } -} diff --git a/src/services/project.ts b/src/services/project.ts index ae208ce3..981052f2 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2381,8 +2381,8 @@ export class Project { /** * Update the project OAuth2 Google configuration. * - * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com - * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret + * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2391,8 +2391,8 @@ export class Project { /** * Update the project OAuth2 Google configuration. * - * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: your-google-client-id.apps.googleusercontent.com - * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-google-client-secret + * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: GOCSPX-2k8gsR0000000000000000VNahJj * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2597,7 +2597,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: your-linkedin-client-secret + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} @@ -2607,7 +2607,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: your-linkedin-client-secret + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: WPL_AP1.2Bf0000000000000./HtlYw== * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise} From 233be9e09bc5421089dcbb19cfc0daaad48d6e85 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 8 May 2026 16:49:37 +0530 Subject: [PATCH 12/15] fix: rename duplicate QuerySuggestionResource enum member --- src/enums/query-suggestion-resource.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enums/query-suggestion-resource.ts b/src/enums/query-suggestion-resource.ts index a0deb726..b8a370ab 100644 --- a/src/enums/query-suggestion-resource.ts +++ b/src/enums/query-suggestion-resource.ts @@ -70,6 +70,6 @@ export enum QuerySuggestionResource { ResourceTokens = 'resourcetokens', Transactions = 'transactions', TransactionLogs = 'transactionlogs', - Stats = 'presencelogs', + PresenceLogs = 'presencelogs', Stats = 'stats', } \ No newline at end of file From 5ea06427825537bb6745fedc094d092304e708ec Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 8 May 2026 16:50:25 +0530 Subject: [PATCH 13/15] fix: remove presencelogs query suggestion resource --- src/enums/query-suggestion-resource.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/enums/query-suggestion-resource.ts b/src/enums/query-suggestion-resource.ts index b8a370ab..5663198a 100644 --- a/src/enums/query-suggestion-resource.ts +++ b/src/enums/query-suggestion-resource.ts @@ -70,6 +70,5 @@ export enum QuerySuggestionResource { ResourceTokens = 'resourcetokens', Transactions = 'transactions', TransactionLogs = 'transactionlogs', - PresenceLogs = 'presencelogs', Stats = 'stats', } \ No newline at end of file From bd15c2618b4bfb22956ee6301ecc429dd0aec846 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 11:56:26 +0000 Subject: [PATCH 14/15] chore: update Console SDK to 12.2.0 --- README.md | 2 +- .../console/create-program-membership.md | 4 +- docs/examples/console/create-source.md | 4 +- docs/examples/console/get-campaign.md | 4 +- docs/examples/console/get-coupon.md | 4 +- docs/examples/console/get-plan.md | 4 +- docs/examples/console/get-plans.md | 4 +- docs/examples/console/get-program.md | 4 +- docs/examples/console/get-resource.md | 4 +- .../console/list-o-auth-2-providers.md | 4 +- docs/examples/console/list-project-scopes.md | 4 +- docs/examples/console/list-regions.md | 4 +- docs/examples/console/suggest-columns.md | 4 +- docs/examples/console/suggest-indexes.md | 4 +- docs/examples/console/suggest-queries.md | 4 +- docs/examples/console/variables.md | 4 +- .../migrations/create-appwrite-migration.md | 5 +- docs/examples/migrations/create-csv-import.md | 5 +- .../examples/migrations/create-json-import.md | 5 +- .../examples/project/get-o-auth-2-provider.md | 4 +- docs/examples/project/get-policy.md | 4 +- docs/examples/project/update-auth-method.md | 4 +- docs/examples/vcs/list-repository-branches.md | 4 +- src/client.ts | 2 - src/enums/{method-id.ts => auth-method.ts} | 2 +- src/enums/o-auth-provider.ts | 2 + src/enums/on-duplicate.ts | 5 + src/enums/{policy-id.ts => project-policy.ts} | 2 +- src/enums/provider-id.ts | 49 --- src/enums/scopes.ts | 2 - src/index.ts | 6 +- src/services/migrations.ts | 66 ++-- src/services/project.ts | 307 +++++++++--------- src/services/vcs.ts | 32 +- 34 files changed, 280 insertions(+), 288 deletions(-) rename src/enums/{method-id.ts => auth-method.ts} (88%) create mode 100644 src/enums/on-duplicate.ts rename src/enums/{policy-id.ts => project-policy.ts} (93%) delete mode 100644 src/enums/provider-id.ts diff --git a/README.md b/README.md index 83406b74..4341de8f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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) -**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** +**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/docs/examples/console/create-program-membership.md b/docs/examples/console/create-program-membership.md index fa19b0c8..23ed45d7 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.createProgramMembership({ +const result = await xconsole.createProgramMembership({ programId: '' }); diff --git a/docs/examples/console/create-source.md b/docs/examples/console/create-source.md index a5283da5..b6307b1d 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.createSource({ +const result = await xconsole.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 703c6e31..e9d41aeb 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.getCampaign({ +const result = await xconsole.getCampaign({ campaignId: '' }); diff --git a/docs/examples/console/get-coupon.md b/docs/examples/console/get-coupon.md index 74c7a579..716d26a5 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.getCoupon({ +const result = await xconsole.getCoupon({ couponId: '' }); diff --git a/docs/examples/console/get-plan.md b/docs/examples/console/get-plan.md index 4c860725..7171de67 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.getPlan({ +const result = await xconsole.getPlan({ planId: '' }); diff --git a/docs/examples/console/get-plans.md b/docs/examples/console/get-plans.md index 546c7286..c5d846a4 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.getPlans({ +const result = await xconsole.getPlans({ platform: Platform.Appwrite // optional }); diff --git a/docs/examples/console/get-program.md b/docs/examples/console/get-program.md index 038cf5f3..5e19bcf0 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.getProgram({ +const result = await xconsole.getProgram({ programId: '' }); diff --git a/docs/examples/console/get-resource.md b/docs/examples/console/get-resource.md index 706d96ea..699a83dd 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.getResource({ +const result = await xconsole.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 d26800b2..278d16da 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.listOAuth2Providers(); +const result = await xconsole.listOAuth2Providers(); console.log(result); ``` diff --git a/docs/examples/console/list-project-scopes.md b/docs/examples/console/list-project-scopes.md index b1cb8034..f59300a3 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.listProjectScopes(); +const result = await xconsole.listProjectScopes(); console.log(result); ``` diff --git a/docs/examples/console/list-regions.md b/docs/examples/console/list-regions.md index 5d49fee7..ef750a85 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.listRegions(); +const result = await xconsole.listRegions(); console.log(result); ``` diff --git a/docs/examples/console/suggest-columns.md b/docs/examples/console/suggest-columns.md index 32daa104..50e866ed 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.suggestColumns({ +const result = await xconsole.suggestColumns({ databaseId: '', tableId: '', context: '', // optional diff --git a/docs/examples/console/suggest-indexes.md b/docs/examples/console/suggest-indexes.md index e59e3377..3014fc3d 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.suggestIndexes({ +const result = await xconsole.suggestIndexes({ databaseId: '', tableId: '', min: 1, // optional diff --git a/docs/examples/console/suggest-queries.md b/docs/examples/console/suggest-queries.md index 7e00cea7..cbffccc2 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.suggestQueries({ +const result = await xconsole.suggestQueries({ resource: QuerySuggestionResource.Activities, input: '', databaseId: '', // optional diff --git a/docs/examples/console/variables.md b/docs/examples/console/variables.md index d8c4077d..3eafec11 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 console = new Console(client); +const xconsole = new Console(client); -const result = await console.variables(); +const result = await xconsole.variables(); console.log(result); ``` 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/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index d3e2e984..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, ProviderId } 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({ - providerId: ProviderId.Amazon + 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/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/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/src/client.ts b/src/client.ts index fcd273d1..77a14b78 100644 --- a/src/client.ts +++ b/src/client.ts @@ -366,7 +366,6 @@ class Client { impersonateuserphone: string; platform: string; selfSigned: boolean; - session?: string; } = { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', @@ -383,7 +382,6 @@ class Client { impersonateuserphone: '', platform: '', selfSigned: false, - session: undefined, }; /** * Custom headers for API requests. 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/provider-id.ts b/src/enums/provider-id.ts deleted file mode 100644 index 943d7334..00000000 --- a/src/enums/provider-id.ts +++ /dev/null @@ -1,49 +0,0 @@ -export enum ProviderId { - Amazon = 'amazon', - Apple = 'apple', - Auth0 = 'auth0', - Authentik = 'authentik', - Autodesk = 'autodesk', - Bitbucket = 'bitbucket', - Bitly = 'bitly', - Box = 'box', - Dailymotion = 'dailymotion', - Discord = 'discord', - Disqus = 'disqus', - Dropbox = 'dropbox', - Etsy = 'etsy', - Facebook = 'facebook', - Figma = 'figma', - Fusionauth = 'fusionauth', - Github = 'github', - Gitlab = 'gitlab', - Google = 'google', - Keycloak = 'keycloak', - Kick = 'kick', - Linkedin = 'linkedin', - Microsoft = 'microsoft', - Notion = 'notion', - Oidc = 'oidc', - Okta = 'okta', - Paypal = 'paypal', - PaypalSandbox = 'paypalSandbox', - Podio = 'podio', - Salesforce = 'salesforce', - Slack = 'slack', - Spotify = 'spotify', - Stripe = 'stripe', - Tradeshift = 'tradeshift', - TradeshiftBox = 'tradeshiftBox', - Twitch = 'twitch', - Wordpress = 'wordpress', - X = 'x', - Yahoo = 'yahoo', - Yammer = 'yammer', - Yandex = 'yandex', - Zoho = 'zoho', - Zoom = 'zoom', - Mock = 'mock', - Mockunverified = 'mock-unverified', - GithubImagine = 'githubImagine', - GoogleImagine = 'googleImagine', -} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index c383ef9b..532eb75c 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -78,8 +78,6 @@ export enum Scopes { SchedulesWrite = 'schedules.write', VcsRead = 'vcs.read', VcsWrite = 'vcs.write', - PresencesRead = 'presences.read', - PresencesWrite = 'presences.write', BackupsPoliciesRead = 'backups.policies.read', BackupsPoliciesWrite = 'backups.policies.write', ArchivesRead = 'archives.read', diff --git a/src/index.ts b/src/index.ts index 841b14e2..3bf3bc1b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -79,13 +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 { ProviderId } from './enums/provider-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/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 981052f2..5ef653a2 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -2,10 +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 { ProviderId } from '../enums/provider-id'; -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'; @@ -47,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 }; } @@ -1076,65 +1076,11 @@ 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 {ProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. - * @throws {AppwriteException} - * @returns {Promise} - */ - getOAuth2Provider(params: { providerId: ProviderId }): Promise; - /** - * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. - * - * @param {ProviderId} providerId - OAuth2 provider key. For example: github, google, apple. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getOAuth2Provider(providerId: ProviderId): Promise; - getOAuth2Provider( - paramsOrFirst: { providerId: ProviderId } | ProviderId - ): Promise { - let params: { providerId: ProviderId }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: ProviderId }; - } else { - params = { - providerId: paramsOrFirst as ProviderId - }; - } - - const providerId = params.providerId; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/project/oauth2/:provider'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - /** * Update the project OAuth2 Amazon configuration. * * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {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} @@ -1144,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} @@ -1282,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} @@ -1293,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} @@ -1356,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} @@ -1367,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} @@ -1430,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} @@ -1440,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} @@ -1497,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} @@ -1507,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} @@ -1564,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} @@ -1574,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} @@ -1631,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} @@ -1641,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} @@ -1698,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} @@ -1708,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} @@ -1765,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} @@ -1775,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} @@ -1832,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} @@ -1842,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} @@ -1899,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} @@ -1909,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} @@ -1966,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} @@ -1976,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} @@ -2033,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} @@ -2043,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} @@ -2100,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} @@ -2110,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} @@ -2167,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} @@ -2178,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} @@ -2241,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} @@ -2251,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} @@ -2308,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} @@ -2319,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} @@ -2382,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} @@ -2392,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} @@ -2449,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. @@ -2461,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. @@ -2530,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} @@ -2540,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} @@ -2597,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} @@ -2607,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} @@ -2664,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} @@ -2675,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} @@ -2738,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} @@ -2748,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} @@ -2805,7 +2751,7 @@ export class Project { * Update the project OAuth2 Oidc configuration. * * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: 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 @@ -2819,7 +2765,7 @@ export class Project { * Update the project OAuth2 Oidc configuration. * * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: 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 @@ -2900,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. @@ -2912,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. @@ -2981,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} @@ -2991,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} @@ -3048,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} @@ -3058,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} @@ -3115,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} @@ -3125,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} @@ -3182,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} @@ -3192,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} @@ -3249,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} @@ -3259,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} @@ -3316,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} @@ -3326,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} @@ -3383,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} @@ -3393,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} @@ -3450,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} @@ -3460,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} @@ -3517,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} @@ -3527,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} @@ -3584,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} @@ -3594,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} @@ -3651,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} @@ -3661,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} @@ -3718,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} @@ -3728,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} @@ -3785,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} @@ -3795,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} @@ -3852,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} @@ -3862,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} @@ -3919,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} @@ -3929,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} @@ -3986,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} @@ -3996,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} @@ -4049,6 +3995,57 @@ export class Project { ); } + /** + * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. + * + * @param {OAuthProvider} params.providerId - OAuth2 provider key. For example: github, google, apple. + * @throws {AppwriteException} + * @returns {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 {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(providerId: OAuthProvider): Promise; + getOAuth2Provider( + paramsOrFirst: { providerId: OAuthProvider } | OAuthProvider + ): Promise { + let params: { providerId: OAuthProvider }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: OAuthProvider }; + } else { + params = { + providerId: paramsOrFirst as OAuthProvider + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. * @@ -5543,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 }; } 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 } = { From fcf1831c48bb03905eab4d5b5a754deb54578c7f Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 12:32:02 +0000 Subject: [PATCH 15/15] chore: update Console SDK to 12.2.0 --- .github/workflows/publish.yml | 4 ++-- docs/examples/console/create-program-membership.md | 4 ++-- docs/examples/console/create-source.md | 4 ++-- docs/examples/console/get-campaign.md | 4 ++-- docs/examples/console/get-coupon.md | 4 ++-- docs/examples/console/get-plan.md | 4 ++-- docs/examples/console/get-plans.md | 4 ++-- docs/examples/console/get-program.md | 4 ++-- docs/examples/console/get-resource.md | 4 ++-- docs/examples/console/list-o-auth-2-providers.md | 4 ++-- docs/examples/console/list-project-scopes.md | 4 ++-- docs/examples/console/list-regions.md | 4 ++-- docs/examples/console/suggest-columns.md | 4 ++-- docs/examples/console/suggest-indexes.md | 4 ++-- docs/examples/console/suggest-queries.md | 4 ++-- docs/examples/console/variables.md | 4 ++-- docs/examples/databases/create-big-int-attribute.md | 2 +- docs/examples/databases/create-boolean-attribute.md | 2 +- docs/examples/databases/create-datetime-attribute.md | 2 +- docs/examples/databases/create-email-attribute.md | 2 +- docs/examples/databases/create-enum-attribute.md | 2 +- docs/examples/databases/create-float-attribute.md | 2 +- docs/examples/databases/create-integer-attribute.md | 2 +- docs/examples/databases/create-ip-attribute.md | 2 +- docs/examples/databases/create-line-attribute.md | 2 +- docs/examples/databases/create-longtext-attribute.md | 2 +- docs/examples/databases/create-mediumtext-attribute.md | 2 +- docs/examples/databases/create-point-attribute.md | 2 +- docs/examples/databases/create-polygon-attribute.md | 2 +- docs/examples/databases/create-string-attribute.md | 2 +- docs/examples/databases/create-text-attribute.md | 2 +- docs/examples/databases/create-url-attribute.md | 2 +- docs/examples/databases/create-varchar-attribute.md | 2 +- docs/examples/databases/update-big-int-attribute.md | 2 +- docs/examples/databases/update-boolean-attribute.md | 2 +- docs/examples/databases/update-datetime-attribute.md | 2 +- docs/examples/databases/update-email-attribute.md | 2 +- docs/examples/databases/update-enum-attribute.md | 2 +- docs/examples/databases/update-float-attribute.md | 2 +- docs/examples/databases/update-integer-attribute.md | 2 +- docs/examples/databases/update-ip-attribute.md | 2 +- docs/examples/databases/update-line-attribute.md | 2 +- docs/examples/databases/update-longtext-attribute.md | 2 +- docs/examples/databases/update-mediumtext-attribute.md | 2 +- docs/examples/databases/update-point-attribute.md | 2 +- docs/examples/databases/update-polygon-attribute.md | 2 +- docs/examples/databases/update-string-attribute.md | 2 +- docs/examples/databases/update-text-attribute.md | 2 +- docs/examples/databases/update-url-attribute.md | 2 +- docs/examples/databases/update-varchar-attribute.md | 2 +- docs/examples/functions/create-execution.md | 2 +- docs/examples/tablesdb/create-big-int-column.md | 2 +- docs/examples/tablesdb/create-boolean-column.md | 2 +- docs/examples/tablesdb/create-datetime-column.md | 2 +- docs/examples/tablesdb/create-email-column.md | 2 +- docs/examples/tablesdb/create-enum-column.md | 2 +- docs/examples/tablesdb/create-float-column.md | 2 +- docs/examples/tablesdb/create-integer-column.md | 2 +- docs/examples/tablesdb/create-ip-column.md | 2 +- docs/examples/tablesdb/create-line-column.md | 2 +- docs/examples/tablesdb/create-longtext-column.md | 2 +- docs/examples/tablesdb/create-mediumtext-column.md | 2 +- docs/examples/tablesdb/create-point-column.md | 2 +- docs/examples/tablesdb/create-polygon-column.md | 2 +- docs/examples/tablesdb/create-string-column.md | 2 +- docs/examples/tablesdb/create-text-column.md | 2 +- docs/examples/tablesdb/create-url-column.md | 2 +- docs/examples/tablesdb/create-varchar-column.md | 2 +- docs/examples/tablesdb/update-big-int-column.md | 2 +- docs/examples/tablesdb/update-boolean-column.md | 2 +- docs/examples/tablesdb/update-datetime-column.md | 2 +- docs/examples/tablesdb/update-email-column.md | 2 +- docs/examples/tablesdb/update-enum-column.md | 2 +- docs/examples/tablesdb/update-float-column.md | 2 +- docs/examples/tablesdb/update-integer-column.md | 2 +- docs/examples/tablesdb/update-ip-column.md | 2 +- docs/examples/tablesdb/update-line-column.md | 2 +- docs/examples/tablesdb/update-longtext-column.md | 2 +- docs/examples/tablesdb/update-mediumtext-column.md | 2 +- docs/examples/tablesdb/update-point-column.md | 2 +- docs/examples/tablesdb/update-polygon-column.md | 2 +- docs/examples/tablesdb/update-string-column.md | 2 +- docs/examples/tablesdb/update-text-column.md | 2 +- docs/examples/tablesdb/update-url-column.md | 2 +- docs/examples/tablesdb/update-varchar-column.md | 2 +- docs/examples/vcs/create-repository.md | 2 +- src/client.ts | 2 ++ 87 files changed, 104 insertions(+), 102 deletions(-) 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/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 index 4685cc41..f122c7c4 100644 --- a/docs/examples/databases/create-big-int-attribute.md +++ b/docs/examples/databases/create-big-int-attribute.md @@ -14,7 +14,7 @@ const result = await databases.createBigIntAttribute({ required: false, min: null, // optional max: null, // optional - default: null, // optional + xdefault: null, // optional array: false // optional }); 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 index 02e92ea6..48af1566 100644 --- a/docs/examples/databases/update-big-int-attribute.md +++ b/docs/examples/databases/update-big-int-attribute.md @@ -12,7 +12,7 @@ const result = await databases.updateBigIntAttribute({ collectionId: '', key: '', required: false, - default: null, + xdefault: null, min: null, // optional max: null, // optional newKey: '' // optional 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/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md index 3a3995db..c00adcc4 100644 --- a/docs/examples/tablesdb/create-big-int-column.md +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -14,7 +14,7 @@ const result = await tablesDB.createBigIntColumn({ required: false, min: null, // optional max: null, // optional - default: null, // optional + xdefault: null, // optional array: false // optional }); 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 index 10a6b0cc..578e813c 100644 --- a/docs/examples/tablesdb/update-big-int-column.md +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -12,7 +12,7 @@ const result = await tablesDB.updateBigIntColumn({ tableId: '', key: '', required: false, - default: null, + xdefault: null, min: null, // optional max: null, // optional newKey: '' // optional 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/src/client.ts b/src/client.ts index 77a14b78..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.