Skip to content

Commit 7a2418c

Browse files
authored
Merge pull request #95 from appwrite/dev
Update attributes
2 parents 7145816 + 68639f9 commit 7a2418c

13 files changed

+78
-23
lines changed

docs/examples/databases/update-boolean-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ const result = await databases.updateBooleanAttribute(
1212
'<COLLECTION_ID>', // collectionId
1313
'', // key
1414
false, // required
15-
false // default
15+
false, // default
16+
'' // newKey (optional)
1617
);

docs/examples/databases/update-datetime-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ const result = await databases.updateDatetimeAttribute(
1212
'<COLLECTION_ID>', // collectionId
1313
'', // key
1414
false, // required
15-
'' // default
15+
'', // default
16+
'' // newKey (optional)
1617
);

docs/examples/databases/update-email-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ const result = await databases.updateEmailAttribute(
1212
'<COLLECTION_ID>', // collectionId
1313
'', // key
1414
false, // required
15-
'email@example.com' // default
15+
'email@example.com', // default
16+
'' // newKey (optional)
1617
);

docs/examples/databases/update-enum-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ const result = await databases.updateEnumAttribute(
1313
'', // key
1414
[], // elements
1515
false, // required
16-
'<DEFAULT>' // default
16+
'<DEFAULT>', // default
17+
'' // newKey (optional)
1718
);

docs/examples/databases/update-float-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ const result = await databases.updateFloatAttribute(
1414
false, // required
1515
null, // min
1616
null, // max
17-
null // default
17+
null, // default
18+
'' // newKey (optional)
1819
);

docs/examples/databases/update-integer-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ const result = await databases.updateIntegerAttribute(
1414
false, // required
1515
null, // min
1616
null, // max
17-
null // default
17+
null, // default
18+
'' // newKey (optional)
1819
);

docs/examples/databases/update-ip-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ const result = await databases.updateIpAttribute(
1212
'<COLLECTION_ID>', // collectionId
1313
'', // key
1414
false, // required
15-
'' // default
15+
'', // default
16+
'' // newKey (optional)
1617
);

docs/examples/databases/update-relationship-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ const result = await databases.updateRelationshipAttribute(
1111
'<DATABASE_ID>', // databaseId
1212
'<COLLECTION_ID>', // collectionId
1313
'', // key
14-
sdk.RelationMutate.Cascade // onDelete (optional)
14+
sdk.RelationMutate.Cascade, // onDelete (optional)
15+
'' // newKey (optional)
1516
);

docs/examples/databases/update-string-attribute.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ const result = await databases.updateStringAttribute(
1212
'<COLLECTION_ID>', // collectionId
1313
'', // key
1414
false, // required
15-
'<DEFAULT>' // default
15+
'<DEFAULT>', // default
16+
null, // size (optional)
17+
'' // newKey (optional)
1618
);

docs/examples/databases/update-url-attribute.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ const result = await databases.updateUrlAttribute(
1212
'<COLLECTION_ID>', // collectionId
1313
'', // key
1414
false, // required
15-
'https://example.com' // default
15+
'https://example.com', // default
16+
'' // newKey (optional)
1617
);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-appwrite",
33
"homepage": "https://appwrite.io/support",
44
"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",
5-
"version": "14.0.0",
5+
"version": "14.1.0",
66
"license": "BSD-3-Clause",
77
"main": "dist/index.js",
88
"type": "commonjs",

src/client.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class AppwriteException extends Error {
3333
}
3434

