diff --git a/package.json b/package.json index beac70a..d8b7209 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": "15.0.0", + "version": "15.0.1", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 902ae7b..e0f7263 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/15.0.0'; + let ua = 'AppwriteNodeJSSDK/15.0.1'; // `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': '15.0.0', + 'x-sdk-version': '15.0.1', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.6.0', }; @@ -328,6 +328,7 @@ class Client { const { uri, options } = this.prepareRequest(method, url, headers, params); let data: any = null; + let text: string = ''; const response = await fetch(uri, options); @@ -338,16 +339,18 @@ class Client { if (response.headers.get('content-type')?.includes('application/json')) { data = await response.json(); + text = JSON.stringify(data); } else if (responseType === 'arrayBuffer') { data = await response.arrayBuffer(); } else { + text = await response.text(); data = { - message: await response.text() + message: text }; } if (400 <= response.status) { - throw new AppwriteException(data?.message, response.status, data?.type, data); + throw new AppwriteException(data?.message, response.status, data?.type, text); } return data; diff --git a/src/models.ts b/src/models.ts index 93edb69..47c1010 100644 --- a/src/models.ts +++ b/src/models.ts @@ -443,7 +443,7 @@ export namespace Models { /** * Collection attributes. */ - attributes: string[]; + attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString)[]; /** * Collection indexes. */ @@ -460,7 +460,7 @@ export namespace Models { /** * List of attributes. */ - attributes: string[]; + attributes: (Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString)[]; } /** * AttributeString diff --git a/src/services/account.ts b/src/services/account.ts index 1f45cc9..05cceea 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -12,14 +12,12 @@ export class Account { } /** - * Get account - * * Get the currently logged in user. * * @throws {AppwriteException} * @returns {Promise>} */ - async get(): Promise> { + get(): Promise> { const apiPath = '/account'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -28,7 +26,7 @@ export class Account { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -36,8 +34,6 @@ export class Account { ); } /** - * Create account - * * 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). * * @param {string} userId @@ -47,7 +43,7 @@ export class Account { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -77,7 +73,7 @@ export class Account { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -85,8 +81,6 @@ export class Account { ); } /** - * Update email - * * 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. @@ -96,7 +90,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - async updateEmail(email: string, password: string): Promise> { + updateEmail(email: string, password: string): Promise> { if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } @@ -117,7 +111,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -125,15 +119,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * List identities - * * Get the list of identities for the currently logged in user. * * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} */ - async listIdentities(queries?: string[]): Promise { + listIdentities(queries?: string[]): Promise { const apiPath = '/account/identities'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -145,7 +137,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -153,15 +145,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Delete identity - * * Delete an identity by its unique ID. * * @param {string} identityId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteIdentity(identityId: string): Promise<{}> { + deleteIdentity(identityId: string): Promise<{}> { if (typeof identityId === 'undefined') { throw new AppwriteException('Missing required parameter: "identityId"'); } @@ -173,7 +163,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -181,14 +171,12 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Create JWT - * * 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. * * @throws {AppwriteException} * @returns {Promise} */ - async createJWT(): Promise { + createJWT(): Promise { const apiPath = '/account/jwts'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -197,7 +185,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -205,15 +193,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * List logs - * * 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. * * @param {string[]} queries * @throws {AppwriteException} * @returns {Promise} */ - async listLogs(queries?: string[]): Promise { + listLogs(queries?: string[]): Promise { const apiPath = '/account/logs'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -225,7 +211,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -233,15 +219,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Update MFA - * * Enable or disable MFA on an account. * * @param {boolean} mfa * @throws {AppwriteException} * @returns {Promise>} */ - async updateMFA(mfa: boolean): Promise> { + updateMFA(mfa: boolean): Promise> { if (typeof mfa === 'undefined') { throw new AppwriteException('Missing required parameter: "mfa"'); } @@ -256,7 +240,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -264,15 +248,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Create authenticator - * * 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. * * @param {AuthenticatorType} type * @throws {AppwriteException} * @returns {Promise} */ - async createMfaAuthenticator(type: AuthenticatorType): Promise { + createMfaAuthenticator(type: AuthenticatorType): Promise { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } @@ -284,7 +266,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -292,8 +274,6 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Verify authenticator - * * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. * * @param {AuthenticatorType} type @@ -301,7 +281,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - async updateMfaAuthenticator(type: AuthenticatorType, otp: string): Promise> { + updateMfaAuthenticator(type: AuthenticatorType, otp: string): Promise> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } @@ -319,7 +299,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -327,15 +307,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Delete authenticator - * * Delete an authenticator for a user by ID. * * @param {AuthenticatorType} type * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> { + deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } @@ -347,7 +325,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -355,15 +333,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Create MFA challenge - * * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. * * @param {AuthenticationFactor} factor * @throws {AppwriteException} * @returns {Promise} */ - async createMfaChallenge(factor: AuthenticationFactor): Promise { + createMfaChallenge(factor: AuthenticationFactor): Promise { if (typeof factor === 'undefined') { throw new AppwriteException('Missing required parameter: "factor"'); } @@ -378,7 +354,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -386,8 +362,6 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Create MFA challenge (confirmation) - * * 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. * * @param {string} challengeId @@ -395,7 +369,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise} */ - async updateMfaChallenge(challengeId: string, otp: string): Promise { + updateMfaChallenge(challengeId: string, otp: string): Promise { if (typeof challengeId === 'undefined') { throw new AppwriteException('Missing required parameter: "challengeId"'); } @@ -416,7 +390,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -424,14 +398,12 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * List factors - * * List the factors available on the account to be used as a MFA challange. * * @throws {AppwriteException} * @returns {Promise} */ - async listMfaFactors(): Promise { + listMfaFactors(): Promise { const apiPath = '/account/mfa/factors'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -440,7 +412,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -448,14 +420,12 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Get MFA recovery codes - * * 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. * * @throws {AppwriteException} * @returns {Promise} */ - async getMfaRecoveryCodes(): Promise { + getMfaRecoveryCodes(): Promise { const apiPath = '/account/mfa/recovery-codes'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -464,7 +434,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -472,14 +442,12 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Create MFA recovery codes - * * 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. * * @throws {AppwriteException} * @returns {Promise} */ - async createMfaRecoveryCodes(): Promise { + createMfaRecoveryCodes(): Promise { const apiPath = '/account/mfa/recovery-codes'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -488,7 +456,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -496,14 +464,12 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Regenerate MFA recovery codes - * * 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. * * @throws {AppwriteException} * @returns {Promise} */ - async updateMfaRecoveryCodes(): Promise { + updateMfaRecoveryCodes(): Promise { const apiPath = '/account/mfa/recovery-codes'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -512,7 +478,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -520,15 +486,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Update name - * * Update currently logged in user account name. * * @param {string} name * @throws {AppwriteException} * @returns {Promise>} */ - async updateName(name: string): Promise> { + updateName(name: string): Promise> { if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } @@ -543,7 +507,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -551,8 +515,6 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Update password - * * 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. * * @param {string} password @@ -560,7 +522,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - async updatePassword(password: string, oldPassword?: string): Promise> { + updatePassword(password: string, oldPassword?: string): Promise> { if (typeof password === 'undefined') { throw new AppwriteException('Missing required parameter: "password"'); } @@ -578,7 +540,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -586,8 +548,6 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Update phone - * * 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. * * @param {string} phone @@ -595,7 +555,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise>} */ - async updatePhone(phone: string, password: string): Promise> { + updatePhone(phone: string, password: string): Promise> { if (typeof phone === 'undefined') { throw new AppwriteException('Missing required parameter: "phone"'); } @@ -616,7 +576,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -624,14 +584,12 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Get account preferences - * * Get the preferences as a key-value object for the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} */ - async getPrefs(): Promise { + getPrefs(): Promise { const apiPath = '/account/prefs'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -640,7 +598,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -648,15 +606,13 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Update preferences - * * 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. * * @param {Partial} prefs * @throws {AppwriteException} * @returns {Promise>} */ - async updatePrefs(prefs: Partial): Promise> { + updatePrefs(prefs: Partial): Promise> { if (typeof prefs === 'undefined') { throw new AppwriteException('Missing required parameter: "prefs"'); } @@ -671,7 +627,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -679,8 +635,6 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Create password recovery - * * 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. * * @param {string} email @@ -688,7 +642,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @throws {AppwriteException} * @returns {Promise} */ - async createRecovery(email: string, url: string): Promise { + createRecovery(email: string, url: string): Promise { if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } @@ -709,7 +663,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -717,8 +671,6 @@ This endpoint can also be used to convert an anonymous account to a normal one, ); } /** - * Create password recovery (confirmation) - * * 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. @@ -729,7 +681,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ * @throws {AppwriteException} * @returns {Promise} */ - async updateRecovery(userId: string, secret: string, password: string): Promise { + updateRecovery(userId: string, secret: string, password: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -756,7 +708,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -764,14 +716,12 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ ); } /** - * List sessions - * * Get the list of active sessions across different devices for the currently logged in user. * * @throws {AppwriteException} * @returns {Promise} */ - async listSessions(): Promise { + listSessions(): Promise { const apiPath = '/account/sessions'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -780,7 +730,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -788,14 +738,12 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ ); } /** - * Delete sessions - * * Delete all sessions from the user account and remove any sessions cookies from the end client. * * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteSessions(): Promise<{}> { + deleteSessions(): Promise<{}> { const apiPath = '/account/sessions'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -804,7 +752,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -812,14 +760,12 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ ); } /** - * Create anonymous session - * * 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). * * @throws {AppwriteException} * @returns {Promise} */ - async createAnonymousSession(): Promise { + createAnonymousSession(): Promise { const apiPath = '/account/sessions/anonymous'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -828,7 +774,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -836,8 +782,6 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ ); } /** - * Create email password session - * * 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). @@ -847,7 +791,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async createEmailPasswordSession(email: string, password: string): Promise { + createEmailPasswordSession(email: string, password: string): Promise { if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } @@ -868,7 +812,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -876,8 +820,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Update magic URL session - * * 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. * * @param {string} userId @@ -885,7 +827,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async updateMagicURLSession(userId: string, secret: string): Promise { + updateMagicURLSession(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -906,7 +848,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -914,8 +856,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Update phone session - * * 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. * * @param {string} userId @@ -923,7 +863,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async updatePhoneSession(userId: string, secret: string): Promise { + updatePhoneSession(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -944,7 +884,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -952,8 +892,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Create session - * * 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. * * @param {string} userId @@ -961,7 +899,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async createSession(userId: string, secret: string): Promise { + createSession(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -982,7 +920,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -990,15 +928,13 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Get session - * * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. * * @param {string} sessionId * @throws {AppwriteException} * @returns {Promise} */ - async getSession(sessionId: string): Promise { + getSession(sessionId: string): Promise { if (typeof sessionId === 'undefined') { throw new AppwriteException('Missing required parameter: "sessionId"'); } @@ -1010,7 +946,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1018,15 +954,13 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Update session - * * 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. * * @param {string} sessionId * @throws {AppwriteException} * @returns {Promise} */ - async updateSession(sessionId: string): Promise { + updateSession(sessionId: string): Promise { if (typeof sessionId === 'undefined') { throw new AppwriteException('Missing required parameter: "sessionId"'); } @@ -1038,7 +972,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1046,15 +980,13 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Delete session - * * 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. * * @param {string} sessionId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteSession(sessionId: string): Promise<{}> { + deleteSession(sessionId: string): Promise<{}> { if (typeof sessionId === 'undefined') { throw new AppwriteException('Missing required parameter: "sessionId"'); } @@ -1066,7 +998,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -1074,14 +1006,12 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Update status - * * 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>} */ - async updateStatus(): Promise> { + updateStatus(): Promise> { const apiPath = '/account/status'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1090,7 +1020,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1098,8 +1028,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Create email token (OTP) - * * 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). @@ -1110,7 +1038,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async createEmailToken(userId: string, email: string, phrase?: boolean): Promise { + createEmailToken(userId: string, email: string, phrase?: boolean): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1134,7 +1062,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1142,8 +1070,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Create magic URL token - * * 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). @@ -1156,7 +1082,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise { + createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1183,7 +1109,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1191,8 +1117,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Create OAuth2 token - * * 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. @@ -1206,7 +1130,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise { + createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise { if (typeof provider === 'undefined') { throw new AppwriteException('Missing required parameter: "provider"'); } @@ -1227,7 +1151,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.redirect( + return this.client.redirect( 'get', uri, apiHeaders, @@ -1235,8 +1159,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Create phone token - * * 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). @@ -1246,7 +1168,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about * @throws {AppwriteException} * @returns {Promise} */ - async createPhoneToken(userId: string, phone: string): Promise { + createPhoneToken(userId: string, phone: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1267,7 +1189,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1275,8 +1197,6 @@ A user is limited to 10 active sessions at a time by default. [Learn more about ); } /** - * Create email verification - * * 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. @@ -1286,7 +1206,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ * @throws {AppwriteException} * @returns {Promise} */ - async createVerification(url: string): Promise { + createVerification(url: string): Promise { if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } @@ -1301,7 +1221,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1309,8 +1229,6 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ ); } /** - * Create email verification (confirmation) - * * 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. * * @param {string} userId @@ -1318,7 +1236,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ * @throws {AppwriteException} * @returns {Promise} */ - async updateVerification(userId: string, secret: string): Promise { + updateVerification(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1339,7 +1257,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -1347,14 +1265,12 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ ); } /** - * Create phone verification - * * 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. * * @throws {AppwriteException} * @returns {Promise} */ - async createPhoneVerification(): Promise { + createPhoneVerification(): Promise { const apiPath = '/account/verification/phone'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -1363,7 +1279,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1371,8 +1287,6 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ ); } /** - * Update phone verification (confirmation) - * * 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. * * @param {string} userId @@ -1380,7 +1294,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ * @throws {AppwriteException} * @returns {Promise} */ - async updatePhoneVerification(userId: string, secret: string): Promise { + updatePhoneVerification(userId: string, secret: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1401,7 +1315,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 3111f49..dfe3870 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -12,8 +12,6 @@ export class Avatars { } /** - * Get browser icon - * * 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. @@ -25,7 +23,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre * @throws {AppwriteException} * @returns {Promise} */ - async getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise { + getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } @@ -46,7 +44,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -55,8 +53,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre ); } /** - * Get credit card icon - * * 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. @@ -69,7 +65,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre * @throws {AppwriteException} * @returns {Promise} */ - async getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise { + getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } @@ -90,7 +86,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -99,8 +95,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre ); } /** - * Get favicon - * * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. This endpoint does not follow HTTP redirects. @@ -109,7 +103,7 @@ This endpoint does not follow HTTP redirects. * @throws {AppwriteException} * @returns {Promise} */ - async getFavicon(url: string): Promise { + getFavicon(url: string): Promise { if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } @@ -124,7 +118,7 @@ This endpoint does not follow HTTP redirects. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -133,8 +127,6 @@ This endpoint does not follow HTTP redirects. ); } /** - * Get country flag - * * 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. @@ -147,7 +139,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre * @throws {AppwriteException} * @returns {Promise} */ - async getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise { + getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } @@ -168,7 +160,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -177,8 +169,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre ); } /** - * Get image from URL - * * 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. @@ -191,7 +181,7 @@ This endpoint does not follow HTTP redirects. * @throws {AppwriteException} * @returns {Promise} */ - async getImage(url: string, width?: number, height?: number): Promise { + getImage(url: string, width?: number, height?: number): Promise { if (typeof url === 'undefined') { throw new AppwriteException('Missing required parameter: "url"'); } @@ -212,7 +202,7 @@ This endpoint does not follow HTTP redirects. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -221,8 +211,6 @@ This endpoint does not follow HTTP redirects. ); } /** - * Get user initials - * * 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. @@ -237,7 +225,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre * @throws {AppwriteException} * @returns {Promise} */ - async getInitials(name?: string, width?: number, height?: number, background?: string): Promise { + getInitials(name?: string, width?: number, height?: number, background?: string): Promise { const apiPath = '/avatars/initials'; const payload: Payload = {}; if (typeof name !== 'undefined') { @@ -258,7 +246,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -267,8 +255,6 @@ When one dimension is specified and the other is 0, the image is scaled with pre ); } /** - * Get QR code - * * 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. * @@ -279,7 +265,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre * @throws {AppwriteException} * @returns {Promise} */ - async getQR(text: string, size?: number, margin?: number, download?: boolean): Promise { + getQR(text: string, size?: number, margin?: number, download?: boolean): Promise { if (typeof text === 'undefined') { throw new AppwriteException('Missing required parameter: "text"'); } @@ -303,7 +289,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, diff --git a/src/services/databases.ts b/src/services/databases.ts index c200f04..fc0c5bd 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -12,8 +12,6 @@ export class Databases { } /** - * List databases - * * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. * * @param {string[]} queries @@ -21,7 +19,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async list(queries?: string[], search?: string): Promise { + list(queries?: string[], search?: string): Promise { const apiPath = '/databases'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -36,7 +34,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -44,8 +42,6 @@ export class Databases { ); } /** - * Create database - * * Create a new Database. * @@ -55,7 +51,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async create(databaseId: string, name: string, enabled?: boolean): Promise { + create(databaseId: string, name: string, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -79,7 +75,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -87,15 +83,13 @@ export class Databases { ); } /** - * Get database - * * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * * @param {string} databaseId * @throws {AppwriteException} * @returns {Promise} */ - async get(databaseId: string): Promise { + get(databaseId: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -107,7 +101,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -115,8 +109,6 @@ export class Databases { ); } /** - * Update database - * * Update a database by its unique ID. * * @param {string} databaseId @@ -125,7 +117,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async update(databaseId: string, name: string, enabled?: boolean): Promise { + update(databaseId: string, name: string, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -146,7 +138,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -154,15 +146,13 @@ export class Databases { ); } /** - * Delete database - * * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. * * @param {string} databaseId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async delete(databaseId: string): Promise<{}> { + delete(databaseId: string): Promise<{}> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -174,7 +164,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -182,8 +172,6 @@ export class Databases { ); } /** - * List collections - * * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. * * @param {string} databaseId @@ -192,7 +180,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async listCollections(databaseId: string, queries?: string[], search?: string): Promise { + listCollections(databaseId: string, queries?: string[], search?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -210,7 +198,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -218,8 +206,6 @@ export class Databases { ); } /** - * Create collection - * * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId @@ -231,7 +217,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { + createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -264,7 +250,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -272,8 +258,6 @@ export class Databases { ); } /** - * Get collection - * * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. * * @param {string} databaseId @@ -281,7 +265,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async getCollection(databaseId: string, collectionId: string): Promise { + getCollection(databaseId: string, collectionId: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -296,7 +280,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -304,8 +288,6 @@ export class Databases { ); } /** - * Update collection - * * Update a collection by its unique ID. * * @param {string} databaseId @@ -317,7 +299,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { + updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -347,7 +329,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -355,8 +337,6 @@ export class Databases { ); } /** - * Delete collection - * * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. * * @param {string} databaseId @@ -364,7 +344,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteCollection(databaseId: string, collectionId: string): Promise<{}> { + deleteCollection(databaseId: string, collectionId: string): Promise<{}> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -379,7 +359,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -387,8 +367,6 @@ export class Databases { ); } /** - * List attributes - * * List attributes in the collection. * * @param {string} databaseId @@ -397,7 +375,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise { + listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -415,7 +393,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -423,8 +401,6 @@ export class Databases { ); } /** - * Create boolean attribute - * * Create a boolean attribute. * @@ -437,7 +413,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise { + createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -470,7 +446,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -478,8 +454,6 @@ export class Databases { ); } /** - * Update boolean attribute - * * Update a boolean attribute. Changing the `default` value will not update already existing documents. * * @param {string} databaseId @@ -491,7 +465,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise { + updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -524,7 +498,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -532,8 +506,6 @@ export class Databases { ); } /** - * Create datetime attribute - * * Create a date time attribute according to the ISO 8601 standard. * * @param {string} databaseId @@ -545,7 +517,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -578,7 +550,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -586,8 +558,6 @@ export class Databases { ); } /** - * Update dateTime attribute - * * Update a date time attribute. Changing the `default` value will not update already existing documents. * * @param {string} databaseId @@ -599,7 +569,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -632,7 +602,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -640,8 +610,6 @@ export class Databases { ); } /** - * Create email attribute - * * Create an email attribute. * @@ -654,7 +622,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -687,7 +655,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -695,8 +663,6 @@ export class Databases { ); } /** - * Update email attribute - * * Update an email attribute. Changing the `default` value will not update already existing documents. * @@ -709,7 +675,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -742,7 +708,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -750,8 +716,6 @@ export class Databases { ); } /** - * Create enum attribute - * * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. * @@ -765,7 +729,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise { + createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -804,7 +768,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -812,8 +776,6 @@ export class Databases { ); } /** - * Update enum attribute - * * Update an enum attribute. Changing the `default` value will not update already existing documents. * @@ -827,7 +789,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise { + updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -866,7 +828,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -874,8 +836,6 @@ export class Databases { ); } /** - * Create float attribute - * * Create a float attribute. Optionally, minimum and maximum values can be provided. * @@ -890,7 +850,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { + createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -929,7 +889,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -937,8 +897,6 @@ export class Databases { ); } /** - * Update float attribute - * * Update a float attribute. Changing the `default` value will not update already existing documents. * @@ -953,7 +911,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { + updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -998,7 +956,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1006,8 +964,6 @@ export class Databases { ); } /** - * Create integer attribute - * * Create an integer attribute. Optionally, minimum and maximum values can be provided. * @@ -1022,7 +978,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { + createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1061,7 +1017,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1069,8 +1025,6 @@ export class Databases { ); } /** - * Update integer attribute - * * Update an integer attribute. Changing the `default` value will not update already existing documents. * @@ -1085,7 +1039,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { + updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1130,7 +1084,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1138,8 +1092,6 @@ export class Databases { ); } /** - * Create IP address attribute - * * Create IP address attribute. * @@ -1152,7 +1104,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1185,7 +1137,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1193,8 +1145,6 @@ export class Databases { ); } /** - * Update IP address attribute - * * Update an ip attribute. Changing the `default` value will not update already existing documents. * @@ -1207,7 +1157,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1240,7 +1190,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1248,8 +1198,6 @@ export class Databases { ); } /** - * Create relationship attribute - * * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -1264,7 +1212,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise { + createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1303,7 +1251,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1311,8 +1259,6 @@ export class Databases { ); } /** - * Create string attribute - * * Create a string attribute. * @@ -1327,7 +1273,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise { + createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1369,7 +1315,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1377,8 +1323,6 @@ export class Databases { ); } /** - * Update string attribute - * * Update a string attribute. Changing the `default` value will not update already existing documents. * @@ -1392,7 +1336,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise { + updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1428,7 +1372,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1436,8 +1380,6 @@ export class Databases { ); } /** - * Create URL attribute - * * Create a URL attribute. * @@ -1450,7 +1392,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { + createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1483,7 +1425,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1491,8 +1433,6 @@ export class Databases { ); } /** - * Update URL attribute - * * Update an url attribute. Changing the `default` value will not update already existing documents. * @@ -1505,7 +1445,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { + updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1538,7 +1478,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1546,8 +1486,6 @@ export class Databases { ); } /** - * Get attribute - * * Get attribute by ID. * * @param {string} databaseId @@ -1556,7 +1494,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<{}>} */ - async getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { + getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1574,7 +1512,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1582,8 +1520,6 @@ export class Databases { ); } /** - * Delete attribute - * * Deletes an attribute. * * @param {string} databaseId @@ -1592,7 +1528,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { + deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1610,7 +1546,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -1618,8 +1554,6 @@ export class Databases { ); } /** - * Update relationship attribute - * * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -1631,7 +1565,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise { + updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1655,7 +1589,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1663,8 +1597,6 @@ export class Databases { ); } /** - * List documents - * * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * * @param {string} databaseId @@ -1673,7 +1605,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -1691,7 +1623,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1699,8 +1631,6 @@ export class Databases { ); } /** - * Create document - * * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. * * @param {string} databaseId @@ -1711,7 +1641,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async createDocument(databaseId: string, collectionId: string, documentId: string, data: Omit, permissions?: string[]): Promise { + createDocument(databaseId: string, collectionId: string, documentId: string, data: Omit, permissions?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1741,7 +1671,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1749,8 +1679,6 @@ export class Databases { ); } /** - * Get document - * * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. * * @param {string} databaseId @@ -1760,7 +1688,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async 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"'); } @@ -1781,7 +1709,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1789,8 +1717,6 @@ export class Databases { ); } /** - * Update document - * * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. * * @param {string} databaseId @@ -1801,7 +1727,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async 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"'); } @@ -1825,7 +1751,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1833,8 +1759,6 @@ export class Databases { ); } /** - * Delete document - * * Delete a document by its unique ID. * * @param {string} databaseId @@ -1843,7 +1767,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> { + deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1861,7 +1785,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -1869,8 +1793,6 @@ export class Databases { ); } /** - * List indexes - * * List indexes in the collection. * * @param {string} databaseId @@ -1879,7 +1801,7 @@ export class Databases { * @throws {AppwriteException} * @returns {Promise} */ - async listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise { + listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1897,7 +1819,7 @@ export class Databases { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1905,8 +1827,6 @@ export class Databases { ); } /** - * Create index - * * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. * @@ -1919,7 +1839,7 @@ Attributes can be `key`, `fulltext`, and `unique`. * @throws {AppwriteException} * @returns {Promise} */ - async createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[]): Promise { + createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[]): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1955,7 +1875,7 @@ Attributes can be `key`, `fulltext`, and `unique`. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1963,8 +1883,6 @@ Attributes can be `key`, `fulltext`, and `unique`. ); } /** - * Get index - * * Get index by ID. * * @param {string} databaseId @@ -1973,7 +1891,7 @@ Attributes can be `key`, `fulltext`, and `unique`. * @throws {AppwriteException} * @returns {Promise} */ - async getIndex(databaseId: string, collectionId: string, key: string): Promise { + getIndex(databaseId: string, collectionId: string, key: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1991,7 +1909,7 @@ Attributes can be `key`, `fulltext`, and `unique`. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1999,8 +1917,6 @@ Attributes can be `key`, `fulltext`, and `unique`. ); } /** - * Delete index - * * Delete an index. * * @param {string} databaseId @@ -2009,7 +1925,7 @@ Attributes can be `key`, `fulltext`, and `unique`. * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> { + deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -2027,7 +1943,7 @@ Attributes can be `key`, `fulltext`, and `unique`. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, diff --git a/src/services/functions.ts b/src/services/functions.ts index 7c49eaa..451e131 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -11,8 +11,6 @@ export class Functions { } /** - * List functions - * * Get a list of all the project's functions. You can use the query params to filter your results. * * @param {string[]} queries @@ -20,7 +18,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - async list(queries?: string[], search?: string): Promise { + list(queries?: string[], search?: string): Promise { const apiPath = '/functions'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -35,7 +33,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -43,8 +41,6 @@ export class Functions { ); } /** - * Create function - * * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * * @param {string} functionId @@ -72,7 +68,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - async create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateVersion?: string, specification?: string): Promise { + create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateVersion?: string, specification?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -156,7 +152,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -164,14 +160,12 @@ export class Functions { ); } /** - * List runtimes - * * Get a list of all runtimes that are currently active on your instance. * * @throws {AppwriteException} * @returns {Promise} */ - async listRuntimes(): Promise { + listRuntimes(): Promise { const apiPath = '/functions/runtimes'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -180,7 +174,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -188,15 +182,13 @@ export class Functions { ); } /** - * List available function runtime specifications - * * List allowed function specifications for this instance. * * @throws {AppwriteException} * @returns {Promise} */ - async listSpecifications(): Promise { + listSpecifications(): Promise { const apiPath = '/functions/specifications'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -205,7 +197,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -213,15 +205,13 @@ export class Functions { ); } /** - * Get function - * * Get a function by its unique ID. * * @param {string} functionId * @throws {AppwriteException} * @returns {Promise} */ - async get(functionId: string): Promise { + get(functionId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -233,7 +223,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -241,8 +231,6 @@ export class Functions { ); } /** - * Update function - * * Update function by its unique ID. * * @param {string} functionId @@ -266,7 +254,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise { + update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -332,7 +320,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -340,15 +328,13 @@ export class Functions { ); } /** - * Delete function - * * Delete a function by its unique ID. * * @param {string} functionId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async delete(functionId: string): Promise<{}> { + delete(functionId: string): Promise<{}> { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -360,7 +346,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -368,8 +354,6 @@ export class Functions { ); } /** - * List deployments - * * Get a list of all the project's code deployments. You can use the query params to filter your results. * * @param {string} functionId @@ -378,7 +362,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise} */ - async listDeployments(functionId: string, queries?: string[], search?: string): Promise { + listDeployments(functionId: string, queries?: string[], search?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -396,7 +380,7 @@ export class Functions { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -404,8 +388,6 @@ export class Functions { ); } /** - * Create deployment - * * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). @@ -420,7 +402,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress = (progress: UploadProgress) => {}): Promise { + createDeployment(functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress = (progress: UploadProgress) => {}): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -450,7 +432,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'multipart/form-data', } - return await this.client.chunkedUpload( + return this.client.chunkedUpload( 'post', uri, apiHeaders, @@ -459,8 +441,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Get deployment - * * Get a code deployment by its unique ID. * * @param {string} functionId @@ -468,7 +448,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async getDeployment(functionId: string, deploymentId: string): Promise { + getDeployment(functionId: string, deploymentId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -483,7 +463,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -491,8 +471,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Update deployment - * * Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. * * @param {string} functionId @@ -500,7 +478,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async updateDeployment(functionId: string, deploymentId: string): Promise { + updateDeployment(functionId: string, deploymentId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -515,7 +493,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -523,8 +501,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Delete deployment - * * Delete a code deployment by its unique ID. * * @param {string} functionId @@ -532,7 +508,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteDeployment(functionId: string, deploymentId: string): Promise<{}> { + deleteDeployment(functionId: string, deploymentId: string): Promise<{}> { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -547,7 +523,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -555,8 +531,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Rebuild deployment - * * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. * * @param {string} functionId @@ -565,7 +539,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise<{}>} */ - async createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}> { + createBuild(functionId: string, deploymentId: string, buildId?: string): Promise<{}> { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -583,7 +557,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -591,8 +565,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Cancel deployment - * * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. * * @param {string} functionId @@ -600,7 +572,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async updateDeploymentBuild(functionId: string, deploymentId: string): Promise { + updateDeploymentBuild(functionId: string, deploymentId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -615,7 +587,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -623,8 +595,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Download deployment - * * Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. * * @param {string} functionId @@ -632,7 +602,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async getDeploymentDownload(functionId: string, deploymentId: string): Promise { + getDeploymentDownload(functionId: string, deploymentId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -647,7 +617,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -656,8 +626,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * List executions - * * Get a list of all the current user function execution logs. You can use the query params to filter your results. * * @param {string} functionId @@ -666,7 +634,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async listExecutions(functionId: string, queries?: string[], search?: string): Promise { + listExecutions(functionId: string, queries?: string[], search?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -684,7 +652,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -692,8 +660,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Create execution - * * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. * * @param {string} functionId @@ -706,7 +672,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise { + createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -736,7 +702,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -744,8 +710,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Get execution - * * Get a function execution log by its unique ID. * * @param {string} functionId @@ -753,7 +717,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async getExecution(functionId: string, executionId: string): Promise { + getExecution(functionId: string, executionId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -768,7 +732,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -776,8 +740,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Delete execution - * * Delete a function execution by its unique ID. * @@ -786,7 +748,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteExecution(functionId: string, executionId: string): Promise<{}> { + deleteExecution(functionId: string, executionId: string): Promise<{}> { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -801,7 +763,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -809,15 +771,13 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * List variables - * * Get a list of all variables of a specific function. * * @param {string} functionId * @throws {AppwriteException} * @returns {Promise} */ - async listVariables(functionId: string): Promise { + listVariables(functionId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -829,7 +789,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -837,8 +797,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Create variable - * * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * * @param {string} functionId @@ -847,7 +805,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async createVariable(functionId: string, key: string, value: string): Promise { + createVariable(functionId: string, key: string, value: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -871,7 +829,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -879,8 +837,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Get variable - * * Get a variable by its unique ID. * * @param {string} functionId @@ -888,7 +844,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async getVariable(functionId: string, variableId: string): Promise { + getVariable(functionId: string, variableId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -903,7 +859,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -911,8 +867,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Update variable - * * Update variable by its unique ID. * * @param {string} functionId @@ -922,7 +876,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise} */ - async updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise { + updateVariable(functionId: string, variableId: string, key: string, value?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -946,7 +900,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -954,8 +908,6 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Delete variable - * * Delete a variable by its unique ID. * * @param {string} functionId @@ -963,7 +915,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteVariable(functionId: string, variableId: string): Promise<{}> { + deleteVariable(functionId: string, variableId: string): Promise<{}> { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -978,7 +930,7 @@ Use the "command" param to set the entrypoint used to execute your cod 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, diff --git a/src/services/graphql.ts b/src/services/graphql.ts index ca0219d..c018580 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -9,15 +9,13 @@ export class Graphql { } /** - * GraphQL endpoint - * * Execute a GraphQL mutation. * * @param {object} query * @throws {AppwriteException} * @returns {Promise<{}>} */ - async query(query: object): Promise<{}> { + query(query: object): Promise<{}> { if (typeof query === 'undefined') { throw new AppwriteException('Missing required parameter: "query"'); } @@ -33,7 +31,7 @@ export class Graphql { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -41,15 +39,13 @@ export class Graphql { ); } /** - * GraphQL endpoint - * * Execute a GraphQL mutation. * * @param {object} query * @throws {AppwriteException} * @returns {Promise<{}>} */ - async mutation(query: object): Promise<{}> { + mutation(query: object): Promise<{}> { if (typeof query === 'undefined') { throw new AppwriteException('Missing required parameter: "query"'); } @@ -65,7 +61,7 @@ export class Graphql { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, diff --git a/src/services/health.ts b/src/services/health.ts index ef4e6d1..9682c3c 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -10,14 +10,12 @@ export class Health { } /** - * Get HTTP - * * Check the Appwrite HTTP server is up and responsive. * * @throws {AppwriteException} * @returns {Promise} */ - async get(): Promise { + get(): Promise { const apiPath = '/health'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -26,7 +24,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -34,14 +32,12 @@ export class Health { ); } /** - * Get antivirus - * * Check the Appwrite Antivirus server is up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ - async getAntivirus(): Promise { + getAntivirus(): Promise { const apiPath = '/health/anti-virus'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -50,7 +46,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -58,14 +54,12 @@ export class Health { ); } /** - * Get cache - * * Check the Appwrite in-memory cache servers are up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ - async getCache(): Promise { + getCache(): Promise { const apiPath = '/health/cache'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -74,7 +68,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -82,15 +76,13 @@ export class Health { ); } /** - * Get the SSL certificate for a domain - * * Get the SSL certificate for a domain * * @param {string} domain * @throws {AppwriteException} * @returns {Promise} */ - async getCertificate(domain?: string): Promise { + getCertificate(domain?: string): Promise { const apiPath = '/health/certificate'; const payload: Payload = {}; if (typeof domain !== 'undefined') { @@ -102,7 +94,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -110,14 +102,12 @@ export class Health { ); } /** - * Get DB - * * Check the Appwrite database servers are up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ - async getDB(): Promise { + getDB(): Promise { const apiPath = '/health/db'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -126,7 +116,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -134,14 +124,12 @@ export class Health { ); } /** - * Get pubsub - * * Check the Appwrite pub-sub servers are up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ - async getPubSub(): Promise { + getPubSub(): Promise { const apiPath = '/health/pubsub'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -150,7 +138,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -158,14 +146,12 @@ export class Health { ); } /** - * Get queue - * * Check the Appwrite queue messaging servers are up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ - async getQueue(): Promise { + getQueue(): Promise { const apiPath = '/health/queue'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -174,7 +160,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -182,15 +168,13 @@ export class Health { ); } /** - * Get builds queue - * * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueBuilds(threshold?: number): Promise { + getQueueBuilds(threshold?: number): Promise { const apiPath = '/health/queue/builds'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -202,7 +186,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -210,15 +194,13 @@ export class Health { ); } /** - * Get certificates queue - * * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueCertificates(threshold?: number): Promise { + getQueueCertificates(threshold?: number): Promise { const apiPath = '/health/queue/certificates'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -230,7 +212,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -238,8 +220,6 @@ export class Health { ); } /** - * Get databases queue - * * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. * * @param {string} name @@ -247,7 +227,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - async getQueueDatabases(name?: string, threshold?: number): Promise { + getQueueDatabases(name?: string, threshold?: number): Promise { const apiPath = '/health/queue/databases'; const payload: Payload = {}; if (typeof name !== 'undefined') { @@ -262,7 +242,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -270,15 +250,13 @@ export class Health { ); } /** - * Get deletes queue - * * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueDeletes(threshold?: number): Promise { + getQueueDeletes(threshold?: number): Promise { const apiPath = '/health/queue/deletes'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -290,7 +268,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -298,8 +276,6 @@ export class Health { ); } /** - * Get number of failed queue jobs - * * Returns the amount of failed jobs in a given queue. * @@ -308,7 +284,7 @@ export class Health { * @throws {AppwriteException} * @returns {Promise} */ - async getFailedJobs(name: Name, threshold?: number): Promise { + getFailedJobs(name: Name, threshold?: number): Promise { if (typeof name === 'undefined') { throw new AppwriteException('Missing required parameter: "name"'); } @@ -323,7 +299,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -331,15 +307,13 @@ export class Health { ); } /** - * Get functions queue - * * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueFunctions(threshold?: number): Promise { + getQueueFunctions(threshold?: number): Promise { const apiPath = '/health/queue/functions'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -351,7 +325,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -359,15 +333,13 @@ export class Health { ); } /** - * Get logs queue - * * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueLogs(threshold?: number): Promise { + getQueueLogs(threshold?: number): Promise { const apiPath = '/health/queue/logs'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -379,7 +351,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -387,15 +359,13 @@ export class Health { ); } /** - * Get mails queue - * * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueMails(threshold?: number): Promise { + getQueueMails(threshold?: number): Promise { const apiPath = '/health/queue/mails'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -407,7 +377,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -415,15 +385,13 @@ export class Health { ); } /** - * Get messaging queue - * * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueMessaging(threshold?: number): Promise { + getQueueMessaging(threshold?: number): Promise { const apiPath = '/health/queue/messaging'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -435,7 +403,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -443,15 +411,13 @@ export class Health { ); } /** - * Get migrations queue - * * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueMigrations(threshold?: number): Promise { + getQueueMigrations(threshold?: number): Promise { const apiPath = '/health/queue/migrations'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -463,7 +429,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -471,15 +437,13 @@ export class Health { ); } /** - * Get usage queue - * * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueUsage(threshold?: number): Promise { + getQueueUsage(threshold?: number): Promise { const apiPath = '/health/queue/usage'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -491,7 +455,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -499,15 +463,13 @@ export class Health { ); } /** - * Get usage dump queue - * * Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueUsageDump(threshold?: number): Promise { + getQueueUsageDump(threshold?: number): Promise { const apiPath = '/health/queue/usage-dump'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -519,7 +481,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -527,15 +489,13 @@ export class Health { ); } /** - * Get webhooks queue - * * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueWebhooks(threshold?: number): Promise { + getQueueWebhooks(threshold?: number): Promise { const apiPath = '/health/queue/webhooks'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -547,7 +507,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -555,14 +515,12 @@ export class Health { ); } /** - * Get storage - * * Check the Appwrite storage device is up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ - async getStorage(): Promise { + getStorage(): Promise { const apiPath = '/health/storage'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -571,7 +529,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -579,14 +537,12 @@ export class Health { ); } /** - * Get local storage - * * Check the Appwrite local storage device is up and connection is successful. * * @throws {AppwriteException} * @returns {Promise} */ - async getStorageLocal(): Promise { + getStorageLocal(): Promise { const apiPath = '/health/storage/local'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -595,7 +551,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -603,14 +559,12 @@ export class Health { ); } /** - * Get time - * * Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. * * @throws {AppwriteException} * @returns {Promise} */ - async getTime(): Promise { + getTime(): Promise { const apiPath = '/health/time'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -619,7 +573,7 @@ export class Health { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, diff --git a/src/services/locale.ts b/src/services/locale.ts index c59818d..d6e0525 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -9,8 +9,6 @@ export class Locale { } /** - * Get user 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)) @@ -18,7 +16,7 @@ export class Locale { * @throws {AppwriteException} * @returns {Promise} */ - async get(): Promise { + get(): Promise { const apiPath = '/locale'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -27,7 +25,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -35,14 +33,12 @@ export class Locale { ); } /** - * List locale codes - * * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). * * @throws {AppwriteException} * @returns {Promise} */ - async listCodes(): Promise { + listCodes(): Promise { const apiPath = '/locale/codes'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -51,7 +47,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -59,14 +55,12 @@ export class Locale { ); } /** - * List continents - * * List of all continents. You can use the locale header to get the data in a supported language. * * @throws {AppwriteException} * @returns {Promise} */ - async listContinents(): Promise { + listContinents(): Promise { const apiPath = '/locale/continents'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -75,7 +69,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -83,14 +77,12 @@ export class Locale { ); } /** - * List countries - * * List of all countries. You can use the locale header to get the data in a supported language. * * @throws {AppwriteException} * @returns {Promise} */ - async listCountries(): Promise { + listCountries(): Promise { const apiPath = '/locale/countries'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -99,7 +91,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -107,14 +99,12 @@ export class Locale { ); } /** - * List EU countries - * * 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. * * @throws {AppwriteException} * @returns {Promise} */ - async listCountriesEU(): Promise { + listCountriesEU(): Promise { const apiPath = '/locale/countries/eu'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -123,7 +113,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -131,14 +121,12 @@ export class Locale { ); } /** - * List countries phone codes - * * List of all countries phone codes. You can use the locale header to get the data in a supported language. * * @throws {AppwriteException} * @returns {Promise} */ - async listCountriesPhones(): Promise { + listCountriesPhones(): Promise { const apiPath = '/locale/countries/phones'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -147,7 +135,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -155,14 +143,12 @@ export class Locale { ); } /** - * List currencies - * * 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. * * @throws {AppwriteException} * @returns {Promise} */ - async listCurrencies(): Promise { + listCurrencies(): Promise { const apiPath = '/locale/currencies'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -171,7 +157,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -179,14 +165,12 @@ export class Locale { ); } /** - * List languages - * * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. * * @throws {AppwriteException} * @returns {Promise} */ - async listLanguages(): Promise { + listLanguages(): Promise { const apiPath = '/locale/languages'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -195,7 +179,7 @@ export class Locale { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, diff --git a/src/services/messaging.ts b/src/services/messaging.ts index e076318..e86a015 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -11,8 +11,6 @@ export class Messaging { } /** - * List messages - * * Get a list of all messages from the current Appwrite project. * * @param {string[]} queries @@ -20,7 +18,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listMessages(queries?: string[], search?: string): Promise { + listMessages(queries?: string[], search?: string): Promise { const apiPath = '/messaging/messages'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -35,7 +33,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -43,8 +41,6 @@ export class Messaging { ); } /** - * Create email - * * Create a new email message. * * @param {string} messageId @@ -62,7 +58,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise { + createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -116,7 +112,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -124,9 +120,7 @@ export class Messaging { ); } /** - * Update email - * - * Update an email message by its unique ID. + * 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 @@ -144,7 +138,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise { + updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -189,7 +183,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -197,8 +191,6 @@ export class Messaging { ); } /** - * Create push notification - * * Create a new push notification. * * @param {string} messageId @@ -223,7 +215,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createPush(messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise { + createPush(messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -292,7 +284,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -300,9 +292,7 @@ export class Messaging { ); } /** - * Update push notification - * - * Update a push notification by its unique ID. + * 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 @@ -327,7 +317,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise { + updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -393,7 +383,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -401,8 +391,6 @@ export class Messaging { ); } /** - * Create SMS - * * Create a new SMS message. * * @param {string} messageId @@ -415,7 +403,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createSms(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise { + createSms(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -451,7 +439,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -459,9 +447,7 @@ export class Messaging { ); } /** - * Update SMS - * - * Update an SMS message by its unique ID. + * 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 @@ -474,7 +460,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateSms(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise { + updateSms(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -504,7 +490,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -512,8 +498,6 @@ export class Messaging { ); } /** - * Get message - * * Get a message by its unique ID. * @@ -521,7 +505,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async getMessage(messageId: string): Promise { + getMessage(messageId: string): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -533,7 +517,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -541,15 +525,13 @@ export class Messaging { ); } /** - * Delete message - * * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. * * @param {string} messageId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async delete(messageId: string): Promise<{}> { + delete(messageId: string): Promise<{}> { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -561,7 +543,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -569,8 +551,6 @@ export class Messaging { ); } /** - * List message logs - * * Get the message activity logs listed by its unique ID. * * @param {string} messageId @@ -578,7 +558,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listMessageLogs(messageId: string, queries?: string[]): Promise { + listMessageLogs(messageId: string, queries?: string[]): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -593,7 +573,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -601,8 +581,6 @@ export class Messaging { ); } /** - * List message targets - * * Get a list of the targets associated with a message. * * @param {string} messageId @@ -610,7 +588,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listTargets(messageId: string, queries?: string[]): Promise { + listTargets(messageId: string, queries?: string[]): Promise { if (typeof messageId === 'undefined') { throw new AppwriteException('Missing required parameter: "messageId"'); } @@ -625,7 +603,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -633,8 +611,6 @@ export class Messaging { ); } /** - * List providers - * * Get a list of all providers from the current Appwrite project. * * @param {string[]} queries @@ -642,7 +618,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listProviders(queries?: string[], search?: string): Promise { + listProviders(queries?: string[], search?: string): Promise { const apiPath = '/messaging/providers'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -657,7 +633,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -665,8 +641,6 @@ export class Messaging { ); } /** - * Create APNS provider - * * Create a new Apple Push Notification service provider. * * @param {string} providerId @@ -680,7 +654,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createApnsProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise { + createApnsProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -719,7 +693,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -727,8 +701,6 @@ export class Messaging { ); } /** - * Update APNS provider - * * Update a Apple Push Notification service provider by its unique ID. * * @param {string} providerId @@ -742,7 +714,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateApnsProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise { + updateApnsProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -775,7 +747,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -783,8 +755,6 @@ export class Messaging { ); } /** - * Create FCM provider - * * Create a new Firebase Cloud Messaging provider. * * @param {string} providerId @@ -794,7 +764,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise { + createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -821,7 +791,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -829,8 +799,6 @@ export class Messaging { ); } /** - * Update FCM provider - * * Update a Firebase Cloud Messaging provider by its unique ID. * * @param {string} providerId @@ -840,7 +808,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateFcmProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise { + updateFcmProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -861,7 +829,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -869,8 +837,6 @@ export class Messaging { ); } /** - * Create Mailgun provider - * * Create a new Mailgun provider. * * @param {string} providerId @@ -886,7 +852,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createMailgunProvider(providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { + createMailgunProvider(providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -931,7 +897,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -939,8 +905,6 @@ export class Messaging { ); } /** - * Update Mailgun provider - * * Update a Mailgun provider by its unique ID. * * @param {string} providerId @@ -956,7 +920,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateMailgunProvider(providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise { + updateMailgunProvider(providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -995,7 +959,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1003,8 +967,6 @@ export class Messaging { ); } /** - * Create Msg91 provider - * * Create a new MSG91 provider. * * @param {string} providerId @@ -1016,7 +978,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise { + createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1049,7 +1011,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1057,8 +1019,6 @@ export class Messaging { ); } /** - * Update Msg91 provider - * * Update a MSG91 provider by its unique ID. * * @param {string} providerId @@ -1070,7 +1030,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise { + updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1097,7 +1057,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1105,8 +1065,6 @@ export class Messaging { ); } /** - * Create Sendgrid provider - * * Create a new Sendgrid provider. * * @param {string} providerId @@ -1120,7 +1078,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createSendgridProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { + createSendgridProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1159,7 +1117,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1167,8 +1125,6 @@ export class Messaging { ); } /** - * Update Sendgrid provider - * * Update a Sendgrid provider by its unique ID. * * @param {string} providerId @@ -1182,7 +1138,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateSendgridProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise { + updateSendgridProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1215,7 +1171,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1223,8 +1179,6 @@ export class Messaging { ); } /** - * Create SMTP provider - * * Create a new SMTP provider. * * @param {string} providerId @@ -1244,7 +1198,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createSmtpProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { + createSmtpProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1304,7 +1258,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1312,8 +1266,6 @@ export class Messaging { ); } /** - * Update SMTP provider - * * Update a SMTP provider by its unique ID. * * @param {string} providerId @@ -1333,7 +1285,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateSmtpProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { + updateSmtpProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1384,7 +1336,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1392,8 +1344,6 @@ export class Messaging { ); } /** - * Create Telesign provider - * * Create a new Telesign provider. * * @param {string} providerId @@ -1405,7 +1355,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createTelesignProvider(providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise { + createTelesignProvider(providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1438,7 +1388,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1446,8 +1396,6 @@ export class Messaging { ); } /** - * Update Telesign provider - * * Update a Telesign provider by its unique ID. * * @param {string} providerId @@ -1459,7 +1407,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateTelesignProvider(providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise { + updateTelesignProvider(providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1486,7 +1434,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1494,8 +1442,6 @@ export class Messaging { ); } /** - * Create Textmagic provider - * * Create a new Textmagic provider. * * @param {string} providerId @@ -1507,7 +1453,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createTextmagicProvider(providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise { + createTextmagicProvider(providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1540,7 +1486,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1548,8 +1494,6 @@ export class Messaging { ); } /** - * Update Textmagic provider - * * Update a Textmagic provider by its unique ID. * * @param {string} providerId @@ -1561,7 +1505,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateTextmagicProvider(providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise { + updateTextmagicProvider(providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1588,7 +1532,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1596,8 +1540,6 @@ export class Messaging { ); } /** - * Create Twilio provider - * * Create a new Twilio provider. * * @param {string} providerId @@ -1609,7 +1551,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createTwilioProvider(providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise { + createTwilioProvider(providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1642,7 +1584,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1650,8 +1592,6 @@ export class Messaging { ); } /** - * Update Twilio provider - * * Update a Twilio provider by its unique ID. * * @param {string} providerId @@ -1663,7 +1603,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateTwilioProvider(providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise { + updateTwilioProvider(providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1690,7 +1630,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1698,8 +1638,6 @@ export class Messaging { ); } /** - * Create Vonage provider - * * Create a new Vonage provider. * * @param {string} providerId @@ -1711,7 +1649,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createVonageProvider(providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise { + createVonageProvider(providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1744,7 +1682,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1752,8 +1690,6 @@ export class Messaging { ); } /** - * Update Vonage provider - * * Update a Vonage provider by its unique ID. * * @param {string} providerId @@ -1765,7 +1701,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateVonageProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise { + updateVonageProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1792,7 +1728,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1800,8 +1736,6 @@ export class Messaging { ); } /** - * Get provider - * * Get a provider by its unique ID. * @@ -1809,7 +1743,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async getProvider(providerId: string): Promise { + getProvider(providerId: string): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1821,7 +1755,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1829,15 +1763,13 @@ export class Messaging { ); } /** - * Delete provider - * * Delete a provider by its unique ID. * * @param {string} providerId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteProvider(providerId: string): Promise<{}> { + deleteProvider(providerId: string): Promise<{}> { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1849,7 +1781,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -1857,8 +1789,6 @@ export class Messaging { ); } /** - * List provider logs - * * Get the provider activity logs listed by its unique ID. * * @param {string} providerId @@ -1866,7 +1796,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listProviderLogs(providerId: string, queries?: string[]): Promise { + listProviderLogs(providerId: string, queries?: string[]): Promise { if (typeof providerId === 'undefined') { throw new AppwriteException('Missing required parameter: "providerId"'); } @@ -1881,7 +1811,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1889,8 +1819,6 @@ export class Messaging { ); } /** - * List subscriber logs - * * Get the subscriber activity logs listed by its unique ID. * * @param {string} subscriberId @@ -1898,7 +1826,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listSubscriberLogs(subscriberId: string, queries?: string[]): Promise { + listSubscriberLogs(subscriberId: string, queries?: string[]): Promise { if (typeof subscriberId === 'undefined') { throw new AppwriteException('Missing required parameter: "subscriberId"'); } @@ -1913,7 +1841,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1921,8 +1849,6 @@ export class Messaging { ); } /** - * List topics - * * Get a list of all topics from the current Appwrite project. * * @param {string[]} queries @@ -1930,7 +1856,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listTopics(queries?: string[], search?: string): Promise { + listTopics(queries?: string[], search?: string): Promise { const apiPath = '/messaging/topics'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -1945,7 +1871,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1953,8 +1879,6 @@ export class Messaging { ); } /** - * Create topic - * * Create a new topic. * * @param {string} topicId @@ -1963,7 +1887,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createTopic(topicId: string, name: string, subscribe?: string[]): Promise { + createTopic(topicId: string, name: string, subscribe?: string[]): Promise { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -1987,7 +1911,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1995,8 +1919,6 @@ export class Messaging { ); } /** - * Get topic - * * Get a topic by its unique ID. * @@ -2004,7 +1926,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async getTopic(topicId: string): Promise { + getTopic(topicId: string): Promise { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2016,7 +1938,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -2024,8 +1946,6 @@ export class Messaging { ); } /** - * Update topic - * * Update a topic by its unique ID. * @@ -2035,7 +1955,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async updateTopic(topicId: string, name?: string, subscribe?: string[]): Promise { + updateTopic(topicId: string, name?: string, subscribe?: string[]): Promise { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2053,7 +1973,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -2061,15 +1981,13 @@ export class Messaging { ); } /** - * Delete topic - * * Delete a topic by its unique ID. * * @param {string} topicId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteTopic(topicId: string): Promise<{}> { + deleteTopic(topicId: string): Promise<{}> { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2081,7 +1999,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -2089,8 +2007,6 @@ export class Messaging { ); } /** - * List topic logs - * * Get the topic activity logs listed by its unique ID. * * @param {string} topicId @@ -2098,7 +2014,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listTopicLogs(topicId: string, queries?: string[]): Promise { + listTopicLogs(topicId: string, queries?: string[]): Promise { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2113,7 +2029,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -2121,8 +2037,6 @@ export class Messaging { ); } /** - * List subscribers - * * Get a list of all subscribers from the current Appwrite project. * * @param {string} topicId @@ -2131,7 +2045,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async listSubscribers(topicId: string, queries?: string[], search?: string): Promise { + listSubscribers(topicId: string, queries?: string[], search?: string): Promise { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2149,7 +2063,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -2157,8 +2071,6 @@ export class Messaging { ); } /** - * Create subscriber - * * Create a new subscriber. * * @param {string} topicId @@ -2167,7 +2079,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise { + createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2191,7 +2103,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -2199,8 +2111,6 @@ export class Messaging { ); } /** - * Get subscriber - * * Get a subscriber by its unique ID. * @@ -2209,7 +2119,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise} */ - async getSubscriber(topicId: string, subscriberId: string): Promise { + getSubscriber(topicId: string, subscriberId: string): Promise { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2224,7 +2134,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -2232,8 +2142,6 @@ export class Messaging { ); } /** - * Delete subscriber - * * Delete a subscriber by its unique ID. * * @param {string} topicId @@ -2241,7 +2149,7 @@ export class Messaging { * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteSubscriber(topicId: string, subscriberId: string): Promise<{}> { + deleteSubscriber(topicId: string, subscriberId: string): Promise<{}> { if (typeof topicId === 'undefined') { throw new AppwriteException('Missing required parameter: "topicId"'); } @@ -2256,7 +2164,7 @@ export class Messaging { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, diff --git a/src/services/storage.ts b/src/services/storage.ts index 923dda4..9015be4 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -12,8 +12,6 @@ export class Storage { } /** - * List buckets - * * Get a list of all the storage buckets. You can use the query params to filter your results. * * @param {string[]} queries @@ -21,7 +19,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - async listBuckets(queries?: string[], search?: string): Promise { + listBuckets(queries?: string[], search?: string): Promise { const apiPath = '/storage/buckets'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -36,7 +34,7 @@ export class Storage { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -44,8 +42,6 @@ export class Storage { ); } /** - * Create bucket - * * Create a new storage bucket. * * @param {string} bucketId @@ -61,7 +57,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - async createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise { + createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -106,7 +102,7 @@ export class Storage { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -114,15 +110,13 @@ export class Storage { ); } /** - * Get bucket - * * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. * * @param {string} bucketId * @throws {AppwriteException} * @returns {Promise} */ - async getBucket(bucketId: string): Promise { + getBucket(bucketId: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -134,7 +128,7 @@ export class Storage { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -142,8 +136,6 @@ export class Storage { ); } /** - * Update bucket - * * Update a storage bucket by its unique ID. * * @param {string} bucketId @@ -159,7 +151,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - async updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise { + updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -201,7 +193,7 @@ export class Storage { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -209,15 +201,13 @@ export class Storage { ); } /** - * Delete bucket - * * Delete a storage bucket by its unique ID. * * @param {string} bucketId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteBucket(bucketId: string): Promise<{}> { + deleteBucket(bucketId: string): Promise<{}> { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -229,7 +219,7 @@ export class Storage { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -237,8 +227,6 @@ export class Storage { ); } /** - * List files - * * Get a list of all the user files. You can use the query params to filter your results. * * @param {string} bucketId @@ -247,7 +235,7 @@ export class Storage { * @throws {AppwriteException} * @returns {Promise} */ - async listFiles(bucketId: string, queries?: string[], search?: string): Promise { + listFiles(bucketId: string, queries?: string[], search?: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -265,7 +253,7 @@ export class Storage { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -273,8 +261,6 @@ export class Storage { ); } /** - * Create file - * * 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. @@ -291,7 +277,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk * @throws {AppwriteException} * @returns {Promise} */ - async createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress = (progress: UploadProgress) => {}): Promise { + createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress = (progress: UploadProgress) => {}): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -318,7 +304,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'content-type': 'multipart/form-data', } - return await this.client.chunkedUpload( + return this.client.chunkedUpload( 'post', uri, apiHeaders, @@ -327,8 +313,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk ); } /** - * Get file - * * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. * * @param {string} bucketId @@ -336,7 +320,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk * @throws {AppwriteException} * @returns {Promise} */ - async getFile(bucketId: string, fileId: string): Promise { + getFile(bucketId: string, fileId: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -351,7 +335,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -359,8 +343,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk ); } /** - * Update file - * * Update a file by its unique ID. Only users with write permissions have access to update this resource. * * @param {string} bucketId @@ -370,7 +352,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk * @throws {AppwriteException} * @returns {Promise} */ - async updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise { + updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -391,7 +373,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -399,8 +381,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk ); } /** - * Delete file - * * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. * * @param {string} bucketId @@ -408,7 +388,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteFile(bucketId: string, fileId: string): Promise<{}> { + deleteFile(bucketId: string, fileId: string): Promise<{}> { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -423,7 +403,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -431,8 +411,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk ); } /** - * Get file for download - * * 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. * * @param {string} bucketId @@ -440,7 +418,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk * @throws {AppwriteException} * @returns {Promise} */ - async getFileDownload(bucketId: string, fileId: string): Promise { + getFileDownload(bucketId: string, fileId: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -455,7 +433,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -464,8 +442,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk ); } /** - * Get file preview - * * 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. * * @param {string} bucketId @@ -484,7 +460,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk * @throws {AppwriteException} * @returns {Promise} */ - async getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): Promise { + getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -532,7 +508,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -541,8 +517,6 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk ); } /** - * Get file for view - * * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. * * @param {string} bucketId @@ -550,7 +524,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk * @throws {AppwriteException} * @returns {Promise} */ - async getFileView(bucketId: string, fileId: string): Promise { + getFileView(bucketId: string, fileId: string): Promise { if (typeof bucketId === 'undefined') { throw new AppwriteException('Missing required parameter: "bucketId"'); } @@ -565,7 +539,7 @@ If you're creating a new file using one of the Appwrite SDKs, all the chunk 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, diff --git a/src/services/teams.ts b/src/services/teams.ts index 3911e30..172ed06 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -9,8 +9,6 @@ export class Teams { } /** - * List teams - * * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. * * @param {string[]} queries @@ -18,7 +16,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - async list(queries?: string[], search?: string): Promise> { + list(queries?: string[], search?: string): Promise> { const apiPath = '/teams'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -33,7 +31,7 @@ export class Teams { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -41,8 +39,6 @@ export class Teams { ); } /** - * Create team - * * 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. * * @param {string} teamId @@ -51,7 +47,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -75,7 +71,7 @@ export class Teams { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -83,15 +79,13 @@ export class Teams { ); } /** - * Get team - * * Get a team by its ID. All team members have read access for this resource. * * @param {string} teamId * @throws {AppwriteException} * @returns {Promise>} */ - async get(teamId: string): Promise> { + get(teamId: string): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -103,7 +97,7 @@ export class Teams { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -111,8 +105,6 @@ export class Teams { ); } /** - * Update name - * * Update the team's name by its unique ID. * * @param {string} teamId @@ -120,7 +112,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise>} */ - async updateName(teamId: string, name: string): Promise> { + updateName(teamId: string, name: string): Promise> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -138,7 +130,7 @@ export class Teams { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -146,15 +138,13 @@ export class Teams { ); } /** - * Delete team - * * Delete a team using its ID. Only team members with the owner role can delete the team. * * @param {string} teamId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async delete(teamId: string): Promise<{}> { + delete(teamId: string): Promise<{}> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -166,7 +156,7 @@ export class Teams { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -174,8 +164,6 @@ export class Teams { ); } /** - * List team memberships - * * 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. * * @param {string} teamId @@ -184,7 +172,7 @@ export class Teams { * @throws {AppwriteException} * @returns {Promise} */ - async listMemberships(teamId: string, queries?: string[], search?: string): Promise { + listMemberships(teamId: string, queries?: string[], search?: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -202,7 +190,7 @@ export class Teams { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -210,8 +198,6 @@ export class Teams { ); } /** - * Create team membership - * * 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. @@ -231,7 +217,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee * @throws {AppwriteException} * @returns {Promise} */ - async createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise { + createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -264,7 +250,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -272,8 +258,6 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee ); } /** - * Get team membership - * * 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. * * @param {string} teamId @@ -281,7 +265,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee * @throws {AppwriteException} * @returns {Promise} */ - async getMembership(teamId: string, membershipId: string): Promise { + getMembership(teamId: string, membershipId: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -296,7 +280,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -304,8 +288,6 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee ); } /** - * Update membership - * * 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). * @@ -315,7 +297,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee * @throws {AppwriteException} * @returns {Promise} */ - async updateMembership(teamId: string, membershipId: string, roles: string[]): Promise { + updateMembership(teamId: string, membershipId: string, roles: string[]): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -336,7 +318,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -344,8 +326,6 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee ); } /** - * Delete team membership - * * 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. * * @param {string} teamId @@ -353,7 +333,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteMembership(teamId: string, membershipId: string): Promise<{}> { + deleteMembership(teamId: string, membershipId: string): Promise<{}> { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -368,7 +348,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -376,8 +356,6 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee ); } /** - * Update team membership status - * * 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. @@ -390,7 +368,7 @@ If the request is successful, a session for the user is automatically created. * @throws {AppwriteException} * @returns {Promise} */ - async updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise { + updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -417,7 +395,7 @@ If the request is successful, a session for the user is automatically created. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -425,15 +403,13 @@ If the request is successful, a session for the user is automatically created. ); } /** - * Get team preferences - * * 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). * * @param {string} teamId * @throws {AppwriteException} * @returns {Promise} */ - async getPrefs(teamId: string): Promise { + getPrefs(teamId: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -445,7 +421,7 @@ If the request is successful, a session for the user is automatically created. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -453,8 +429,6 @@ If the request is successful, a session for the user is automatically created. ); } /** - * Update preferences - * * 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. * * @param {string} teamId @@ -462,7 +436,7 @@ If the request is successful, a session for the user is automatically created. * @throws {AppwriteException} * @returns {Promise} */ - async updatePrefs(teamId: string, prefs: object): Promise { + updatePrefs(teamId: string, prefs: object): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); } @@ -480,7 +454,7 @@ If the request is successful, a session for the user is automatically created. 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, diff --git a/src/services/users.ts b/src/services/users.ts index f47662f..543f66d 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -12,8 +12,6 @@ export class Users { } /** - * List users - * * Get a list of all the project's users. You can use the query params to filter your results. * * @param {string[]} queries @@ -21,7 +19,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async list(queries?: string[], search?: string): Promise> { + list(queries?: string[], search?: string): Promise> { const apiPath = '/users'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -36,7 +34,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -44,8 +42,6 @@ export class Users { ); } /** - * Create user - * * Create a new user. * * @param {string} userId @@ -56,7 +52,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -83,7 +79,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -91,8 +87,6 @@ export class Users { ); } /** - * Create user with Argon2 password - * * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * * @param {string} userId @@ -102,7 +96,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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,7 +126,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -140,8 +134,6 @@ export class Users { ); } /** - * Create user with bcrypt password - * * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * * @param {string} userId @@ -151,7 +143,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -181,7 +173,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -189,8 +181,6 @@ export class Users { ); } /** - * List identities - * * Get identities for all users. * * @param {string[]} queries @@ -198,7 +188,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - async listIdentities(queries?: string[], search?: string): Promise { + listIdentities(queries?: string[], search?: string): Promise { const apiPath = '/users/identities'; const payload: Payload = {}; if (typeof queries !== 'undefined') { @@ -213,7 +203,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -221,15 +211,13 @@ export class Users { ); } /** - * Delete identity - * * Delete an identity by its unique ID. * * @param {string} identityId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteIdentity(identityId: string): Promise<{}> { + deleteIdentity(identityId: string): Promise<{}> { if (typeof identityId === 'undefined') { throw new AppwriteException('Missing required parameter: "identityId"'); } @@ -241,7 +229,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -249,8 +237,6 @@ export class Users { ); } /** - * Create user with MD5 password - * * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * * @param {string} userId @@ -260,7 +246,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -290,7 +276,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -298,8 +284,6 @@ export class Users { ); } /** - * Create user with PHPass password - * * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * * @param {string} userId @@ -309,7 +293,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -339,7 +323,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -347,8 +331,6 @@ export class Users { ); } /** - * Create user with Scrypt password - * * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * * @param {string} userId @@ -363,7 +345,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -423,7 +405,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -431,8 +413,6 @@ export class Users { ); } /** - * Create user with Scrypt modified password - * * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * * @param {string} userId @@ -445,7 +425,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -493,7 +473,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -501,8 +481,6 @@ export class Users { ); } /** - * Create user with SHA password - * * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. * * @param {string} userId @@ -513,7 +491,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async 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"'); } @@ -546,7 +524,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -554,15 +532,13 @@ export class Users { ); } /** - * Get user - * * Get a user by its unique ID. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise>} */ - async get(userId: string): Promise> { + get(userId: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -574,7 +550,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -582,15 +558,13 @@ export class Users { ); } /** - * Delete user - * * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async delete(userId: string): Promise<{}> { + delete(userId: string): Promise<{}> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -602,7 +576,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -610,8 +584,6 @@ export class Users { ); } /** - * Update email - * * Update the user email by its unique ID. * * @param {string} userId @@ -619,7 +591,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise>} */ - async updateEmail(userId: string, email: string): Promise> { + updateEmail(userId: string, email: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -637,7 +609,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -645,8 +617,6 @@ export class Users { ); } /** - * Create user JWT - * * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. * * @param {string} userId @@ -655,7 +625,7 @@ export class Users { * @throws {AppwriteException} * @returns {Promise} */ - async createJWT(userId: string, sessionId?: string, duration?: number): Promise { + createJWT(userId: string, sessionId?: string, duration?: number): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -673,7 +643,7 @@ export class Users { 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -681,8 +651,6 @@ export class Users { ); } /** - * Update user labels - * * 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. @@ -692,7 +660,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - async updateLabels(userId: string, labels: string[]): Promise> { + updateLabels(userId: string, labels: string[]): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -710,7 +678,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -718,8 +686,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * List user logs - * * Get the user activity logs list by its unique ID. * * @param {string} userId @@ -727,7 +693,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise} */ - async listLogs(userId: string, queries?: string[]): Promise { + listLogs(userId: string, queries?: string[]): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -742,7 +708,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -750,15 +716,13 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * List user memberships - * * Get the user membership list by its unique ID. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise} */ - async listMemberships(userId: string): Promise { + listMemberships(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -770,7 +734,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -778,8 +742,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Update MFA - * * Enable or disable MFA on a user account. * * @param {string} userId @@ -787,7 +749,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - async updateMfa(userId: string, mfa: boolean): Promise> { + updateMfa(userId: string, mfa: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -805,7 +767,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -813,8 +775,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Delete authenticator - * * Delete an authenticator app. * * @param {string} userId @@ -822,7 +782,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise<{}> { + deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise<{}> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -837,7 +797,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -845,15 +805,13 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * List factors - * * List the factors available on the account to be used as a MFA challange. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise} */ - async listMfaFactors(userId: string): Promise { + listMfaFactors(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -865,7 +823,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -873,15 +831,13 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Get MFA recovery codes - * * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise} */ - async getMfaRecoveryCodes(userId: string): Promise { + getMfaRecoveryCodes(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -893,7 +849,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -901,15 +857,13 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Regenerate MFA recovery codes - * * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise} */ - async updateMfaRecoveryCodes(userId: string): Promise { + updateMfaRecoveryCodes(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -921,7 +875,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'put', uri, apiHeaders, @@ -929,15 +883,13 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Create MFA recovery codes - * * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise} */ - async createMfaRecoveryCodes(userId: string): Promise { + createMfaRecoveryCodes(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -949,7 +901,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -957,8 +909,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Update name - * * Update the user name by its unique ID. * * @param {string} userId @@ -966,7 +916,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - async updateName(userId: string, name: string): Promise> { + updateName(userId: string, name: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -984,7 +934,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -992,8 +942,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Update password - * * Update the user password by its unique ID. * * @param {string} userId @@ -1001,7 +949,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - async updatePassword(userId: string, password: string): Promise> { + updatePassword(userId: string, password: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1019,7 +967,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1027,8 +975,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Update phone - * * Update the user phone by its unique ID. * * @param {string} userId @@ -1036,7 +982,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise>} */ - async updatePhone(userId: string, number: string): Promise> { + updatePhone(userId: string, number: string): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1054,7 +1000,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1062,15 +1008,13 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Get user preferences - * * Get the user preferences by its unique ID. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise} */ - async getPrefs(userId: string): Promise { + getPrefs(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1082,7 +1026,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1090,8 +1034,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Update user preferences - * * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. * * @param {string} userId @@ -1099,7 +1041,7 @@ Labels can be used to grant access to resources. While teams are a way for user& * @throws {AppwriteException} * @returns {Promise} */ - async updatePrefs(userId: string, prefs: object): Promise { + updatePrefs(userId: string, prefs: object): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1117,7 +1059,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1125,15 +1067,13 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * List user sessions - * * Get the user sessions list by its unique ID. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise} */ - async listSessions(userId: string): Promise { + listSessions(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1145,7 +1085,7 @@ Labels can be used to grant access to resources. While teams are a way for user& 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1153,8 +1093,6 @@ Labels can be used to grant access to resources. While teams are a way for user& ); } /** - * Create session - * * Creates a session for a user. Returns an immediately usable session object. If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. @@ -1163,7 +1101,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise} */ - async createSession(userId: string): Promise { + createSession(userId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1175,7 +1113,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1183,15 +1121,13 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Delete user sessions - * * Delete all user's sessions by using the user's unique ID. * * @param {string} userId * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteSessions(userId: string): Promise<{}> { + deleteSessions(userId: string): Promise<{}> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1203,7 +1139,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -1211,8 +1147,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Delete user session - * * Delete a user sessions by its unique ID. * * @param {string} userId @@ -1220,7 +1154,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteSession(userId: string, sessionId: string): Promise<{}> { + deleteSession(userId: string, sessionId: string): Promise<{}> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1235,7 +1169,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -1243,8 +1177,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Update user status - * * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. * * @param {string} userId @@ -1252,7 +1184,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - async updateStatus(userId: string, status: boolean): Promise> { + updateStatus(userId: string, status: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1270,7 +1202,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1278,8 +1210,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * List user targets - * * List the messaging targets that are associated with a user. * * @param {string} userId @@ -1287,7 +1217,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise} */ - async listTargets(userId: string, queries?: string[]): Promise { + listTargets(userId: string, queries?: string[]): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1302,7 +1232,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1310,8 +1240,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Create user target - * * Create a messaging target. * * @param {string} userId @@ -1323,7 +1251,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise} */ - async createTarget(userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string): Promise { + createTarget(userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1359,7 +1287,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1367,8 +1295,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Get user target - * * Get a user's push notification target by ID. * * @param {string} userId @@ -1376,7 +1302,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise} */ - async getTarget(userId: string, targetId: string): Promise { + getTarget(userId: string, targetId: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1391,7 +1317,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'get', uri, apiHeaders, @@ -1399,8 +1325,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Update user target - * * Update a messaging target. * * @param {string} userId @@ -1411,7 +1335,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise} */ - async updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise { + updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1435,7 +1359,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1443,8 +1367,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Delete user target - * * Delete a messaging target. * * @param {string} userId @@ -1452,7 +1374,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteTarget(userId: string, targetId: string): Promise<{}> { + deleteTarget(userId: string, targetId: string): Promise<{}> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1467,7 +1389,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'delete', uri, apiHeaders, @@ -1475,8 +1397,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Create token - * * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. * @@ -1486,7 +1406,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise} */ - async createToken(userId: string, length?: number, expire?: number): Promise { + createToken(userId: string, length?: number, expire?: number): Promise { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1504,7 +1424,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'post', uri, apiHeaders, @@ -1512,8 +1432,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Update email verification - * * Update the user email verification status by its unique ID. * * @param {string} userId @@ -1521,7 +1439,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - async updateEmailVerification(userId: string, emailVerification: boolean): Promise> { + updateEmailVerification(userId: string, emailVerification: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1539,7 +1457,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders, @@ -1547,8 +1465,6 @@ If you want to generate a token for a custom authentication flow, use the [POST ); } /** - * Update phone verification - * * Update the user phone verification status by its unique ID. * * @param {string} userId @@ -1556,7 +1472,7 @@ If you want to generate a token for a custom authentication flow, use the [POST * @throws {AppwriteException} * @returns {Promise>} */ - async updatePhoneVerification(userId: string, phoneVerification: boolean): Promise> { + updatePhoneVerification(userId: string, phoneVerification: boolean): Promise> { if (typeof userId === 'undefined') { throw new AppwriteException('Missing required parameter: "userId"'); } @@ -1574,7 +1490,7 @@ If you want to generate a token for a custom authentication flow, use the [POST 'content-type': 'application/json', } - return await this.client.call( + return this.client.call( 'patch', uri, apiHeaders,