diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index ae4a91c..e6329b6 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateBooleanAttribute( '', // collectionId '', // key false, // required - false // default + false, // default + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 9dfcf75..ef69c7e 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateDatetimeAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index f42c464..1fe9e57 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateEmailAttribute( '', // collectionId '', // key false, // required - 'email@example.com' // default + 'email@example.com', // default + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index e8dd97d..ec9e3bd 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -13,5 +13,6 @@ const result = await databases.updateEnumAttribute( '', // key [], // elements false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 67cb29f..6833f87 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -14,5 +14,6 @@ const result = await databases.updateFloatAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index baf374e..d6d16f5 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -14,5 +14,6 @@ const result = await databases.updateIntegerAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 64bde38..019b4f2 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateIpAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 403f591..2668380 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -11,5 +11,6 @@ const result = await databases.updateRelationshipAttribute( '', // databaseId '', // collectionId '', // key - sdk.RelationMutate.Cascade // onDelete (optional) + sdk.RelationMutate.Cascade, // onDelete (optional) + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index c21784b..f379fdc 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -12,5 +12,7 @@ const result = await databases.updateStringAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + null, // size (optional) + '' // newKey (optional) ); diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 6a8434a..36d1095 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateUrlAttribute( '', // collectionId '', // key false, // required - 'https://example.com' // default + 'https://example.com', // default + '' // newKey (optional) ); diff --git a/package.json b/package.json index 5223d01..c8dcded 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "14.0.0", + "version": "14.1.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 1e19619..afe642d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/14.0.0'; + let ua = 'AppwriteNodeJSSDK/14.1.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,7 +82,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '14.0.0', + 'x-sdk-version': '14.1.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.6.0', }; diff --git a/src/services/databases.ts b/src/services/databases.ts index edc1e2f..c200f04 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -487,10 +487,11 @@ export class Databases { * @param {string} key * @param {boolean} required * @param {boolean} xdefault + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise { + async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -514,6 +515,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -591,10 +595,11 @@ export class Databases { * @param {string} key * @param {boolean} required * @param {string} xdefault + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise { + async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -618,6 +623,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -697,10 +705,11 @@ export class Databases { * @param {string} key * @param {boolean} required * @param {string} xdefault + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise { + async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -724,6 +733,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -811,10 +823,11 @@ export class Databases { * @param {string[]} elements * @param {boolean} required * @param {string} xdefault + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise { + async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -844,6 +857,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -933,10 +949,11 @@ export class Databases { * @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): Promise { + async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -972,6 +989,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1061,10 +1081,11 @@ export class Databases { * @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): Promise { + async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1100,6 +1121,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1179,10 +1203,11 @@ export class Databases { * @param {string} key * @param {boolean} required * @param {string} xdefault + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise { + async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1206,6 +1231,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1359,10 +1387,12 @@ export class Databases { * @param {string} key * @param {boolean} required * @param {string} xdefault + * @param {number} size + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise { + async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1386,6 +1416,12 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1465,10 +1501,11 @@ export class Databases { * @param {string} key * @param {boolean} required * @param {string} xdefault + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise { + async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1492,6 +1529,9 @@ export class Databases { if (typeof xdefault !== 'undefined') { payload['default'] = xdefault; } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1587,10 +1627,11 @@ export class Databases { * @param {string} collectionId * @param {string} key * @param {RelationMutate} onDelete + * @param {string} newKey * @throws {AppwriteException} * @returns {Promise} */ - async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate): Promise { + async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise { if (typeof databaseId === 'undefined') { throw new AppwriteException('Missing required parameter: "databaseId"'); } @@ -1605,6 +1646,9 @@ export class Databases { 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 } = {