3535
function getUserAgent() {
36-
let ua = 'AppwriteNodeJSSDK/14.0.0';
36+
let ua = 'AppwriteNodeJSSDK/14.1.0';
3737

3838
// `process` is a global in Node.js, but not fully available in all runtimes.
3939
const platform: string[] = [];
@@ -82,7 +82,7 @@ class Client {
8282
'x-sdk-name': 'Node.js',
8383
'x-sdk-platform': 'server',
8484
'x-sdk-language': 'nodejs',
85-
'x-sdk-version': '14.0.0',
85+
'x-sdk-version': '14.1.0',
8686
'user-agent' : getUserAgent(),
8787
'X-Appwrite-Response-Format': '1.6.0',
8888
};

src/services/databases.ts

+54-10
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,11 @@ export class Databases {
487487
* @param {string} key
488488
* @param {boolean} required
489489
* @param {boolean} xdefault
490+
* @param {string} newKey
490491
* @throws {AppwriteException}
491492
* @returns {Promise<Models.AttributeBoolean>}
492493
*/
493-
async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean> {
494+
async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean> {
494495
if (typeof databaseId === 'undefined') {
495496
throw new AppwriteException('Missing required parameter: "databaseId"');
496497
}
@@ -514,6 +515,9 @@ export class Databases {
514515
if (typeof xdefault !== 'undefined') {
515516
payload['default'] = xdefault;
516517
}
518+
if (typeof newKey !== 'undefined') {
519+
payload['newKey'] = newKey;
520+
}
517521
const uri = new URL(this.client.config.endpoint + apiPath);
518522

519523
const apiHeaders: { [header: string]: string } = {
@@ -591,10 +595,11 @@ export class Databases {
591595
* @param {string} key
592596
* @param {boolean} required
593597
* @param {string} xdefault
598+
* @param {string} newKey
594599
* @throws {AppwriteException}
595600
* @returns {Promise<Models.AttributeDatetime>}
596601
*/
597-
async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime> {
602+
async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime> {
598603
if (typeof databaseId === 'undefined') {
599604
throw new AppwriteException('Missing required parameter: "databaseId"');
600605
}
@@ -618,6 +623,9 @@ export class Databases {
618623
if (typeof xdefault !== 'undefined') {
619624
payload['default'] = xdefault;
620625
}
626+
if (typeof newKey !== 'undefined') {
627+
payload['newKey'] = newKey;
628+
}
621629
const uri = new URL(this.client.config.endpoint + apiPath);
622630

623631
const apiHeaders: { [header: string]: string } = {
@@ -697,10 +705,11 @@ export class Databases {
697705
* @param {string} key
698706
* @param {boolean} required
699707
* @param {string} xdefault
708+
* @param {string} newKey
700709
* @throws {AppwriteException}
701710
* @returns {Promise<Models.AttributeEmail>}
702711
*/
703-
async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail> {
712+
async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail> {
704713
if (typeof databaseId === 'undefined') {
705714
throw new AppwriteException('Missing required parameter: "databaseId"');
706715
}
@@ -724,6 +733,9 @@ export class Databases {
724733
if (typeof xdefault !== 'undefined') {
725734
payload['default'] = xdefault;
726735
}
736+
if (typeof newKey !== 'undefined') {
737+
payload['newKey'] = newKey;
738+
}
727739
const uri = new URL(this.client.config.endpoint + apiPath);
728740

729741
const apiHeaders: { [header: string]: string } = {
@@ -811,10 +823,11 @@ export class Databases {
811823
* @param {string[]} elements
812824
* @param {boolean} required
813825
* @param {string} xdefault
826+
* @param {string} newKey
814827
* @throws {AppwriteException}
815828
* @returns {Promise<Models.AttributeEnum>}
816829
*/
817-
async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum> {
830+
async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum> {
818831
if (typeof databaseId === 'undefined') {
819832
throw new AppwriteException('Missing required parameter: "databaseId"');
820833
}
@@ -844,6 +857,9 @@ export class Databases {
844857
if (typeof xdefault !== 'undefined') {
845858
payload['default'] = xdefault;
846859
}
860+
if (typeof newKey !== 'undefined') {
861+
payload['newKey'] = newKey;
862+
}
847863
const uri = new URL(this.client.config.endpoint + apiPath);
848864

849865
const apiHeaders: { [header: string]: string } = {
@@ -933,10 +949,11 @@ export class Databases {
933949
* @param {number} min
934950
* @param {number} max
935951
* @param {number} xdefault
952+
* @param {string} newKey
936953
* @throws {AppwriteException}
937954
* @returns {Promise<Models.AttributeFloat>}
938955
*/
939-
async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat> {
956+
async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise<Models.AttributeFloat> {
940957
if (typeof databaseId === 'undefined') {
941958
throw new AppwriteException('Missing required parameter: "databaseId"');
942959
}
@@ -972,6 +989,9 @@ export class Databases {
972989
if (typeof xdefault !== 'undefined') {
973990
payload['default'] = xdefault;
974991
}
992+
if (typeof newKey !== 'undefined') {
993+
payload['newKey'] = newKey;
994+
}
975995
const uri = new URL(this.client.config.endpoint + apiPath);
976996

977997
const apiHeaders: { [header: string]: string } = {
@@ -1061,10 +1081,11 @@ export class Databases {
10611081
* @param {number} min
10621082
* @param {number} max
10631083
* @param {number} xdefault
1084+
* @param {string} newKey
10641085
* @throws {AppwriteException}
10651086
* @returns {Promise<Models.AttributeInteger>}
10661087
*/
1067-
async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger> {
1088+
async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise<Models.AttributeInteger> {
10681089
if (typeof databaseId === 'undefined') {
10691090
throw new AppwriteException('Missing required parameter: "databaseId"');
10701091
}
@@ -1100,6 +1121,9 @@ export class Databases {
11001121
if (typeof xdefault !== 'undefined') {
11011122
payload['default'] = xdefault;
11021123
}
1124+
if (typeof newKey !== 'undefined') {
1125+
payload['newKey'] = newKey;
1126+
}
11031127
const uri = new URL(this.client.config.endpoint + apiPath);
11041128

11051129
const apiHeaders: { [header: string]: string } = {
@@ -1179,10 +1203,11 @@ export class Databases {
11791203
* @param {string} key
11801204
* @param {boolean} required
11811205
* @param {string} xdefault
1206+
* @param {string} newKey
11821207
* @throws {AppwriteException}
11831208
* @returns {Promise<Models.AttributeIp>}
11841209
*/
1185-
async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp> {
1210+
async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp> {
11861211
if (typeof databaseId === 'undefined') {
11871212
throw new AppwriteException('Missing required parameter: "databaseId"');
11881213
}
@@ -1206,6 +1231,9 @@ export class Databases {
12061231
if (typeof xdefault !== 'undefined') {
12071232
payload['default'] = xdefault;
12081233
}
1234+
if (typeof newKey !== 'undefined') {
1235+
payload['newKey'] = newKey;
1236+
}
12091237
const uri = new URL(this.client.config.endpoint + apiPath);
12101238

12111239
const apiHeaders: { [header: string]: string } = {
@@ -1359,10 +1387,12 @@ export class Databases {
13591387
* @param {string} key
13601388
* @param {boolean} required
13611389
* @param {string} xdefault
1390+
* @param {number} size
1391+
* @param {string} newKey
13621392
* @throws {AppwriteException}
13631393
* @returns {Promise<Models.AttributeString>}
13641394
*/
1365-
async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString> {
1395+
async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString> {
13661396
if (typeof databaseId === 'undefined') {
13671397
throw new AppwriteException('Missing required parameter: "databaseId"');
13681398
}
@@ -1386,6 +1416,12 @@ export class Databases {
13861416
if (typeof xdefault !== 'undefined') {
13871417
payload['default'] = xdefault;
13881418
}
1419+
if (typeof size !== 'undefined') {
1420+
payload['size'] = size;
1421+
}
1422+
if (typeof newKey !== 'undefined') {
1423+
payload['newKey'] = newKey;
1424+
}
13891425
const uri = new URL(this.client.config.endpoint + apiPath);
13901426

13911427
const apiHeaders: { [header: string]: string } = {
@@ -1465,10 +1501,11 @@ export class Databases {
14651501
* @param {string} key
14661502
* @param {boolean} required
14671503
* @param {string} xdefault
1504+
* @param {string} newKey
14681505
* @throws {AppwriteException}
14691506
* @returns {Promise<Models.AttributeUrl>}
14701507
*/
1471-
async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl> {
1508+
async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl> {
14721509
if (typeof databaseId === 'undefined') {
14731510
throw new AppwriteException('Missing required parameter: "databaseId"');
14741511
}
@@ -1492,6 +1529,9 @@ export class Databases {
14921529
if (typeof xdefault !== 'undefined') {
14931530
payload['default'] = xdefault;
14941531
}
1532+
if (typeof newKey !== 'undefined') {
1533+
payload['newKey'] = newKey;
1534+
}
14951535
const uri = new URL(this.client.config.endpoint + apiPath);
14961536

14971537
const apiHeaders: { [header: string]: string } = {
@@ -1587,10 +1627,11 @@ export class Databases {
15871627
* @param {string} collectionId
15881628
* @param {string} key
15891629
* @param {RelationMutate} onDelete
1630+
* @param {string} newKey
15901631
* @throws {AppwriteException}
15911632
* @returns {Promise<Models.AttributeRelationship>}
15921633
*/
1593-
async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship> {
1634+
async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship> {
15941635
if (typeof databaseId === 'undefined') {
15951636
throw new AppwriteException('Missing required parameter: "databaseId"');
15961637
}
@@ -1605,6 +1646,9 @@ export class Databases {
16051646
if (typeof onDelete !== 'undefined') {
16061647
payload['onDelete'] = onDelete;
16071648
}
1649+
if (typeof newKey !== 'undefined') {
1650+
payload['newKey'] = newKey;
1651+
}
16081652
const uri = new URL(this.client.config.endpoint + apiPath);
16091653

16101654
const apiHeaders: { [header: string]: string } = {

0 commit comments

Comments
 (0)