diff --git a/README.md b/README.md index dd73a52..f6901ca 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Deno SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-deno.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.6.2-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index fef0c8c..9511a68 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -12,8 +12,8 @@ const response = await databases.updateFloatAttribute( '', // collectionId '', // key false, // required - null, // min - null, // max null, // default + null, // min (optional) + null, // max (optional) '' // newKey (optional) ); diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 18db8dd..92aed87 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -12,8 +12,8 @@ const response = await databases.updateIntegerAttribute( '', // collectionId '', // key false, // required - null, // min - null, // max null, // default + null, // min (optional) + null, // max (optional) '' // newKey (optional) ); diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-stats-resources.md similarity index 86% rename from docs/examples/health/get-queue-usage-dump.md rename to docs/examples/health/get-queue-stats-resources.md index 5103b03..03f48be 100644 --- a/docs/examples/health/get-queue-usage-dump.md +++ b/docs/examples/health/get-queue-stats-resources.md @@ -7,6 +7,6 @@ const client = new Client() const health = new Health(client); -const response = await health.getQueueUsageDump( +const response = await health.getQueueStatsResources( null // threshold (optional) ); diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md deleted file mode 100644 index 078993c..0000000 --- a/docs/examples/health/get-queue.md +++ /dev/null @@ -1,10 +0,0 @@ -import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new Health(client); - -const response = await health.getQueue(); diff --git a/src/client.ts b/src/client.ts index e92ddea..2c8f81d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,11 +11,11 @@ export class Client { endpoint: string = 'https://cloud.appwrite.io/v1'; headers: Payload = { 'content-type': '', - 'user-agent' : `AppwriteDenoSDK/13.0.0 (${Deno.build.os}; ${Deno.build.arch})`, + 'user-agent' : `AppwriteDenoSDK/14.0.0 (${Deno.build.os}; ${Deno.build.arch})`, 'x-sdk-name': 'Deno', 'x-sdk-platform': 'server', 'x-sdk-language': 'deno', - 'x-sdk-version': '13.0.0', + 'x-sdk-version': '14.0.0', 'X-Appwrite-Response-Format':'1.6.0', }; @@ -113,8 +113,11 @@ export class Client { * @return this */ setEndpoint(endpoint: string): this { - this.endpoint = endpoint; + if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) { + throw new AppwriteException('Invalid endpoint URL: ' + endpoint); + } + this.endpoint = endpoint; return this; } @@ -180,7 +183,7 @@ export class Client { } catch (error) { throw new AppwriteException(text, response.status, "", text); } - throw new AppwriteException(json.message, json.code, json.type, json); + throw new AppwriteException(json.message, json.code, json.type, text); } if (responseType === "arraybuffer") { diff --git a/src/enums/credit-card.ts b/src/enums/credit-card.ts index daf43c7..a96c73a 100644 --- a/src/enums/credit-card.ts +++ b/src/enums/credit-card.ts @@ -15,4 +15,5 @@ export enum CreditCard { Visa = 'visa', MIR = 'mir', Maestro = 'maestro', + Rupay = 'rupay', } \ No newline at end of file diff --git a/src/enums/name.ts b/src/enums/name.ts index 3db84e8..91a14e0 100644 --- a/src/enums/name.ts +++ b/src/enums/name.ts @@ -4,8 +4,8 @@ export enum Name { V1Audits = 'v1-audits', V1Mails = 'v1-mails', V1Functions = 'v1-functions', - V1Usage = 'v1-usage', - V1UsageDump = 'v1-usage-dump', + V1StatsResources = 'v1-stats-resources', + V1StatsUsage = 'v1-stats-usage', V1Webhooks = 'v1-webhooks', V1Certificates = 'v1-certificates', V1Builds = 'v1-builds', diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index b2bf4d1..7a3fcb3 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -13,6 +13,7 @@ export enum OAuthProvider { Dropbox = 'dropbox', Etsy = 'etsy', Facebook = 'facebook', + Figma = 'figma', Github = 'github', Gitlab = 'gitlab', Google = 'google', diff --git a/src/services/account.ts b/src/services/account.ts index ea409e2..8969794 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -25,8 +25,6 @@ export class Account extends Service { } /** - * Get account - * * Get the currently logged in user. * * @throws {AppwriteException} @@ -40,15 +38,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -103,8 +98,6 @@ export class Account extends Service { ); } /** - * 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 @@ -148,8 +141,6 @@ export class Account extends Service { ); } /** - * List identities - * * Get the list of identities for the currently logged in user. * * @param {string[]} queries @@ -168,15 +159,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete identity - * * Delete an identity by its unique ID. * * @param {string} identityId @@ -202,8 +190,6 @@ export class Account extends Service { ); } /** - * 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 @@ -228,8 +214,6 @@ export class Account extends Service { ); } /** - * 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. * @@ -249,15 +233,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update MFA - * * Enable or disable MFA on an account. * * @param {boolean} mfa @@ -286,8 +267,6 @@ export class Account extends Service { ); } /** - * 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) @@ -316,8 +295,6 @@ export class Account extends Service { ); } /** - * Verify authenticator - * * Verify an authenticator app after adding it using the [add * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) * method. @@ -353,8 +330,6 @@ export class Account extends Service { ); } /** - * Delete authenticator - * * Delete an authenticator for a user by ID. * * @param {AuthenticatorType} type @@ -380,8 +355,6 @@ export class Account extends Service { ); } /** - * 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. @@ -412,8 +385,6 @@ export class Account extends Service { ); } /** - * 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 @@ -454,8 +425,6 @@ export class Account extends Service { ); } /** - * List factors - * * List the factors available on the account to be used as a MFA challange. * * @throws {AppwriteException} @@ -469,15 +438,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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) @@ -494,15 +460,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -527,8 +490,6 @@ export class Account extends Service { ); } /** - * 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) @@ -552,8 +513,6 @@ export class Account extends Service { ); } /** - * Update name - * * Update currently logged in user account name. * * @param {string} name @@ -582,8 +541,6 @@ export class Account extends Service { ); } /** - * 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. @@ -618,8 +575,6 @@ export class Account extends Service { ); } /** - * 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 @@ -660,8 +615,6 @@ export class Account extends Service { ); } /** - * Get account preferences - * * Get the preferences as a key-value object for the currently logged in user. * * @throws {AppwriteException} @@ -675,15 +628,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -714,8 +664,6 @@ export class Account extends Service { ); } /** - * 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 @@ -759,8 +707,6 @@ export class Account extends Service { ); } /** - * 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 @@ -814,8 +760,6 @@ export class Account extends Service { ); } /** - * List sessions - * * Get the list of active sessions across different devices for the currently * logged in user. * @@ -830,15 +774,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete sessions - * * Delete all sessions from the user account and remove any sessions cookies * from the end client. * @@ -860,8 +801,6 @@ export class Account extends Service { ); } /** - * 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 @@ -888,8 +827,6 @@ export class Account extends Service { ); } /** - * 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. * @@ -931,8 +868,6 @@ export class Account extends Service { ); } /** - * 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. @@ -971,8 +906,6 @@ export class Account extends Service { ); } /** - * 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. @@ -1011,8 +944,6 @@ export class Account extends Service { ); } /** - * 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. @@ -1051,8 +982,6 @@ export class Account extends Service { ); } /** - * 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. * @@ -1072,15 +1001,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -1108,8 +1034,6 @@ export class Account extends Service { ); } /** - * 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 @@ -1139,8 +1063,6 @@ export class Account extends Service { ); } /** - * 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. @@ -1163,8 +1085,6 @@ export class Account extends Service { ); } /** - * 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 @@ -1214,8 +1134,6 @@ export class Account extends Service { ); } /** - * 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 @@ -1273,8 +1191,6 @@ export class Account extends Service { ); } /** - * 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 @@ -1321,15 +1237,12 @@ export class Account extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'location' ); } /** - * 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 @@ -1375,8 +1288,6 @@ export class Account extends Service { ); } /** - * 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 @@ -1419,8 +1330,6 @@ export class Account extends Service { ); } /** - * 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 @@ -1460,8 +1369,6 @@ export class Account extends Service { ); } /** - * 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 @@ -1489,8 +1396,6 @@ export class Account extends Service { ); } /** - * 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 diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 649559f..07f18cf 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -25,8 +25,6 @@ export class Avatars extends Service { } /** - * 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) @@ -69,15 +67,12 @@ export class Avatars extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * 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. @@ -119,15 +114,12 @@ export class Avatars extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * Get favicon - * * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote * website URL. * @@ -153,15 +145,12 @@ export class Avatars extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * 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 @@ -204,15 +193,12 @@ export class Avatars extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * 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 @@ -255,15 +241,12 @@ export class Avatars extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * 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' @@ -312,15 +295,12 @@ export class Avatars extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * 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. * @@ -360,7 +340,6 @@ export class Avatars extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' diff --git a/src/services/databases.ts b/src/services/databases.ts index e85ff9a..24570a3 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -25,8 +25,6 @@ export class Databases extends Service { } /** - * List databases - * * Get a list of all databases from the current Appwrite project. You can use * the search parameter to filter your results. * @@ -51,15 +49,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create database - * * Create a new Database. * * @@ -101,8 +96,6 @@ export class Databases extends Service { ); } /** - * Get database - * * Get a database by its unique ID. This endpoint response returns a JSON * object with the database metadata. * @@ -122,15 +115,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update database - * * Update a database by its unique ID. * * @param {string} databaseId @@ -168,8 +158,6 @@ export class Databases extends Service { ); } /** - * Delete database - * * Delete a database by its unique ID. Only API keys with with databases.write * scope can delete a database. * @@ -196,8 +184,6 @@ export class Databases extends Service { ); } /** - * List collections - * * Get a list of all collections that belong to the provided databaseId. You * can use the search parameter to filter your results. * @@ -227,15 +213,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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) @@ -292,8 +275,6 @@ export class Databases extends Service { ); } /** - * Get collection - * * Get a collection by its unique ID. This endpoint response returns a JSON * object with the collection metadata. * @@ -318,15 +299,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update collection - * * Update a collection by its unique ID. * * @param {string} databaseId @@ -377,8 +355,6 @@ export class Databases extends Service { ); } /** - * Delete collection - * * Delete a collection by its unique ID. Only users with write permissions * have access to delete this resource. * @@ -410,8 +386,6 @@ export class Databases extends Service { ); } /** - * List attributes - * * List attributes in the collection. * * @param {string} databaseId @@ -440,15 +414,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create boolean attribute - * * Create a boolean attribute. * * @@ -504,8 +475,6 @@ export class Databases extends Service { ); } /** - * Update boolean attribute - * * Update a boolean attribute. Changing the `default` value will not update * already existing documents. * @@ -562,8 +531,6 @@ export class Databases extends Service { ); } /** - * Create datetime attribute - * * Create a date time attribute according to the ISO 8601 standard. * * @param {string} databaseId @@ -618,8 +585,6 @@ export class Databases extends Service { ); } /** - * Update dateTime attribute - * * Update a date time attribute. Changing the `default` value will not update * already existing documents. * @@ -676,8 +641,6 @@ export class Databases extends Service { ); } /** - * Create email attribute - * * Create an email attribute. * * @@ -733,8 +696,6 @@ export class Databases extends Service { ); } /** - * Update email attribute - * * Update an email attribute. Changing the `default` value will not update * already existing documents. * @@ -792,8 +753,6 @@ export class Databases extends Service { ); } /** - * Create enum attribute - * * Create an enumeration attribute. The `elements` param acts as a white-list * of accepted values for this attribute. * @@ -858,8 +817,6 @@ export class Databases extends Service { ); } /** - * Update enum attribute - * * Update an enum attribute. Changing the `default` value will not update * already existing documents. * @@ -925,8 +882,6 @@ export class Databases extends Service { ); } /** - * Create float attribute - * * Create a float attribute. Optionally, minimum and maximum values can be * provided. * @@ -991,8 +946,6 @@ export class Databases extends Service { ); } /** - * Update float attribute - * * Update a float attribute. Changing the `default` value will not update * already existing documents. * @@ -1001,14 +954,14 @@ export class Databases extends Service { * @param {string} collectionId * @param {string} key * @param {boolean} required + * @param {number} xdefault * @param {number} min * @param {number} max - * @param {number} xdefault * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { + async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1025,14 +978,6 @@ export class Databases extends Service { throw new AppwriteException('Missing required parameter: "required"'); } - if (typeof min === 'undefined') { - throw new AppwriteException('Missing required parameter: "min"'); - } - - if (typeof max === 'undefined') { - throw new AppwriteException('Missing required parameter: "max"'); - } - if (typeof xdefault === 'undefined') { throw new AppwriteException('Missing required parameter: "xdefault"'); } @@ -1066,8 +1011,6 @@ export class Databases extends Service { ); } /** - * Create integer attribute - * * Create an integer attribute. Optionally, minimum and maximum values can be * provided. * @@ -1132,8 +1075,6 @@ export class Databases extends Service { ); } /** - * Update integer attribute - * * Update an integer attribute. Changing the `default` value will not update * already existing documents. * @@ -1142,14 +1083,14 @@ export class Databases extends Service { * @param {string} collectionId * @param {string} key * @param {boolean} required + * @param {number} xdefault * @param {number} min * @param {number} max - * @param {number} xdefault * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { + async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1166,14 +1107,6 @@ export class Databases extends Service { throw new AppwriteException('Missing required parameter: "required"'); } - if (typeof min === 'undefined') { - throw new AppwriteException('Missing required parameter: "min"'); - } - - if (typeof max === 'undefined') { - throw new AppwriteException('Missing required parameter: "max"'); - } - if (typeof xdefault === 'undefined') { throw new AppwriteException('Missing required parameter: "xdefault"'); } @@ -1207,8 +1140,6 @@ export class Databases extends Service { ); } /** - * Create IP address attribute - * * Create IP address attribute. * * @@ -1264,8 +1195,6 @@ export class Databases extends Service { ); } /** - * Update IP address attribute - * * Update an ip attribute. Changing the `default` value will not update * already existing documents. * @@ -1323,8 +1252,6 @@ export class Databases extends Service { ); } /** - * Create relationship attribute - * * Create relationship attribute. [Learn more about relationship * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -1389,8 +1316,6 @@ export class Databases extends Service { ); } /** - * Create string attribute - * * Create a string attribute. * * @@ -1458,8 +1383,6 @@ export class Databases extends Service { ); } /** - * Update string attribute - * * Update a string attribute. Changing the `default` value will not update * already existing documents. * @@ -1521,8 +1444,6 @@ export class Databases extends Service { ); } /** - * Create URL attribute - * * Create a URL attribute. * * @@ -1578,8 +1499,6 @@ export class Databases extends Service { ); } /** - * Update URL attribute - * * Update an url attribute. Changing the `default` value will not update * already existing documents. * @@ -1637,8 +1556,6 @@ export class Databases extends Service { ); } /** - * Get attribute - * * Get attribute by ID. * * @param {string} databaseId @@ -1667,15 +1584,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete attribute - * * Deletes an attribute. * * @param {string} databaseId @@ -1711,8 +1625,6 @@ export class Databases extends Service { ); } /** - * Update relationship attribute - * * Update relationship attribute. [Learn more about relationship * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). * @@ -1758,8 +1670,6 @@ export class Databases extends Service { ); } /** - * 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. * @@ -1789,19 +1699,17 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 * @param {string} collectionId @@ -1851,8 +1759,6 @@ export class Databases extends Service { ); } /** - * Get document - * * Get a document by its unique ID. This endpoint response returns a JSON * object with the document data. * @@ -1887,15 +1793,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update document - * * Update a document by its unique ID. Using the patch method you can pass * only specific fields that will get updated. * @@ -1940,8 +1843,6 @@ export class Databases extends Service { ); } /** - * Delete document - * * Delete a document by its unique ID. * * @param {string} databaseId @@ -1977,8 +1878,6 @@ export class Databases extends Service { ); } /** - * List indexes - * * List indexes in the collection. * * @param {string} databaseId @@ -2007,15 +1906,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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`. @@ -2076,8 +1972,6 @@ export class Databases extends Service { ); } /** - * Get index - * * Get index by ID. * * @param {string} databaseId @@ -2106,15 +2000,12 @@ export class Databases extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete index - * * Delete an index. * * @param {string} databaseId diff --git a/src/services/functions.ts b/src/services/functions.ts index a7354ae..06bcecf 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -24,8 +24,6 @@ export class Functions extends Service { } /** - * List functions - * * Get a list of all the project's functions. You can use the query params to * filter your results. * @@ -50,15 +48,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -182,8 +177,6 @@ export class Functions extends Service { ); } /** - * List runtimes - * * Get a list of all runtimes that are currently active on your instance. * * @throws {AppwriteException} @@ -197,15 +190,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List available function runtime specifications - * * List allowed function specifications for this instance. * * @@ -220,15 +210,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get function - * * Get a function by its unique ID. * * @param {string} functionId @@ -247,15 +234,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update function - * * Update function by its unique ID. * * @param {string} functionId @@ -353,8 +337,6 @@ export class Functions extends Service { ); } /** - * Delete function - * * Delete a function by its unique ID. * * @param {string} functionId @@ -380,8 +362,6 @@ export class Functions extends Service { ); } /** - * List deployments - * * Get a list of all the project's code deployments. You can use the query * params to filter your results. * @@ -411,15 +391,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -558,8 +535,6 @@ export class Functions extends Service { return response; } /** - * Get deployment - * * Get a code deployment by its unique ID. * * @param {string} functionId @@ -583,15 +558,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -624,8 +596,6 @@ export class Functions extends Service { ); } /** - * Delete deployment - * * Delete a code deployment by its unique ID. * * @param {string} functionId @@ -656,8 +626,6 @@ export class Functions extends Service { ); } /** - * 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 @@ -696,8 +664,6 @@ export class Functions extends Service { ); } /** - * 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 @@ -732,8 +698,6 @@ export class Functions extends Service { ); } /** - * Download deployment - * * Get a Deployment's contents by its unique ID. This endpoint supports range * requests for partial or streaming file download. * @@ -758,15 +722,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * List executions - * * Get a list of all the current user function execution logs. You can use the * query params to filter your results. * @@ -796,15 +757,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -857,8 +815,6 @@ export class Functions extends Service { ); } /** - * Get execution - * * Get a function execution log by its unique ID. * * @param {string} functionId @@ -882,15 +838,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete execution - * * Delete a function execution by its unique ID. * * @@ -922,8 +875,6 @@ export class Functions extends Service { ); } /** - * List variables - * * Get a list of all variables of a specific function. * * @param {string} functionId @@ -942,15 +893,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create variable - * * Create a new function environment variable. These variables can be accessed * in the function at runtime as environment variables. * @@ -993,8 +941,6 @@ export class Functions extends Service { ); } /** - * Get variable - * * Get a variable by its unique ID. * * @param {string} functionId @@ -1018,15 +964,12 @@ export class Functions extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update variable - * * Update variable by its unique ID. * * @param {string} functionId @@ -1069,8 +1012,6 @@ export class Functions extends Service { ); } /** - * Delete variable - * * Delete a variable by its unique ID. * * @param {string} functionId diff --git a/src/services/graphql.ts b/src/services/graphql.ts index 80562db..da12e32 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -22,8 +22,6 @@ export class Graphql extends Service { } /** - * GraphQL endpoint - * * Execute a GraphQL mutation. * * @param {object} query @@ -53,8 +51,6 @@ export class Graphql extends Service { ); } /** - * GraphQL endpoint - * * Execute a GraphQL mutation. * * @param {object} query diff --git a/src/services/health.ts b/src/services/health.ts index 2a89e7f..b8ce6de 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -23,8 +23,6 @@ export class Health extends Service { } /** - * Get HTTP - * * Check the Appwrite HTTP server is up and responsive. * * @throws {AppwriteException} @@ -38,15 +36,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get antivirus - * * Check the Appwrite Antivirus server is up and connection is successful. * * @throws {AppwriteException} @@ -60,15 +55,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get cache - * * Check the Appwrite in-memory cache servers are up and connection is * successful. * @@ -83,15 +75,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get the SSL certificate for a domain - * * Get the SSL certificate for a domain * * @param {string} domain @@ -110,15 +99,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get DB - * * Check the Appwrite database servers are up and connection is successful. * * @throws {AppwriteException} @@ -132,15 +118,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get pubsub - * * Check the Appwrite pub-sub servers are up and connection is successful. * * @throws {AppwriteException} @@ -154,38 +137,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get queue - * - * Check the Appwrite queue messaging servers are up and connection is - * successful. - * - * @throws {AppwriteException} - * @returns {Promise} - */ - async getQueue(): Promise { - const apiPath = '/health/queue'; - const payload: Payload = {}; - - return await this.client.call( - 'get', - apiPath, - { - 'content-type': 'application/json', - }, - payload, - 'json' - ); - } - /** - * Get builds queue - * * Get the number of builds that are waiting to be processed in the Appwrite * internal queue server. * @@ -205,15 +162,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -234,15 +188,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get databases queue - * * Get the number of database changes that are waiting to be processed in the * Appwrite internal queue server. * @@ -267,15 +218,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get deletes queue - * * Get the number of background destructive changes that are waiting to be * processed in the Appwrite internal queue server. * @@ -295,15 +243,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get number of failed queue jobs - * * Returns the amount of failed jobs in a given queue. * * @@ -328,15 +273,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get functions queue - * * Get the number of function executions that are waiting to be processed in * the Appwrite internal queue server. * @@ -356,15 +298,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get logs queue - * * Get the number of logs that are waiting to be processed in the Appwrite * internal queue server. * @@ -384,15 +323,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get mails queue - * * Get the number of mails that are waiting to be processed in the Appwrite * internal queue server. * @@ -412,15 +348,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get messaging queue - * * Get the number of messages that are waiting to be processed in the Appwrite * internal queue server. * @@ -440,15 +373,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get migrations queue - * * Get the number of migrations that are waiting to be processed in the * Appwrite internal queue server. * @@ -468,24 +398,21 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get usage queue - * * Get the number of metrics that are waiting to be processed in the Appwrite - * internal queue server. + * stats resources queue. * * @param {number} threshold * @throws {AppwriteException} * @returns {Promise} */ - async getQueueUsage(threshold?: number): Promise { - const apiPath = '/health/queue/usage'; + async getQueueStatsResources(threshold?: number): Promise { + const apiPath = '/health/queue/stats-resources'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -496,24 +423,21 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get usage dump queue - * - * Get the number of projects containing metrics that are waiting to be - * processed in the Appwrite internal queue server. + * 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 getQueueUsageDump(threshold?: number): Promise { - const apiPath = '/health/queue/usage-dump'; + async getQueueUsage(threshold?: number): Promise { + const apiPath = '/health/queue/stats-usage'; const payload: Payload = {}; if (typeof threshold !== 'undefined') { @@ -524,15 +448,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get webhooks queue - * * Get the number of webhooks that are waiting to be processed in the Appwrite * internal queue server. * @@ -552,15 +473,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get storage - * * Check the Appwrite storage device is up and connection is successful. * * @throws {AppwriteException} @@ -574,15 +492,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Get local storage - * * Check the Appwrite local storage device is up and connection is successful. * * @throws {AppwriteException} @@ -596,15 +511,12 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -624,7 +536,6 @@ export class Health extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' diff --git a/src/services/locale.ts b/src/services/locale.ts index d362aa1..8b95a87 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -22,8 +22,6 @@ export class Locale extends Service { } /** - * 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 @@ -42,15 +40,12 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List locale codes - * * List of all locale codes in [ISO * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). * @@ -65,15 +60,12 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List continents - * * List of all continents. You can use the locale header to get the data in a * supported language. * @@ -88,15 +80,12 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List countries - * * List of all countries. You can use the locale header to get the data in a * supported language. * @@ -111,15 +100,12 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. * @@ -134,15 +120,12 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List countries phone codes - * * List of all countries phone codes. You can use the locale header to get the * data in a supported language. * @@ -157,15 +140,12 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -181,15 +161,12 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List languages - * * List of all languages classified by ISO 639-1 including 2-letter code, name * in English, and name in the respective language. * @@ -204,7 +181,6 @@ export class Locale extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' diff --git a/src/services/messaging.ts b/src/services/messaging.ts index a5c4997..5b9d0ee 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -24,8 +24,6 @@ export class Messaging extends Service { } /** - * List messages - * * Get a list of all messages from the current Appwrite project. * * @param {string[]} queries @@ -49,15 +47,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create email - * * Create a new email message. * * @param {string} messageId @@ -138,9 +133,9 @@ export class Messaging extends Service { ); } /** - * 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 @@ -210,8 +205,6 @@ export class Messaging extends Service { ); } /** - * Create push notification - * * Create a new push notification. * * @param {string} messageId @@ -312,9 +305,9 @@ export class Messaging extends Service { ); } /** - * 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 @@ -412,8 +405,6 @@ export class Messaging extends Service { ); } /** - * Create SMS - * * Create a new SMS message. * * @param {string} messageId @@ -470,9 +461,9 @@ export class Messaging extends Service { ); } /** - * 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 @@ -522,8 +513,6 @@ export class Messaging extends Service { ); } /** - * Get message - * * Get a message by its unique ID. * * @@ -543,15 +532,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete message - * * Delete a message. If the message is not a draft or scheduled, but has been * sent, this will not recall the message. * @@ -578,8 +564,6 @@ export class Messaging extends Service { ); } /** - * List message logs - * * Get the message activity logs listed by its unique ID. * * @param {string} messageId @@ -603,15 +587,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List message targets - * * Get a list of the targets associated with a message. * * @param {string} messageId @@ -635,15 +616,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List providers - * * Get a list of all providers from the current Appwrite project. * * @param {string[]} queries @@ -667,15 +645,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create APNS provider - * * Create a new Apple Push Notification service provider. * * @param {string} providerId @@ -736,8 +711,6 @@ export class Messaging extends Service { ); } /** - * Update APNS provider - * * Update a Apple Push Notification service provider by its unique ID. * * @param {string} providerId @@ -791,8 +764,6 @@ export class Messaging extends Service { ); } /** - * Create FCM provider - * * Create a new Firebase Cloud Messaging provider. * * @param {string} providerId @@ -837,8 +808,6 @@ export class Messaging extends Service { ); } /** - * Update FCM provider - * * Update a Firebase Cloud Messaging provider by its unique ID. * * @param {string} providerId @@ -876,8 +845,6 @@ export class Messaging extends Service { ); } /** - * Create Mailgun provider - * * Create a new Mailgun provider. * * @param {string} providerId @@ -946,8 +913,6 @@ export class Messaging extends Service { ); } /** - * Update Mailgun provider - * * Update a Mailgun provider by its unique ID. * * @param {string} providerId @@ -1009,8 +974,6 @@ export class Messaging extends Service { ); } /** - * Create Msg91 provider - * * Create a new MSG91 provider. * * @param {string} providerId @@ -1063,8 +1026,6 @@ export class Messaging extends Service { ); } /** - * Update Msg91 provider - * * Update a MSG91 provider by its unique ID. * * @param {string} providerId @@ -1110,8 +1071,6 @@ export class Messaging extends Service { ); } /** - * Create Sendgrid provider - * * Create a new Sendgrid provider. * * @param {string} providerId @@ -1172,8 +1131,6 @@ export class Messaging extends Service { ); } /** - * Update Sendgrid provider - * * Update a Sendgrid provider by its unique ID. * * @param {string} providerId @@ -1227,8 +1184,6 @@ export class Messaging extends Service { ); } /** - * Create SMTP provider - * * Create a new SMTP provider. * * @param {string} providerId @@ -1317,8 +1272,6 @@ export class Messaging extends Service { ); } /** - * Update SMTP provider - * * Update a SMTP provider by its unique ID. * * @param {string} providerId @@ -1396,8 +1349,6 @@ export class Messaging extends Service { ); } /** - * Create Telesign provider - * * Create a new Telesign provider. * * @param {string} providerId @@ -1450,8 +1401,6 @@ export class Messaging extends Service { ); } /** - * Update Telesign provider - * * Update a Telesign provider by its unique ID. * * @param {string} providerId @@ -1497,8 +1446,6 @@ export class Messaging extends Service { ); } /** - * Create Textmagic provider - * * Create a new Textmagic provider. * * @param {string} providerId @@ -1551,8 +1498,6 @@ export class Messaging extends Service { ); } /** - * Update Textmagic provider - * * Update a Textmagic provider by its unique ID. * * @param {string} providerId @@ -1598,8 +1543,6 @@ export class Messaging extends Service { ); } /** - * Create Twilio provider - * * Create a new Twilio provider. * * @param {string} providerId @@ -1652,8 +1595,6 @@ export class Messaging extends Service { ); } /** - * Update Twilio provider - * * Update a Twilio provider by its unique ID. * * @param {string} providerId @@ -1699,8 +1640,6 @@ export class Messaging extends Service { ); } /** - * Create Vonage provider - * * Create a new Vonage provider. * * @param {string} providerId @@ -1753,8 +1692,6 @@ export class Messaging extends Service { ); } /** - * Update Vonage provider - * * Update a Vonage provider by its unique ID. * * @param {string} providerId @@ -1800,8 +1737,6 @@ export class Messaging extends Service { ); } /** - * Get provider - * * Get a provider by its unique ID. * * @@ -1821,15 +1756,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete provider - * * Delete a provider by its unique ID. * * @param {string} providerId @@ -1855,8 +1787,6 @@ export class Messaging extends Service { ); } /** - * List provider logs - * * Get the provider activity logs listed by its unique ID. * * @param {string} providerId @@ -1880,15 +1810,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List subscriber logs - * * Get the subscriber activity logs listed by its unique ID. * * @param {string} subscriberId @@ -1912,15 +1839,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List topics - * * Get a list of all topics from the current Appwrite project. * * @param {string[]} queries @@ -1944,15 +1868,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create topic - * * Create a new topic. * * @param {string} topicId @@ -1993,8 +1914,6 @@ export class Messaging extends Service { ); } /** - * Get topic - * * Get a topic by its unique ID. * * @@ -2014,15 +1933,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update topic - * * Update a topic by its unique ID. * * @@ -2057,8 +1973,6 @@ export class Messaging extends Service { ); } /** - * Delete topic - * * Delete a topic by its unique ID. * * @param {string} topicId @@ -2084,8 +1998,6 @@ export class Messaging extends Service { ); } /** - * List topic logs - * * Get the topic activity logs listed by its unique ID. * * @param {string} topicId @@ -2109,15 +2021,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List subscribers - * * Get a list of all subscribers from the current Appwrite project. * * @param {string} topicId @@ -2146,15 +2055,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create subscriber - * * Create a new subscriber. * * @param {string} topicId @@ -2196,8 +2102,6 @@ export class Messaging extends Service { ); } /** - * Get subscriber - * * Get a subscriber by its unique ID. * * @@ -2222,15 +2126,12 @@ export class Messaging extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete subscriber - * * Delete a subscriber by its unique ID. * * @param {string} topicId diff --git a/src/services/storage.ts b/src/services/storage.ts index 7b4668f..e751553 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -25,8 +25,6 @@ export class Storage extends Service { } /** - * List buckets - * * Get a list of all the storage buckets. You can use the query params to * filter your results. * @@ -51,15 +49,12 @@ export class Storage extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create bucket - * * Create a new storage bucket. * * @param {string} bucketId @@ -128,8 +123,6 @@ export class Storage extends Service { ); } /** - * Get bucket - * * Get a storage bucket by its unique ID. This endpoint response returns a * JSON object with the storage bucket metadata. * @@ -149,15 +142,12 @@ export class Storage extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update bucket - * * Update a storage bucket by its unique ID. * * @param {string} bucketId @@ -223,8 +213,6 @@ export class Storage extends Service { ); } /** - * Delete bucket - * * Delete a storage bucket by its unique ID. * * @param {string} bucketId @@ -250,8 +238,6 @@ export class Storage extends Service { ); } /** - * List files - * * Get a list of all the user files. You can use the query params to filter * your results. * @@ -281,15 +267,12 @@ export class Storage extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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) @@ -441,8 +424,6 @@ export class Storage extends Service { return response; } /** - * Get file - * * Get a file by its unique ID. This endpoint response returns a JSON object * with the file metadata. * @@ -467,15 +448,12 @@ export class Storage extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update file - * * Update a file by its unique ID. Only users with write permissions have * access to update this resource. * @@ -515,8 +493,6 @@ export class Storage extends Service { ); } /** - * Delete file - * * Delete a file by its unique ID. Only users with write permissions have * access to delete this resource. * @@ -548,8 +524,6 @@ export class Storage extends Service { ); } /** - * 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. @@ -575,15 +549,12 @@ export class Storage extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * 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 @@ -666,15 +637,12 @@ export class Storage extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' ); } /** - * 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. @@ -700,7 +668,6 @@ export class Storage extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'arraybuffer' diff --git a/src/services/teams.ts b/src/services/teams.ts index f939671..b7fd10b 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -22,8 +22,6 @@ export class Teams extends Service { } /** - * 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. * @@ -48,15 +46,12 @@ export class Teams extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -99,8 +94,6 @@ export class Teams extends Service { ); } /** - * Get team - * * Get a team by its ID. All team members have read access for this resource. * * @param {string} teamId @@ -119,15 +112,12 @@ export class Teams extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update name - * * Update the team's name by its unique ID. * * @param {string} teamId @@ -161,8 +151,6 @@ export class Teams extends Service { ); } /** - * Delete team - * * Delete a team using its ID. Only team members with the owner role can * delete the team. * @@ -189,8 +177,6 @@ export class Teams extends Service { ); } /** - * 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. @@ -221,15 +207,12 @@ export class Teams extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -303,8 +286,6 @@ export class Teams extends Service { ); } /** - * 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. @@ -330,15 +311,12 @@ export class Teams extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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). @@ -380,8 +358,6 @@ export class Teams extends Service { ); } /** - * 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. @@ -414,8 +390,6 @@ export class Teams extends Service { ); } /** - * 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. @@ -468,8 +442,6 @@ export class Teams extends Service { ); } /** - * 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). @@ -490,15 +462,12 @@ export class Teams extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. diff --git a/src/services/users.ts b/src/services/users.ts index 3911bb4..b4a5249 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -25,8 +25,6 @@ export class Users extends Service { } /** - * List users - * * Get a list of all the project's users. You can use the query params to * filter your results. * @@ -51,15 +49,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create user - * * Create a new user. * * @param {string} userId @@ -104,8 +99,6 @@ export class Users extends Service { ); } /** - * 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 @@ -157,8 +150,6 @@ export class Users extends Service { ); } /** - * 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 @@ -210,8 +201,6 @@ export class Users extends Service { ); } /** - * List identities - * * Get identities for all users. * * @param {string[]} queries @@ -235,15 +224,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Delete identity - * * Delete an identity by its unique ID. * * @param {string} identityId @@ -269,8 +255,6 @@ export class Users extends Service { ); } /** - * 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 @@ -322,8 +306,6 @@ export class Users extends Service { ); } /** - * 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 @@ -375,8 +357,6 @@ export class Users extends Service { ); } /** - * 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 @@ -468,8 +448,6 @@ export class Users extends Service { ); } /** - * 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 @@ -546,8 +524,6 @@ export class Users extends Service { ); } /** - * 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) @@ -603,8 +579,6 @@ export class Users extends Service { ); } /** - * Get user - * * Get a user by its unique ID. * * @param {string} userId @@ -623,15 +597,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -662,8 +633,6 @@ export class Users extends Service { ); } /** - * Update email - * * Update the user email by its unique ID. * * @param {string} userId @@ -697,8 +666,6 @@ export class Users extends Service { ); } /** - * 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. @@ -734,8 +701,6 @@ export class Users extends Service { ); } /** - * 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 @@ -774,8 +739,6 @@ export class Users extends Service { ); } /** - * List user logs - * * Get the user activity logs list by its unique ID. * * @param {string} userId @@ -799,15 +762,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * List user memberships - * * Get the user membership list by its unique ID. * * @param {string} userId @@ -826,15 +786,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update MFA - * * Enable or disable MFA on a user account. * * @param {string} userId @@ -868,8 +825,6 @@ export class Users extends Service { ); } /** - * Delete authenticator - * * Delete an authenticator app. * * @param {string} userId @@ -900,8 +855,6 @@ export class Users extends Service { ); } /** - * List factors - * * List the factors available on the account to be used as a MFA challange. * * @param {string} userId @@ -920,15 +873,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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) @@ -950,15 +900,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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) @@ -987,8 +934,6 @@ export class Users extends Service { ); } /** - * 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) @@ -1017,8 +962,6 @@ export class Users extends Service { ); } /** - * Update name - * * Update the user name by its unique ID. * * @param {string} userId @@ -1052,8 +995,6 @@ export class Users extends Service { ); } /** - * Update password - * * Update the user password by its unique ID. * * @param {string} userId @@ -1087,8 +1028,6 @@ export class Users extends Service { ); } /** - * Update phone - * * Update the user phone by its unique ID. * * @param {string} userId @@ -1122,8 +1061,6 @@ export class Users extends Service { ); } /** - * Get user preferences - * * Get the user preferences by its unique ID. * * @param {string} userId @@ -1142,15 +1079,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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. @@ -1186,8 +1120,6 @@ export class Users extends Service { ); } /** - * List user sessions - * * Get the user sessions list by its unique ID. * * @param {string} userId @@ -1206,15 +1138,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * 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 @@ -1245,8 +1174,6 @@ export class Users extends Service { ); } /** - * Delete user sessions - * * Delete all user's sessions by using the user's unique ID. * * @param {string} userId @@ -1272,8 +1199,6 @@ export class Users extends Service { ); } /** - * Delete user session - * * Delete a user sessions by its unique ID. * * @param {string} userId @@ -1304,8 +1229,6 @@ export class Users extends Service { ); } /** - * 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. * @@ -1340,8 +1263,6 @@ export class Users extends Service { ); } /** - * List user targets - * * List the messaging targets that are associated with a user. * * @param {string} userId @@ -1365,15 +1286,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Create user target - * * Create a messaging target. * * @param {string} userId @@ -1431,8 +1349,6 @@ export class Users extends Service { ); } /** - * Get user target - * * Get a user's push notification target by ID. * * @param {string} userId @@ -1456,15 +1372,12 @@ export class Users extends Service { 'get', apiPath, { - 'content-type': 'application/json', }, payload, 'json' ); } /** - * Update user target - * * Update a messaging target. * * @param {string} userId @@ -1507,8 +1420,6 @@ export class Users extends Service { ); } /** - * Delete user target - * * Delete a messaging target. * * @param {string} userId @@ -1539,8 +1450,6 @@ export class Users extends Service { ); } /** - * 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) @@ -1578,8 +1487,6 @@ export class Users extends Service { ); } /** - * Update email verification - * * Update the user email verification status by its unique ID. * * @param {string} userId @@ -1613,8 +1520,6 @@ export class Users extends Service { ); } /** - * Update phone verification - * * Update the user phone verification status by its unique ID. * * @param {string} userId diff --git a/test/services/databases.test.ts b/test/services/databases.test.ts index 6778081..2f16ee3 100644 --- a/test/services/databases.test.ts +++ b/test/services/databases.test.ts @@ -475,8 +475,6 @@ describe('Databases service', () => { '', true, 1.0, - 1.0, - 1.0, ); assertEquals(response, data); @@ -526,8 +524,6 @@ describe('Databases service', () => { '', true, 1, - 1, - 1, ); assertEquals(response, data); diff --git a/test/services/health.test.ts b/test/services/health.test.ts index 7b1ecd2..1fd15bd 100644 --- a/test/services/health.test.ts +++ b/test/services/health.test.ts @@ -110,22 +110,6 @@ describe('Health service', () => { }); - test('test method getQueue()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - - const stubbedFetch = stub(globalThis, 'fetch', () => Promise.resolve(Response.json(data))); - - const response = await health.getQueue( - ); - - assertEquals(response, data); - stubbedFetch.restore(); - }); - - test('test method getQueueBuilds()', async () => { const data = { 'size': 8,}; @@ -267,13 +251,13 @@ describe('Health service', () => { }); - test('test method getQueueUsage()', async () => { + test('test method getQueueStatsResources()', async () => { const data = { 'size': 8,}; const stubbedFetch = stub(globalThis, 'fetch', () => Promise.resolve(Response.json(data))); - const response = await health.getQueueUsage( + const response = await health.getQueueStatsResources( ); assertEquals(response, data); @@ -281,13 +265,13 @@ describe('Health service', () => { }); - test('test method getQueueUsageDump()', async () => { + test('test method getQueueUsage()', async () => { const data = { 'size': 8,}; const stubbedFetch = stub(globalThis, 'fetch', () => Promise.resolve(Response.json(data))); - const response = await health.getQueueUsageDump( + const response = await health.getQueueUsage( ); assertEquals(response, data);