diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fdaeb0c..503400a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 22.2.0 + +* Added ttl option to listDocuments for cached responses +* Added getConsolePausing health status endpoint in Health service +* Added Health.getConsolePausing overloads (object and positional) +* Added updateRelationshipAttribute for Databases to manage relationship attributes +* Added console pausing example to health docs +* Made activate optional in createDeployment object parameter + ## 22.1.2 * Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index be2b3703..11fcec2d 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -13,6 +13,7 @@ const result = await databases.listDocuments({ collectionId: '', queries: [], // optional transactionId: '', // optional - total: false // optional + total: false, // optional + ttl: 0 // optional }); ``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md new file mode 100644 index 00000000..a3dfca6f --- /dev/null +++ b/docs/examples/health/get-console-pausing.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getConsolePausing({ + threshold: null, // optional + inactivityDays: null // optional +}); +``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index 1fea6050..2603dda9 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -12,9 +12,9 @@ const sites = new sdk.Sites(client); const result = await sites.createDeployment({ siteId: '', code: InputFile.fromPath('/path/to/file', 'filename'), - activate: false, installCommand: '', // optional buildCommand: '', // optional - outputDirectory: '' // optional + outputDirectory: '', // optional + activate: false // optional }); ``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 1f6894b3..2777730b 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -13,6 +13,7 @@ const result = await tablesDB.listRows({ tableId: '', queries: [], // optional transactionId: '', // optional - total: false // optional + total: false, // optional + ttl: 0 // optional }); ``` diff --git a/src/models.ts b/src/models.ts index e688dcc9..fea4da85 100644 --- a/src/models.ts +++ b/src/models.ts @@ -2413,7 +2413,7 @@ export namespace Models { */ $id: string; /** - * Row automatically incrementing ID. + * Row sequence ID. */ $sequence: number; /** @@ -2452,7 +2452,7 @@ export namespace Models { */ $id: string; /** - * Document automatically incrementing ID. + * Document sequence ID. */ $sequence: number; /** diff --git a/src/services/databases.ts b/src/services/databases.ts index f7d5c32d..b559e71e 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1134,7 +1134,7 @@ export class Databases { * * * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} params.key - Attribute Key. * @param {boolean} params.required - Is attribute required? * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. @@ -1149,7 +1149,7 @@ export class Databases { * * * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). * @param {string} key - Attribute Key. * @param {boolean} required - Is attribute required? * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. @@ -3606,6 +3606,90 @@ export class Databases { ); } + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. + */ + updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; + updateRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, + ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + ): Promise { + let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + onDelete: rest[2] as RelationMutate, + newKey: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const onDelete = params.onDelete; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + /** * Create a string attribute. * @@ -4568,90 +4652,6 @@ export class Databases { ); } - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. - */ - updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise; - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {RelationMutate} onDelete - Constraints option - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise; - updateRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] - ): Promise { - let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - onDelete: rest[2] as RelationMutate, - newKey: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const onDelete = params.onDelete; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -4660,11 +4660,12 @@ export class Databases { * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listDocuments(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; /** * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. * @@ -4673,26 +4674,28 @@ export class Databases { * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; + listDocuments(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listDocuments( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] ): Promise> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, collectionId: rest[0] as string, queries: rest[1] as string[], transactionId: rest[2] as string, - total: rest[3] as boolean + total: rest[3] as boolean, + ttl: rest[4] as number }; } @@ -4701,6 +4704,7 @@ export class Databases { const queries = params.queries; const transactionId = params.transactionId; const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4720,6 +4724,9 @@ export class Databases { if (typeof total !== 'undefined') { payload['total'] = total; } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/health.ts b/src/services/health.ts index f3598669..e3d724c3 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -130,6 +130,67 @@ export class Health { ); } + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} params.threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} params.inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise} + */ + getConsolePausing(params?: { threshold?: number, inactivityDays?: number }): Promise; + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getConsolePausing(threshold?: number, inactivityDays?: number): Promise; + getConsolePausing( + paramsOrFirst?: { threshold?: number, inactivityDays?: number } | number, + ...rest: [(number)?] + ): Promise { + let params: { threshold?: number, inactivityDays?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number, inactivityDays?: number }; + } else { + params = { + threshold: paramsOrFirst as number, + inactivityDays: rest[0] as number + }; + } + + const threshold = params.threshold; + const inactivityDays = params.inactivityDays; + + + const apiPath = '/health/console-pausing'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + if (typeof inactivityDays !== 'undefined') { + payload['inactivityDays'] = inactivityDays; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + /** * Check the Appwrite database servers are up and connection is successful. * diff --git a/src/services/messaging.ts b/src/services/messaging.ts index f3f94f04..16dd8998 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -4928,7 +4928,7 @@ export class Messaging { * Get a list of all subscribers from the current Appwrite project. * * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} @@ -4939,7 +4939,7 @@ export class Messaging { * Get a list of all subscribers from the current Appwrite project. * * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: targetId, topicId, userId, providerType * @param {string} search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} diff --git a/src/services/sites.ts b/src/services/sites.ts index 365e8091..5018382a 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -733,56 +733,56 @@ export class Sites { * * @param {string} params.siteId - Site ID. * @param {File} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. * @param {string} params.installCommand - Install Commands. * @param {string} params.buildCommand - Build Commands. * @param {string} params.outputDirectory - Output Directory. + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. * @throws {AppwriteException} * @returns {Promise} */ - createDeployment(params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void }): Promise; + createDeployment(params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise; /** * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. * * @param {string} siteId - Site ID. * @param {File} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} activate - Automatically activate the deployment when it is finished building. * @param {string} installCommand - Install Commands. * @param {string} buildCommand - Build Commands. * @param {string} outputDirectory - Output Directory. + * @param {boolean} activate - Automatically activate the deployment when it is finished building. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createDeployment(siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void): Promise; + createDeployment(siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise; createDeployment( - paramsOrFirst: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File)?, (boolean)?, (string)?, (string)?, (string)?,((progress: UploadProgress) => void)?] + paramsOrFirst: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] ): Promise { - let params: { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string }; + let params: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; let onProgress: ((progress: UploadProgress) => void); if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, code: File, activate: boolean, installCommand?: string, buildCommand?: string, outputDirectory?: string }; + params = (paramsOrFirst || {}) as { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); } else { params = { siteId: paramsOrFirst as string, code: rest[0] as File, - activate: rest[1] as boolean, - installCommand: rest[2] as string, - buildCommand: rest[3] as string, - outputDirectory: rest[4] as string + installCommand: rest[1] as string, + buildCommand: rest[2] as string, + outputDirectory: rest[3] as string, + activate: rest[4] as boolean }; onProgress = rest[5] as ((progress: UploadProgress) => void); } const siteId = params.siteId; const code = params.code; - const activate = params.activate; const installCommand = params.installCommand; const buildCommand = params.buildCommand; const outputDirectory = params.outputDirectory; + const activate = params.activate; if (typeof siteId === 'undefined') { throw new AppwriteException('Missing required parameter: "siteId"'); @@ -790,9 +790,6 @@ export class Sites { if (typeof code === 'undefined') { throw new AppwriteException('Missing required parameter: "code"'); } - if (typeof activate === 'undefined') { - throw new AppwriteException('Missing required parameter: "activate"'); - } const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); const payload: Payload = {}; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 398450ff..af1fa996 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -4933,10 +4933,11 @@ export class TablesDB { * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} */ - listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise>; + listRows(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise>; /** * Get a list of all the user's rows in a given table. You can use the query params to filter your results. * @@ -4945,26 +4946,28 @@ export class TablesDB { * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience. */ - listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean): Promise>; + listRows(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise>; listRows( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?] + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] ): Promise> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, tableId: rest[0] as string, queries: rest[1] as string[], transactionId: rest[2] as string, - total: rest[3] as boolean + total: rest[3] as boolean, + ttl: rest[4] as number }; } @@ -4973,6 +4976,7 @@ export class TablesDB { const queries = params.queries; const transactionId = params.transactionId; const total = params.total; + const ttl = params.ttl; if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); @@ -4992,6 +4996,9 @@ export class TablesDB { if (typeof total !== 'undefined') { payload['total'] = total; } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/teams.ts b/src/services/teams.ts index 099111b3..0666aec8 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -398,7 +398,7 @@ export class Teams { * * * @param {string} params.teamId - Team ID. - * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @param {string} params.email - Email of the new team member. * @param {string} params.userId - ID of the user to be added to a team. * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -419,7 +419,7 @@ export class Teams { * * * @param {string} teamId - Team ID. - * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @param {string} email - Email of the new team member. * @param {string} userId - ID of the user to be added to a team. * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -564,7 +564,7 @@ export class Teams { * * @param {string} params.teamId - Team ID. * @param {string} params.membershipId - Membership ID. - * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise} */ @@ -575,7 +575,7 @@ export class Teams { * * @param {string} teamId - Team ID. * @param {string} membershipId - Membership ID. - * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience.