diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a781772..9e8e716 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,4 +39,4 @@ jobs: - name: Publish run: npm publish --tag ${{ steps.release_tag.outputs.tag }} env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e6898b..7d6926d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 17.2.0 + +* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service +* Fix autocompletion not working for `Document` model even when generic is passed + ## 17.1.0 * Add `upsertDocument` method @@ -28,13 +33,13 @@ ## 15.0.1 * Remove titles from all function descriptions -* Fix typing for collection "attribute" key +* Fix typing for collection "attribute" key * Remove unnecessary awaits and asyncs * Ensure `AppwriteException` response is always string ## 15.0.0 -* Fix: pong response & chunked upload +* Fix: pong response & chunked upload ## 14.2.0 @@ -65,4 +70,4 @@ * Rename `templateBranch` to `templateVersion` in `createFunction()`. * Rename `downloadDeployment()` to `getDeploymentDownload()` -> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. \ No newline at end of file +> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 44cfc3c..a2e77b9 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,9 +2,8 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setSession('') // The user session to authenticate with - .setKey('') // Your secret API key - .setJWT(''); // Your secret JSON Web Token + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with const databases = new sdk.Databases(client); diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 1b20882..d73df44 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -2,6 +2,7 @@ const sdk = require('node-appwrite'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID .setKey(''); // Your secret API key const databases = new sdk.Databases(client); diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md new file mode 100644 index 0000000..6bfc5f1 --- /dev/null +++ b/docs/examples/databases/decrement-document-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.decrementDocumentAttribute( + '', // databaseId + '', // collectionId + '', // documentId + '', // attribute + null, // value (optional) + null // min (optional) +); diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md new file mode 100644 index 0000000..0ba0245 --- /dev/null +++ b/docs/examples/databases/increment-document-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.incrementDocumentAttribute( + '', // databaseId + '', // collectionId + '', // documentId + '', // attribute + null, // value (optional) + null // max (optional) +); diff --git a/package.json b/package.json index ca074ab..ae74ea1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "17.1.0", + "version": "17.2.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 19025c7..7b74a1e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/17.1.0'; + let ua = 'AppwriteNodeJSSDK/17.2.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,7 +82,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '17.1.0', + 'x-sdk-version': '17.2.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.7.0', }; diff --git a/src/models.ts b/src/models.ts index ed9cf51..be2a8e2 100644 --- a/src/models.ts +++ b/src/models.ts @@ -2,10 +2,13 @@ * Appwrite Models */ export namespace Models { + + declare const __default: unique symbol; + /** * Documents List */ - export type DocumentList = { + export type DocumentList = { /** * Total number of documents documents that matched your query. */ @@ -15,6 +18,7 @@ export namespace Models { */ documents: Document[]; } + /** * Collections List */ @@ -28,6 +32,7 @@ export namespace Models { */ collections: Collection[]; } + /** * Databases List */ @@ -41,6 +46,7 @@ export namespace Models { */ databases: Database[]; } + /** * Indexes List */ @@ -54,10 +60,11 @@ export namespace Models { */ indexes: Index[]; } + /** * Users List */ - export type UserList = { + export type UserList = { /** * Total number of users documents that matched your query. */ @@ -67,6 +74,7 @@ export namespace Models { */ users: User[]; } + /** * Sessions List */ @@ -80,6 +88,7 @@ export namespace Models { */ sessions: Session[]; } + /** * Identities List */ @@ -93,6 +102,7 @@ export namespace Models { */ identities: Identity[]; } + /** * Logs List */ @@ -106,6 +116,7 @@ export namespace Models { */ logs: Log[]; } + /** * Files List */ @@ -119,6 +130,7 @@ export namespace Models { */ files: File[]; } + /** * Buckets List */ @@ -132,6 +144,7 @@ export namespace Models { */ buckets: Bucket[]; } + /** * Resource Tokens List */ @@ -145,10 +158,11 @@ export namespace Models { */ tokens: ResourceToken[]; } + /** * Teams List */ - export type TeamList = { + export type TeamList = { /** * Total number of teams documents that matched your query. */ @@ -158,6 +172,7 @@ export namespace Models { */ teams: Team[]; } + /** * Memberships List */ @@ -171,6 +186,7 @@ export namespace Models { */ memberships: Membership[]; } + /** * Sites List */ @@ -184,6 +200,7 @@ export namespace Models { */ sites: Site[]; } + /** * Functions List */ @@ -197,6 +214,7 @@ export namespace Models { */ functions: Function[]; } + /** * Frameworks List */ @@ -210,6 +228,7 @@ export namespace Models { */ frameworks: Framework[]; } + /** * Runtimes List */ @@ -223,6 +242,7 @@ export namespace Models { */ runtimes: Runtime[]; } + /** * Deployments List */ @@ -236,6 +256,7 @@ export namespace Models { */ deployments: Deployment[]; } + /** * Executions List */ @@ -249,6 +270,7 @@ export namespace Models { */ executions: Execution[]; } + /** * Countries List */ @@ -262,6 +284,7 @@ export namespace Models { */ countries: Country[]; } + /** * Continents List */ @@ -275,6 +298,7 @@ export namespace Models { */ continents: Continent[]; } + /** * Languages List */ @@ -288,6 +312,7 @@ export namespace Models { */ languages: Language[]; } + /** * Currencies List */ @@ -301,6 +326,7 @@ export namespace Models { */ currencies: Currency[]; } + /** * Phones List */ @@ -314,6 +340,7 @@ export namespace Models { */ phones: Phone[]; } + /** * Variables List */ @@ -327,6 +354,7 @@ export namespace Models { */ variables: Variable[]; } + /** * Locale codes list */ @@ -340,6 +368,7 @@ export namespace Models { */ localeCodes: LocaleCode[]; } + /** * Provider list */ @@ -353,6 +382,7 @@ export namespace Models { */ providers: Provider[]; } + /** * Message list */ @@ -366,6 +396,7 @@ export namespace Models { */ messages: Message[]; } + /** * Topic list */ @@ -379,6 +410,7 @@ export namespace Models { */ topics: Topic[]; } + /** * Subscriber list */ @@ -392,6 +424,7 @@ export namespace Models { */ subscribers: Subscriber[]; } + /** * Target list */ @@ -405,6 +438,7 @@ export namespace Models { */ targets: Target[]; } + /** * Specifications List */ @@ -418,6 +452,7 @@ export namespace Models { */ specifications: Specification[]; } + /** * Database */ @@ -443,6 +478,7 @@ export namespace Models { */ enabled: boolean; } + /** * Collection */ @@ -488,6 +524,7 @@ export namespace Models { */ indexes: Index[]; } + /** * Attributes List */ @@ -501,6 +538,7 @@ export namespace Models { */ attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString)[]; } + /** * AttributeString */ @@ -545,7 +583,12 @@ export namespace Models { * Default value for attribute when not provided. Cannot be set when attribute is required. */ default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; } + /** * AttributeInteger */ @@ -595,6 +638,7 @@ export namespace Models { */ default?: number; } + /** * AttributeFloat */ @@ -644,6 +688,7 @@ export namespace Models { */ default?: number; } + /** * AttributeBoolean */ @@ -685,6 +730,7 @@ export namespace Models { */ default?: boolean; } + /** * AttributeEmail */ @@ -730,6 +776,7 @@ export namespace Models { */ default?: string; } + /** * AttributeEnum */ @@ -779,6 +826,7 @@ export namespace Models { */ default?: string; } + /** * AttributeIP */ @@ -824,6 +872,7 @@ export namespace Models { */ default?: string; } + /** * AttributeURL */ @@ -869,6 +918,7 @@ export namespace Models { */ default?: string; } + /** * AttributeDatetime */ @@ -914,6 +964,7 @@ export namespace Models { */ default?: string; } + /** * AttributeRelationship */ @@ -975,6 +1026,7 @@ export namespace Models { */ side: string; } + /** * Index */ @@ -1016,6 +1068,7 @@ export namespace Models { */ $updatedAt: string; } + /** * Document */ @@ -1024,6 +1077,10 @@ export namespace Models { * Document ID. */ $id: string; + /** + * Document automatically incrementing ID. + */ + $sequence: number; /** * Collection ID. */ @@ -1044,8 +1101,19 @@ export namespace Models { * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ $permissions: string[]; - [key: string]: any; } + + export type DefaultDocument = Document & { + [key: string]: any; + [__default]: true; + }; + + export type DataWithoutDocumentKeys = { + [K in string]: any; + } & { + [K in keyof Document]?: never; + }; + /** * Log */ @@ -1135,10 +1203,11 @@ export namespace Models { */ countryName: string; } + /** * User */ - export type User = { + export type User = { /** * User ID. */ @@ -1216,6 +1285,7 @@ export namespace Models { */ accessedAt: string; } + /** * AlgoMD5 */ @@ -1225,6 +1295,7 @@ export namespace Models { */ type: string; } + /** * AlgoSHA */ @@ -1234,6 +1305,7 @@ export namespace Models { */ type: string; } + /** * AlgoPHPass */ @@ -1243,6 +1315,7 @@ export namespace Models { */ type: string; } + /** * AlgoBcrypt */ @@ -1252,6 +1325,7 @@ export namespace Models { */ type: string; } + /** * AlgoScrypt */ @@ -1277,6 +1351,7 @@ export namespace Models { */ length: number; } + /** * AlgoScryptModified */ @@ -1298,6 +1373,7 @@ export namespace Models { */ signerKey: string; } + /** * AlgoArgon2 */ @@ -1319,12 +1395,24 @@ export namespace Models { */ threads: number; } + /** * Preferences */ export type Preferences = { - [key: string]: any; } + + export type DefaultPreferences = Preferences & { + [key: string]: any; + [__default]: true; + }; + + export type DataWithoutPreferencesKeys = { + [K in string]: any; + } & { + [K in keyof Preferences]?: never; + }; + /** * Session */ @@ -1446,6 +1534,7 @@ export namespace Models { */ mfaUpdatedAt: string; } + /** * Identity */ @@ -1491,6 +1580,7 @@ export namespace Models { */ providerRefreshToken: string; } + /** * Token */ @@ -1520,6 +1610,7 @@ export namespace Models { */ phrase: string; } + /** * JWT */ @@ -1529,6 +1620,7 @@ export namespace Models { */ jwt: string; } + /** * Locale */ @@ -1562,6 +1654,7 @@ export namespace Models { */ currency: string; } + /** * LocaleCode */ @@ -1575,6 +1668,7 @@ export namespace Models { */ name: string; } + /** * File */ @@ -1624,6 +1718,7 @@ export namespace Models { */ chunksUploaded: number; } + /** * Bucket */ @@ -1677,6 +1772,7 @@ export namespace Models { */ antivirus: boolean; } + /** * ResourceToken */ @@ -1710,10 +1806,11 @@ export namespace Models { */ accessedAt: string; } + /** * Team */ - export type Team = { + export type Team = { /** * Team ID. */ @@ -1739,6 +1836,7 @@ export namespace Models { */ prefs: Preferences; } + /** * Membership */ @@ -1796,6 +1894,7 @@ export namespace Models { */ roles: string[]; } + /** * Site */ @@ -1917,6 +2016,7 @@ export namespace Models { */ fallbackFile: string; } + /** * Function */ @@ -2034,6 +2134,7 @@ export namespace Models { */ specification: string; } + /** * Runtime */ @@ -2071,6 +2172,7 @@ export namespace Models { */ supports: string[]; } + /** * Framework */ @@ -2096,6 +2198,7 @@ export namespace Models { */ adapters: FrameworkAdapter[]; } + /** * Framework Adapter */ @@ -2121,6 +2224,7 @@ export namespace Models { */ fallbackFile: string; } + /** * Deployment */ @@ -2234,6 +2338,7 @@ export namespace Models { */ providerBranchUrl: string; } + /** * Execution */ @@ -2307,6 +2412,7 @@ export namespace Models { */ scheduledAt?: string; } + /** * Variable */ @@ -2344,6 +2450,7 @@ export namespace Models { */ resourceId: string; } + /** * Country */ @@ -2357,6 +2464,7 @@ export namespace Models { */ code: string; } + /** * Continent */ @@ -2370,6 +2478,7 @@ export namespace Models { */ code: string; } + /** * Language */ @@ -2387,6 +2496,7 @@ export namespace Models { */ nativeName: string; } + /** * Currency */ @@ -2420,6 +2530,7 @@ export namespace Models { */ namePlural: string; } + /** * Phone */ @@ -2437,6 +2548,7 @@ export namespace Models { */ countryName: string; } + /** * Health Antivirus */ @@ -2450,6 +2562,7 @@ export namespace Models { */ status: string; } + /** * Health Queue */ @@ -2459,6 +2572,7 @@ export namespace Models { */ size: number; } + /** * Health Status */ @@ -2476,6 +2590,7 @@ export namespace Models { */ status: string; } + /** * Health Certificate */ @@ -2505,6 +2620,7 @@ export namespace Models { */ signatureTypeSN: string; } + /** * Health Time */ @@ -2522,6 +2638,7 @@ export namespace Models { */ diff: number; } + /** * Headers */ @@ -2535,6 +2652,7 @@ export namespace Models { */ value: string; } + /** * Specification */ @@ -2556,6 +2674,7 @@ export namespace Models { */ slug: string; } + /** * MFA Challenge */ @@ -2577,6 +2696,7 @@ export namespace Models { */ expire: string; } + /** * MFA Recovery Codes */ @@ -2586,6 +2706,7 @@ export namespace Models { */ recoveryCodes: string[]; } + /** * MFAType */ @@ -2599,6 +2720,7 @@ export namespace Models { */ uri: string; } + /** * MFAFactors */ @@ -2620,6 +2742,7 @@ export namespace Models { */ recoveryCode: boolean; } + /** * Provider */ @@ -2661,6 +2784,7 @@ export namespace Models { */ options?: object; } + /** * Message */ @@ -2718,6 +2842,7 @@ export namespace Models { */ status: string; } + /** * Topic */ @@ -2755,6 +2880,7 @@ export namespace Models { */ subscribe: string[]; } + /** * Subscriber */ @@ -2796,6 +2922,7 @@ export namespace Models { */ providerType: string; } + /** * Target */ diff --git a/src/services/account.ts b/src/services/account.ts index 7d1b34c..4bb5f6a 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -17,7 +17,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - get(): Promise> { + get(): Promise> { const apiPath = '/account'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -32,6 +32,7 @@ export class Account { payload, ); } + /** * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). * @@ -42,7 +43,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - create(userId: string, email: string, password: string, name?: string): Promise> { + create(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -79,17 +80,18 @@ export class Account { payload, ); } + /** * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. -This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. - + * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * * * @param {string} email * @param {string} password * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(email: string, password: string): Promise> { + updateEmail(email: string, password: string): Promise> { if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } @@ -117,6 +119,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get the list of identities for the currently logged in user. * @@ -142,6 +145,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Delete an identity by its unique ID. * @@ -168,6 +172,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. * @@ -190,6 +195,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. * @@ -215,6 +221,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Enable or disable MFA on an account. * @@ -222,7 +229,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updateMFA(mfa: boolean): Promise> { + updateMFA(mfa: boolean): Promise> { if (typeof mfa === 'undefined') { throw new AppwriteException('Missing required parameter: "mfa"'); } @@ -244,6 +251,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. * @@ -270,6 +278,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * @@ -278,7 +287,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updateMfaAuthenticator(type: AuthenticatorType, otp: string): Promise> { + updateMfaAuthenticator(type: AuthenticatorType, otp: string): Promise> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } @@ -303,6 +312,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Delete an authenticator for a user by ID. * @@ -329,6 +339,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * @@ -358,6 +369,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -394,6 +406,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * List the factors available on the account to be used as a MFA challange. * @@ -415,6 +428,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. * @@ -436,6 +450,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. * @@ -458,6 +473,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. * @@ -480,6 +496,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update currently logged in user account name. * @@ -487,7 +504,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updateName(name: string): Promise> { + updateName(name: string): Promise> { if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } @@ -509,6 +526,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. * @@ -517,7 +535,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(password: string, oldPassword?: string): Promise> { + updatePassword(password: string, oldPassword?: string): Promise> { if (typeof password === 'undefined') { throw new AppwriteException('Missing required parameter: "password"'); } @@ -542,6 +560,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. * @@ -550,7 +569,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(phone: string, password: string): Promise> { + updatePhone(phone: string, password: string): Promise> { if (typeof phone === 'undefined') { throw new AppwriteException('Missing required parameter: "phone"'); } @@ -578,13 +597,14 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Get the preferences as a key-value object for the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(): Promise { + getPrefs(): Promise { const apiPath = '/account/prefs'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -599,6 +619,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. * @@ -606,7 +627,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - updatePrefs(prefs: Partial): Promise> { + updatePrefs(prefs: Partial): Promise> { if (typeof prefs === 'undefined') { throw new AppwriteException('Missing required parameter: "prefs"'); } @@ -628,6 +649,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. * @@ -664,10 +686,11 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload, ); } + /** * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. - -Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + * + * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. * * @param {string} userId * @param {string} secret @@ -709,6 +732,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Get the list of active sessions across different devices for the currently logged in user. * @@ -730,6 +754,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Delete all sessions from the user account and remove any sessions cookies from the end client. * @@ -752,6 +777,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). * @@ -774,10 +800,11 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} email * @param {string} password @@ -812,6 +839,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -848,6 +876,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -884,6 +913,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. * @@ -920,6 +950,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. * @@ -945,6 +976,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. * @@ -971,6 +1003,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. * @@ -997,13 +1030,14 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead. * * @throws {AppwriteException} * @returns {Promise>} */ - updateStatus(): Promise> { + updateStatus(): Promise> { const apiPath = '/account/status'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1019,10 +1053,11 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} userId * @param {string} email @@ -1061,11 +1096,12 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * * * @param {string} userId * @param {string} email @@ -1108,12 +1144,13 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. - -If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {OAuthProvider} provider * @param {string} success @@ -1149,10 +1186,11 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload ); } + /** * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. - -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + * + * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} userId * @param {string} phone @@ -1187,11 +1225,12 @@ A user is limited to 10 active sessions at a time by default. [Learn more about payload, ); } + /** * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. - -Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - + * + * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + * * * @param {string} url * @throws {AppwriteException} @@ -1219,6 +1258,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. * @@ -1255,6 +1295,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. * @@ -1277,6 +1318,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload, ); } + /** * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. * diff --git a/src/services/avatars.ts b/src/services/avatars.ts index c977c9b..1ef7d79 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -13,8 +13,8 @@ export class Avatars { /** * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. - -When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. * * @param {Browser} code * @param {number} width @@ -51,11 +51,12 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. - -When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * * * @param {CreditCard} code * @param {number} width @@ -92,10 +93,11 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. - -This endpoint does not follow HTTP redirects. + * + * This endpoint does not follow HTTP redirects. * * @param {string} url * @throws {AppwriteException} @@ -123,11 +125,12 @@ This endpoint does not follow HTTP redirects. 'arrayBuffer' ); } + /** * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - -When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * * * @param {Flag} code * @param {number} width @@ -164,12 +167,13 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. - -When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. - -This endpoint does not follow HTTP redirects. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. + * + * This endpoint does not follow HTTP redirects. * * @param {string} url * @param {number} width @@ -205,13 +209,14 @@ This endpoint does not follow HTTP redirects. 'arrayBuffer' ); } + /** * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. - -You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. - -When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - + * + * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * * * @param {string} name * @param {number} width @@ -248,9 +253,10 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'arrayBuffer' ); } + /** * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. - + * * * @param {string} text * @param {number} size diff --git a/src/services/databases.ts b/src/services/databases.ts index 4d2f434..628239a 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -40,9 +40,10 @@ export class Databases { payload, ); } + /** * Create a new Database. - + * * * @param {string} databaseId * @param {string} name @@ -81,6 +82,7 @@ export class Databases { payload, ); } + /** * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * @@ -106,6 +108,7 @@ export class Databases { payload, ); } + /** * Update a database by its unique ID. * @@ -143,6 +146,7 @@ export class Databases { payload, ); } + /** * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. * @@ -169,6 +173,7 @@ export class Databases { payload, ); } + /** * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * @@ -202,6 +207,7 @@ export class Databases { payload, ); } + /** * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * @@ -254,6 +260,7 @@ export class Databases { payload, ); } + /** * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. * @@ -283,6 +290,7 @@ export class Databases { payload, ); } + /** * Update a collection by its unique ID. * @@ -332,6 +340,7 @@ export class Databases { payload, ); } + /** * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. * @@ -362,6 +371,7 @@ export class Databases { payload, ); } + /** * List attributes in the collection. * @@ -395,9 +405,10 @@ export class Databases { payload, ); } + /** * Create a boolean attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -448,6 +459,7 @@ export class Databases { payload, ); } + /** * Update a boolean attribute. Changing the `default` value will not update already existing documents. * @@ -500,6 +512,7 @@ export class Databases { payload, ); } + /** * Create a date time attribute according to the ISO 8601 standard. * @@ -552,6 +565,7 @@ export class Databases { payload, ); } + /** * Update a date time attribute. Changing the `default` value will not update already existing documents. * @@ -604,9 +618,10 @@ export class Databases { payload, ); } + /** * Create an email attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -657,9 +672,10 @@ export class Databases { payload, ); } + /** * Update an email attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -710,9 +726,10 @@ export class Databases { payload, ); } + /** * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -770,9 +787,10 @@ export class Databases { payload, ); } + /** * Update an enum attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -830,9 +848,10 @@ export class Databases { payload, ); } + /** * Create a float attribute. Optionally, minimum and maximum values can be provided. - + * * * @param {string} databaseId * @param {string} collectionId @@ -891,9 +910,10 @@ export class Databases { payload, ); } + /** * Update a float attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -952,9 +972,10 @@ export class Databases { payload, ); } + /** * Create an integer attribute. Optionally, minimum and maximum values can be provided. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1013,9 +1034,10 @@ export class Databases { payload, ); } + /** * Update an integer attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1074,9 +1096,10 @@ export class Databases { payload, ); } + /** * Create IP address attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1127,9 +1150,10 @@ export class Databases { payload, ); } + /** * Update an ip attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1180,9 +1204,10 @@ export class Databases { payload, ); } + /** * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - + * * * @param {string} databaseId * @param {string} collectionId @@ -1241,9 +1266,10 @@ export class Databases { payload, ); } + /** * Create a string attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1305,9 +1331,10 @@ export class Databases { payload, ); } + /** * Update a string attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1362,9 +1389,10 @@ export class Databases { payload, ); } + /** * Create a URL attribute. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1415,9 +1443,10 @@ export class Databases { payload, ); } + /** * Update an url attribute. Changing the `default` value will not update already existing documents. - + * * * @param {string} databaseId * @param {string} collectionId @@ -1468,6 +1497,7 @@ export class Databases { payload, ); } + /** * Get attribute by ID. * @@ -1501,6 +1531,7 @@ export class Databases { payload, ); } + /** * Deletes an attribute. * @@ -1535,9 +1566,10 @@ export class Databases { payload, ); } + /** * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - + * * * @param {string} databaseId * @param {string} collectionId @@ -1578,6 +1610,7 @@ export class Databases { payload, ); } + /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -1587,7 +1620,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise>} */ - listDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { + listDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1611,18 +1644,19 @@ export class Databases { payload, ); } + /** * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId * @param {string} collectionId * @param {string} documentId - * @param {Omit} data + * @param {Document extends Models.DefaultDocument ? Models.DataWithoutDocumentKeys : Omit} data * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} */ - createDocument(databaseId: string, collectionId: string, documentId: string, data: Omit, permissions?: string[]): Promise { + createDocument(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Models.DataWithoutDocumentKeys : Omit, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1659,10 +1693,11 @@ export class Databases { payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId * @param {string} collectionId @@ -1670,7 +1705,7 @@ Create new Documents. Before using this route, you should create a new collectio * @throws {AppwriteException} * @returns {Promise>} */ - createDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { + createDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1698,10 +1733,12 @@ Create new Documents. Before using this route, you should create a new collectio payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * * * @param {string} databaseId * @param {string} collectionId @@ -1709,7 +1746,7 @@ Create or update Documents. Before using this route, you should create a new col * @throws {AppwriteException} * @returns {Promise>} */ - upsertDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { + upsertDocuments(databaseId: string, collectionId: string, documents: object[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1737,10 +1774,11 @@ Create or update Documents. Before using this route, you should create a new col payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * + * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. * * @param {string} databaseId * @param {string} collectionId @@ -1749,7 +1787,7 @@ Update all documents that match your queries, if no queries are submitted then a * @throws {AppwriteException} * @returns {Promise>} */ - updateDocuments(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise> { + updateDocuments(databaseId: string, collectionId: string, data?: object, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1777,10 +1815,11 @@ Update all documents that match your queries, if no queries are submitted then a payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * + * Bulk delete documents using queries, if no queries are passed then all documents are deleted. * * @param {string} databaseId * @param {string} collectionId @@ -1788,7 +1827,7 @@ Bulk delete documents using queries, if no queries are passed then all documents * @throws {AppwriteException} * @returns {Promise>} */ - deleteDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { + deleteDocuments(databaseId: string, collectionId: string, queries?: string[]): Promise> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1813,6 +1852,7 @@ Bulk delete documents using queries, if no queries are passed then all documents payload, ); } + /** * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * @@ -1823,7 +1863,7 @@ Bulk delete documents using queries, if no queries are passed then all documents * @throws {AppwriteException} * @returns {Promise} */ - getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise { + getDocument(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1850,10 +1890,11 @@ Bulk delete documents using queries, if no queries are passed then all documents payload, ); } + /** * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId * @param {string} collectionId @@ -1863,7 +1904,7 @@ Create or update a Document. Before using this route, you should create a new co * @throws {AppwriteException} * @returns {Promise} */ - upsertDocument(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise { + upsertDocument(databaseId: string, collectionId: string, documentId: string, data: object, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1897,18 +1938,19 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. * * @param {string} databaseId * @param {string} collectionId * @param {string} documentId - * @param {Partial>} data + * @param {Partial>} data * @param {string[]} permissions * @throws {AppwriteException} * @returns {Promise} */ - updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Partial>, permissions?: string[]): Promise { + updateDocument(databaseId: string, collectionId: string, documentId: string, data?: Partial>, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1939,6 +1981,7 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Delete a document by its unique ID. * @@ -1973,6 +2016,101 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + + /** + * Decrement a specific attribute of a document by a given value. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @param {string} attribute + * @param {number} value + * @param {number} min + * @throws {AppwriteException} + * @returns {Promise} + */ + decrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof attribute === 'undefined') { + throw new AppwriteException('Missing required parameter: "attribute"'); + } + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Increment a specific attribute of a document by a given value. + * + * @param {string} databaseId + * @param {string} collectionId + * @param {string} documentId + * @param {string} attribute + * @param {number} value + * @param {number} max + * @throws {AppwriteException} + * @returns {Promise} + */ + incrementDocumentAttribute(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise { + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof attribute === 'undefined') { + throw new AppwriteException('Missing required parameter: "attribute"'); + } + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + /** * List indexes in the collection. * @@ -2006,9 +2144,10 @@ Create or update a Document. Before using this route, you should create a new co payload, ); } + /** * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. -Attributes can be `key`, `fulltext`, and `unique`. + * Attributes can be `key`, `fulltext`, and `unique`. * * @param {string} databaseId * @param {string} collectionId @@ -2066,6 +2205,7 @@ Attributes can be `key`, `fulltext`, and `unique`. payload, ); } + /** * Get index by ID. * @@ -2099,6 +2239,7 @@ Attributes can be `key`, `fulltext`, and `unique`. payload, ); } + /** * Delete an index. * diff --git a/src/services/functions.ts b/src/services/functions.ts index 7ed681f..7b544ef 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -41,6 +41,7 @@ export class Functions { payload, ); } + /** * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * @@ -144,6 +145,7 @@ export class Functions { payload, ); } + /** * Get a list of all runtimes that are currently active on your instance. * @@ -165,6 +167,7 @@ export class Functions { payload, ); } + /** * List allowed function specifications for this instance. * @@ -186,6 +189,7 @@ export class Functions { payload, ); } + /** * Get a function by its unique ID. * @@ -211,6 +215,7 @@ export class Functions { payload, ); } + /** * Update function by its unique ID. * @@ -308,6 +313,7 @@ export class Functions { payload, ); } + /** * Delete a function by its unique ID. * @@ -334,6 +340,7 @@ export class Functions { payload, ); } + /** * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. * @@ -367,6 +374,7 @@ export class Functions { payload, ); } + /** * Get a list of all the function's code deployments. You can use the query params to filter your results. * @@ -400,12 +408,13 @@ export class Functions { payload, ); } + /** * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. - -This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). - -Use the "command" param to set the entrypoint used to execute your code. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. * * @param {string} functionId * @param {File} code @@ -453,6 +462,7 @@ Use the "command" param to set the entrypoint used to execute your cod onProgress ); } + /** * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * @@ -490,10 +500,11 @@ Use the "command" param to set the entrypoint used to execute your cod payload, ); } + /** * Create a deployment based on a template. - -Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. * * @param {string} functionId * @param {string} repository @@ -550,10 +561,11 @@ Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/s payload, ); } + /** * Create a deployment when a function is connected to VCS. - -This endpoint lets you create deployment from a branch, commit, or a tag. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param {string} functionId * @param {VCSDeploymentType} type @@ -596,6 +608,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a function deployment by its unique ID. * @@ -625,6 +638,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a code deployment by its unique ID. * @@ -655,6 +669,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * @@ -689,6 +704,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. 'arrayBuffer' ); } + /** * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * @@ -719,6 +735,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all the current user function execution logs. You can use the query params to filter your results. * @@ -748,6 +765,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. * @@ -798,6 +816,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a function execution log by its unique ID. * @@ -827,6 +846,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a function execution by its unique ID. * @@ -857,6 +877,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all variables of a specific function. * @@ -882,6 +903,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * @@ -926,6 +948,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a variable by its unique ID. * @@ -955,6 +978,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Update variable by its unique ID. * @@ -1000,6 +1024,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a variable by its unique ID. * diff --git a/src/services/graphql.ts b/src/services/graphql.ts index c018580..fd34fb7 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -38,6 +38,7 @@ export class Graphql { payload, ); } + /** * Execute a GraphQL mutation. * diff --git a/src/services/health.ts b/src/services/health.ts index d8d579c..c593277 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -30,6 +30,7 @@ export class Health { payload, ); } + /** * Check the Appwrite Antivirus server is up and connection is successful. * @@ -51,6 +52,7 @@ export class Health { payload, ); } + /** * Check the Appwrite in-memory cache servers are up and connection is successful. * @@ -72,6 +74,7 @@ export class Health { payload, ); } + /** * Get the SSL certificate for a domain * @@ -97,6 +100,7 @@ export class Health { payload, ); } + /** * Check the Appwrite database servers are up and connection is successful. * @@ -118,6 +122,7 @@ export class Health { payload, ); } + /** * Check the Appwrite pub-sub servers are up and connection is successful. * @@ -139,6 +144,7 @@ export class Health { payload, ); } + /** * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. * @@ -164,6 +170,7 @@ export class Health { payload, ); } + /** * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. * @@ -189,6 +196,7 @@ export class Health { payload, ); } + /** * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. * @@ -218,6 +226,7 @@ export class Health { payload, ); } + /** * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. * @@ -243,9 +252,10 @@ export class Health { payload, ); } + /** * Returns the amount of failed jobs in a given queue. - + * * * @param {Name} name * @param {number} threshold @@ -273,6 +283,7 @@ export class Health { payload, ); } + /** * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. * @@ -298,6 +309,7 @@ export class Health { payload, ); } + /** * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. * @@ -323,6 +335,7 @@ export class Health { payload, ); } + /** * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. * @@ -348,6 +361,7 @@ export class Health { payload, ); } + /** * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. * @@ -373,6 +387,7 @@ export class Health { payload, ); } + /** * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. * @@ -398,6 +413,7 @@ export class Health { payload, ); } + /** * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. * @@ -423,6 +439,7 @@ export class Health { payload, ); } + /** * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. * @@ -448,6 +465,7 @@ export class Health { payload, ); } + /** * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. * @@ -473,6 +491,7 @@ export class Health { payload, ); } + /** * Check the Appwrite storage device is up and connection is successful. * @@ -494,6 +513,7 @@ export class Health { payload, ); } + /** * Check the Appwrite local storage device is up and connection is successful. * @@ -515,6 +535,7 @@ export class Health { payload, ); } + /** * Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. * diff --git a/src/services/locale.ts b/src/services/locale.ts index 57c74d8..48bba1f 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -10,8 +10,8 @@ export class Locale { /** * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. - -([IP Geolocation by DB-IP](https://db-ip.com)) + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) * * @throws {AppwriteException} * @returns {Promise} @@ -31,6 +31,7 @@ export class Locale { payload, ); } + /** * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). * @@ -52,6 +53,7 @@ export class Locale { payload, ); } + /** * List of all continents. You can use the locale header to get the data in a supported language. * @@ -73,6 +75,7 @@ export class Locale { payload, ); } + /** * List of all countries. You can use the locale header to get the data in a supported language. * @@ -94,6 +97,7 @@ export class Locale { payload, ); } + /** * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. * @@ -115,6 +119,7 @@ export class Locale { payload, ); } + /** * List of all countries phone codes. You can use the locale header to get the data in a supported language. * @@ -136,6 +141,7 @@ export class Locale { payload, ); } + /** * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. * @@ -157,6 +163,7 @@ export class Locale { payload, ); } + /** * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. * diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 3d7f6b5..07830ab 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -39,6 +39,7 @@ export class Messaging { payload, ); } + /** * Create a new email message. * @@ -118,9 +119,10 @@ export class Messaging { payload, ); } + /** * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - + * * * @param {string} messageId * @param {string[]} topics @@ -189,6 +191,7 @@ export class Messaging { payload, ); } + /** * Create a new push notification. * @@ -290,9 +293,10 @@ export class Messaging { payload, ); } + /** * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - + * * * @param {string} messageId * @param {string[]} topics @@ -389,6 +393,7 @@ export class Messaging { payload, ); } + /** * Create a new SMS message. * @@ -445,9 +450,10 @@ export class Messaging { payload, ); } + /** * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - + * * * @param {string} messageId * @param {string[]} topics @@ -496,9 +502,10 @@ export class Messaging { payload, ); } + /** * Get a message by its unique ID. - + * * * @param {string} messageId * @throws {AppwriteException} @@ -522,6 +529,7 @@ export class Messaging { payload, ); } + /** * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. * @@ -548,6 +556,7 @@ export class Messaging { payload, ); } + /** * Get the message activity logs listed by its unique ID. * @@ -577,6 +586,7 @@ export class Messaging { payload, ); } + /** * Get a list of the targets associated with a message. * @@ -606,6 +616,7 @@ export class Messaging { payload, ); } + /** * Get a list of all providers from the current Appwrite project. * @@ -635,6 +646,7 @@ export class Messaging { payload, ); } + /** * Create a new Apple Push Notification service provider. * @@ -695,6 +707,7 @@ export class Messaging { payload, ); } + /** * Update a Apple Push Notification service provider by its unique ID. * @@ -749,6 +762,7 @@ export class Messaging { payload, ); } + /** * Create a new Firebase Cloud Messaging provider. * @@ -793,6 +807,7 @@ export class Messaging { payload, ); } + /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -831,6 +846,7 @@ export class Messaging { payload, ); } + /** * Create a new Mailgun provider. * @@ -899,6 +915,7 @@ export class Messaging { payload, ); } + /** * Update a Mailgun provider by its unique ID. * @@ -961,6 +978,7 @@ export class Messaging { payload, ); } + /** * Create a new MSG91 provider. * @@ -1013,6 +1031,7 @@ export class Messaging { payload, ); } + /** * Update a MSG91 provider by its unique ID. * @@ -1059,6 +1078,7 @@ export class Messaging { payload, ); } + /** * Create a new Sendgrid provider. * @@ -1119,6 +1139,7 @@ export class Messaging { payload, ); } + /** * Update a Sendgrid provider by its unique ID. * @@ -1173,6 +1194,7 @@ export class Messaging { payload, ); } + /** * Create a new SMTP provider. * @@ -1260,6 +1282,7 @@ export class Messaging { payload, ); } + /** * Update a SMTP provider by its unique ID. * @@ -1338,6 +1361,7 @@ export class Messaging { payload, ); } + /** * Create a new Telesign provider. * @@ -1390,6 +1414,7 @@ export class Messaging { payload, ); } + /** * Update a Telesign provider by its unique ID. * @@ -1436,6 +1461,7 @@ export class Messaging { payload, ); } + /** * Create a new Textmagic provider. * @@ -1488,6 +1514,7 @@ export class Messaging { payload, ); } + /** * Update a Textmagic provider by its unique ID. * @@ -1534,6 +1561,7 @@ export class Messaging { payload, ); } + /** * Create a new Twilio provider. * @@ -1586,6 +1614,7 @@ export class Messaging { payload, ); } + /** * Update a Twilio provider by its unique ID. * @@ -1632,6 +1661,7 @@ export class Messaging { payload, ); } + /** * Create a new Vonage provider. * @@ -1684,6 +1714,7 @@ export class Messaging { payload, ); } + /** * Update a Vonage provider by its unique ID. * @@ -1730,9 +1761,10 @@ export class Messaging { payload, ); } + /** * Get a provider by its unique ID. - + * * * @param {string} providerId * @throws {AppwriteException} @@ -1756,6 +1788,7 @@ export class Messaging { payload, ); } + /** * Delete a provider by its unique ID. * @@ -1782,6 +1815,7 @@ export class Messaging { payload, ); } + /** * Get the provider activity logs listed by its unique ID. * @@ -1811,6 +1845,7 @@ export class Messaging { payload, ); } + /** * Get the subscriber activity logs listed by its unique ID. * @@ -1840,6 +1875,7 @@ export class Messaging { payload, ); } + /** * Get a list of all topics from the current Appwrite project. * @@ -1869,6 +1905,7 @@ export class Messaging { payload, ); } + /** * Create a new topic. * @@ -1909,9 +1946,10 @@ export class Messaging { payload, ); } + /** * Get a topic by its unique ID. - + * * * @param {string} topicId * @throws {AppwriteException} @@ -1935,9 +1973,10 @@ export class Messaging { payload, ); } + /** * Update a topic by its unique ID. - + * * * @param {string} topicId * @param {string} name @@ -1970,6 +2009,7 @@ export class Messaging { payload, ); } + /** * Delete a topic by its unique ID. * @@ -1996,6 +2036,7 @@ export class Messaging { payload, ); } + /** * Get the topic activity logs listed by its unique ID. * @@ -2025,6 +2066,7 @@ export class Messaging { payload, ); } + /** * Get a list of all subscribers from the current Appwrite project. * @@ -2058,6 +2100,7 @@ export class Messaging { payload, ); } + /** * Create a new subscriber. * @@ -2098,9 +2141,10 @@ export class Messaging { payload, ); } + /** * Get a subscriber by its unique ID. - + * * * @param {string} topicId * @param {string} subscriberId @@ -2128,6 +2172,7 @@ export class Messaging { payload, ); } + /** * Delete a subscriber by its unique ID. * diff --git a/src/services/sites.ts b/src/services/sites.ts index 3f85704..d52a5ea 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -42,6 +42,7 @@ export class Sites { payload, ); } + /** * Create a new site. * @@ -148,6 +149,7 @@ export class Sites { payload, ); } + /** * Get a list of all frameworks that are currently available on the server instance. * @@ -169,6 +171,7 @@ export class Sites { payload, ); } + /** * List allowed site specifications for this instance. * @@ -190,6 +193,7 @@ export class Sites { payload, ); } + /** * Get a site by its unique ID. * @@ -215,6 +219,7 @@ export class Sites { payload, ); } + /** * Update site by its unique ID. * @@ -315,6 +320,7 @@ export class Sites { payload, ); } + /** * Delete a site by its unique ID. * @@ -341,6 +347,7 @@ export class Sites { payload, ); } + /** * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. * @@ -374,6 +381,7 @@ export class Sites { payload, ); } + /** * Get a list of all the site's code deployments. You can use the query params to filter your results. * @@ -407,6 +415,7 @@ export class Sites { payload, ); } + /** * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. * @@ -460,6 +469,7 @@ export class Sites { onProgress ); } + /** * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * @@ -493,10 +503,11 @@ export class Sites { payload, ); } + /** * Create a deployment based on a template. - -Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. * * @param {string} siteId * @param {string} repository @@ -553,10 +564,11 @@ Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/s payload, ); } + /** * Create a deployment when a site is connected to VCS. - -This endpoint lets you create deployment from a branch, commit, or a tag. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. * * @param {string} siteId * @param {VCSDeploymentType} type @@ -599,6 +611,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a site deployment by its unique ID. * @@ -628,6 +641,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a site deployment by its unique ID. * @@ -658,6 +672,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * @@ -692,6 +707,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. 'arrayBuffer' ); } + /** * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * @@ -722,6 +738,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all site logs. You can use the query params to filter your results. * @@ -751,6 +768,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a site request log by its unique ID. * @@ -780,6 +798,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a site log by its unique ID. * @@ -810,6 +829,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a list of all variables of a specific site. * @@ -835,6 +855,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. * @@ -879,6 +900,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Get a variable by its unique ID. * @@ -908,6 +930,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Update variable by its unique ID. * @@ -953,6 +976,7 @@ This endpoint lets you create deployment from a branch, commit, or a tag. payload, ); } + /** * Delete a variable by its unique ID. * diff --git a/src/services/storage.ts b/src/services/storage.ts index f20b523..3571d89 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -40,6 +40,7 @@ export class Storage { payload, ); } + /** * Create a new storage bucket. * @@ -108,6 +109,7 @@ export class Storage { payload, ); } + /** * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. * @@ -133,6 +135,7 @@ export class Storage { payload, ); } + /** * Update a storage bucket by its unique ID. * @@ -198,6 +201,7 @@ export class Storage { payload, ); } + /** * Delete a storage bucket by its unique ID. * @@ -224,6 +228,7 @@ export class Storage { payload, ); } + /** * Get a list of all the user files. You can use the query params to filter your results. * @@ -257,15 +262,16 @@ export class Storage { payload, ); } + /** * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. - -Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. - -When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. - -If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - + * + * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. + * + * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. + * + * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + * * * @param {string} bucketId * @param {string} fileId @@ -309,6 +315,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk onProgress ); } + /** * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. * @@ -338,6 +345,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk payload, ); } + /** * Update a file by its unique ID. Only users with write permissions have access to update this resource. * @@ -376,6 +384,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk payload, ); } + /** * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. * @@ -406,6 +415,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk payload, ); } + /** * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. * @@ -440,6 +450,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'arrayBuffer' ); } + /** * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. * @@ -518,6 +529,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'arrayBuffer' ); } + /** * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. * diff --git a/src/services/teams.ts b/src/services/teams.ts index ae6fde3..fbb43d1 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -16,7 +16,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - list(queries?: string[], search?: string): Promise> { + list(queries?: string[], search?: string): Promise> { const apiPath = '/teams'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -37,6 +37,7 @@ export class Teams { payload, ); } + /** * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. * @@ -46,7 +47,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - create(teamId: string, name: string, roles?: string[]): Promise> { + create(teamId: string, name: string, roles?: string[]): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -77,6 +78,7 @@ export class Teams { payload, ); } + /** * Get a team by its ID. All team members have read access for this resource. * @@ -84,7 +86,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - get(teamId: string): Promise> { + get(teamId: string): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -102,6 +104,7 @@ export class Teams { payload, ); } + /** * Update the team's name by its unique ID. * @@ -110,7 +113,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - updateName(teamId: string, name: string): Promise> { + updateName(teamId: string, name: string): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -135,6 +138,7 @@ export class Teams { payload, ); } + /** * Delete a team using its ID. Only team members with the owner role can delete the team. * @@ -161,6 +165,7 @@ export class Teams { payload, ); } + /** * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. * @@ -194,15 +199,16 @@ export class Teams { payload, ); } + /** * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. - -You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. - -Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. - -Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - + * + * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. + * + * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + * + * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + * * * @param {string} teamId * @param {string[]} roles @@ -254,6 +260,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. * @@ -283,9 +290,10 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - + * * * @param {string} teamId * @param {string} membershipId @@ -321,6 +329,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. * @@ -351,11 +360,12 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee payload, ); } + /** * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. - -If the request is successful, a session for the user is automatically created. - + * + * If the request is successful, a session for the user is automatically created. + * * * @param {string} teamId * @param {string} membershipId @@ -398,6 +408,7 @@ If the request is successful, a session for the user is automatically created. payload, ); } + /** * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). * @@ -405,7 +416,7 @@ If the request is successful, a session for the user is automatically created. * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(teamId: string): Promise { + getPrefs(teamId: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -423,6 +434,7 @@ If the request is successful, a session for the user is automatically created. payload, ); } + /** * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. * @@ -431,7 +443,7 @@ If the request is successful, a session for the user is automatically created. * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(teamId: string, prefs: object): Promise { + updatePrefs(teamId: string, prefs: object): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } diff --git a/src/services/tokens.ts b/src/services/tokens.ts index 61326ac..8cde8ac 100644 --- a/src/services/tokens.ts +++ b/src/services/tokens.ts @@ -41,6 +41,7 @@ export class Tokens { payload, ); } + /** * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. * @@ -75,6 +76,7 @@ export class Tokens { payload, ); } + /** * Get a token by its unique ID. * @@ -100,6 +102,7 @@ export class Tokens { payload, ); } + /** * Update a token by its unique ID. Use this endpoint to update a token's expiry date. * @@ -130,6 +133,7 @@ export class Tokens { payload, ); } + /** * Delete a token by its unique ID. * diff --git a/src/services/users.ts b/src/services/users.ts index 8a1392d..5c89b4b 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -19,7 +19,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - list(queries?: string[], search?: string): Promise> { + list(queries?: string[], search?: string): Promise> { const apiPath = '/users'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -40,6 +40,7 @@ export class Users { payload, ); } + /** * Create a new user. * @@ -51,7 +52,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - create(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise> { + create(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -85,6 +86,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -95,7 +97,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createArgon2User(userId: string, email: string, password: string, name?: string): Promise> { + createArgon2User(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -132,6 +134,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -142,7 +145,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createBcryptUser(userId: string, email: string, password: string, name?: string): Promise> { + createBcryptUser(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -179,6 +182,7 @@ export class Users { payload, ); } + /** * Get identities for all users. * @@ -208,6 +212,7 @@ export class Users { payload, ); } + /** * Delete an identity by its unique ID. * @@ -234,6 +239,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -244,7 +250,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createMD5User(userId: string, email: string, password: string, name?: string): Promise> { + createMD5User(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -281,6 +287,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -291,7 +298,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createPHPassUser(userId: string, email: string, password: string, name?: string): Promise> { + createPHPassUser(userId: string, email: string, password: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -328,6 +335,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -343,7 +351,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptUser(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise> { + createScryptUser(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -410,6 +418,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -423,7 +432,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createScryptModifiedUser(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise> { + createScryptModifiedUser(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -478,6 +487,7 @@ export class Users { payload, ); } + /** * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * @@ -489,7 +499,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - createSHAUser(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise> { + createSHAUser(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -529,6 +539,7 @@ export class Users { payload, ); } + /** * Get a user by its unique ID. * @@ -536,7 +547,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - get(userId: string): Promise> { + get(userId: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -554,6 +565,7 @@ export class Users { payload, ); } + /** * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. * @@ -580,6 +592,7 @@ export class Users { payload, ); } + /** * Update the user email by its unique ID. * @@ -588,7 +601,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - updateEmail(userId: string, email: string): Promise> { + updateEmail(userId: string, email: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -613,6 +626,7 @@ export class Users { payload, ); } + /** * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. * @@ -647,17 +661,18 @@ export class Users { payload, ); } + /** * Update the user labels by its unique ID. - -Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. * * @param {string} userId * @param {string[]} labels * @throws {AppwriteException} * @returns {Promise>} */ - updateLabels(userId: string, labels: string[]): Promise> { + updateLabels(userId: string, labels: string[]): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -682,6 +697,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user activity logs list by its unique ID. * @@ -711,6 +727,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user membership list by its unique ID. * @@ -744,6 +761,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Enable or disable MFA on a user account. * @@ -752,7 +770,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updateMfa(userId: string, mfa: boolean): Promise> { + updateMfa(userId: string, mfa: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -777,6 +795,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Delete an authenticator app. * @@ -807,6 +826,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * List the factors available on the account to be used as a MFA challange. * @@ -832,6 +852,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * @@ -857,6 +878,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * @@ -883,6 +905,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. * @@ -909,6 +932,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user name by its unique ID. * @@ -917,7 +941,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updateName(userId: string, name: string): Promise> { + updateName(userId: string, name: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -942,6 +966,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user password by its unique ID. * @@ -950,7 +975,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updatePassword(userId: string, password: string): Promise> { + updatePassword(userId: string, password: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -975,6 +1000,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user phone by its unique ID. * @@ -983,7 +1009,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - updatePhone(userId: string, number: string): Promise> { + updatePhone(userId: string, number: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1008,6 +1034,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user preferences by its unique ID. * @@ -1015,7 +1042,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise} */ - getPrefs(userId: string): Promise { + getPrefs(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1033,6 +1060,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. * @@ -1041,7 +1069,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise} */ - updatePrefs(userId: string, prefs: object): Promise { + updatePrefs(userId: string, prefs: object): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1066,6 +1094,7 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Get the user sessions list by its unique ID. * @@ -1091,10 +1120,11 @@ Labels can be used to grant access to resources. While teams are a way for user& payload, ); } + /** * Creates a session for a user. Returns an immediately usable session object. - -If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + * + * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. * * @param {string} userId * @throws {AppwriteException} @@ -1119,6 +1149,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Delete all user's sessions by using the user's unique ID. * @@ -1145,6 +1176,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Delete a user sessions by its unique ID. * @@ -1175,6 +1207,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. * @@ -1183,7 +1216,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - updateStatus(userId: string, status: boolean): Promise> { + updateStatus(userId: string, status: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1208,6 +1241,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * List the messaging targets that are associated with a user. * @@ -1237,6 +1271,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Create a messaging target. * @@ -1292,6 +1327,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Get a user's push notification target by ID. * @@ -1321,6 +1357,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update a messaging target. * @@ -1363,6 +1400,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Delete a messaging target. * @@ -1393,9 +1431,10 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - + * * * @param {string} userId * @param {number} length @@ -1428,6 +1467,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update the user email verification status by its unique ID. * @@ -1436,7 +1476,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - updateEmailVerification(userId: string, emailVerification: boolean): Promise> { + updateEmailVerification(userId: string, emailVerification: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1461,6 +1501,7 @@ If you want to generate a token for a custom authentication flow, use the [POST payload, ); } + /** * Update the user phone verification status by its unique ID. * @@ -1469,7 +1510,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - updatePhoneVerification(userId: string, phoneVerification: boolean): Promise> { + updatePhoneVerification(userId: string, phoneVerification: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); }