node-appwrite 17.1.0 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +67 -2
  2. package/dist/client.js +3 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +3 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/{v-c-s-deployment-type.js → vcs-deployment-type.js} +1 -1
  7. package/dist/enums/vcs-deployment-type.js.map +1 -0
  8. package/dist/enums/{v-c-s-deployment-type.mjs → vcs-deployment-type.mjs} +2 -2
  9. package/dist/enums/vcs-deployment-type.mjs.map +1 -0
  10. package/dist/index.d.mts +2 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +7 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +2 -1
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/models.d.mts +829 -145
  17. package/dist/models.d.ts +829 -145
  18. package/dist/query.d.mts +70 -0
  19. package/dist/query.d.ts +70 -0
  20. package/dist/query.js +70 -0
  21. package/dist/query.js.map +1 -1
  22. package/dist/query.mjs +70 -0
  23. package/dist/query.mjs.map +1 -1
  24. package/dist/services/account.d.mts +656 -101
  25. package/dist/services/account.d.ts +656 -101
  26. package/dist/services/account.js +592 -292
  27. package/dist/services/account.js.map +1 -1
  28. package/dist/services/account.mjs +592 -292
  29. package/dist/services/account.mjs.map +1 -1
  30. package/dist/services/avatars.d.mts +176 -45
  31. package/dist/services/avatars.d.ts +176 -45
  32. package/dist/services/avatars.js +104 -93
  33. package/dist/services/avatars.js.map +1 -1
  34. package/dist/services/avatars.mjs +104 -93
  35. package/dist/services/avatars.mjs.map +1 -1
  36. package/dist/services/databases.d.mts +1274 -271
  37. package/dist/services/databases.d.ts +1274 -271
  38. package/dist/services/databases.js +939 -584
  39. package/dist/services/databases.js.map +1 -1
  40. package/dist/services/databases.mjs +939 -584
  41. package/dist/services/databases.mjs.map +1 -1
  42. package/dist/services/functions.d.mts +537 -114
  43. package/dist/services/functions.d.ts +537 -114
  44. package/dist/services/functions.js +393 -276
  45. package/dist/services/functions.js.map +1 -1
  46. package/dist/services/functions.mjs +393 -276
  47. package/dist/services/functions.mjs.map +1 -1
  48. package/dist/services/graphql.d.mts +24 -2
  49. package/dist/services/graphql.d.ts +24 -2
  50. package/dist/services/graphql.js +20 -16
  51. package/dist/services/graphql.js.map +1 -1
  52. package/dist/services/graphql.mjs +20 -16
  53. package/dist/services/graphql.mjs.map +1 -1
  54. package/dist/services/health.d.mts +176 -17
  55. package/dist/services/health.d.ts +176 -17
  56. package/dist/services/health.js +144 -115
  57. package/dist/services/health.js.map +1 -1
  58. package/dist/services/health.mjs +144 -115
  59. package/dist/services/health.mjs.map +1 -1
  60. package/dist/services/locale.d.mts +2 -2
  61. package/dist/services/locale.d.ts +2 -2
  62. package/dist/services/locale.js +7 -7
  63. package/dist/services/locale.js.map +1 -1
  64. package/dist/services/locale.mjs +7 -7
  65. package/dist/services/locale.mjs.map +1 -1
  66. package/dist/services/messaging.d.mts +1552 -270
  67. package/dist/services/messaging.d.ts +1552 -270
  68. package/dist/services/messaging.js +1417 -592
  69. package/dist/services/messaging.js.map +1 -1
  70. package/dist/services/messaging.mjs +1417 -592
  71. package/dist/services/messaging.mjs.map +1 -1
  72. package/dist/services/sites.d.mts +499 -103
  73. package/dist/services/sites.d.ts +499 -103
  74. package/dist/services/sites.js +371 -258
  75. package/dist/services/sites.js.map +1 -1
  76. package/dist/services/sites.mjs +371 -258
  77. package/dist/services/sites.mjs.map +1 -1
  78. package/dist/services/storage.d.mts +311 -68
  79. package/dist/services/storage.d.ts +311 -68
  80. package/dist/services/storage.js +225 -158
  81. package/dist/services/storage.js.map +1 -1
  82. package/dist/services/storage.mjs +225 -158
  83. package/dist/services/storage.mjs.map +1 -1
  84. package/dist/services/tables-db.d.mts +1549 -0
  85. package/dist/services/tables-db.d.ts +1549 -0
  86. package/dist/services/tables-db.js +2374 -0
  87. package/dist/services/tables-db.js.map +1 -0
  88. package/dist/services/tables-db.mjs +2373 -0
  89. package/dist/services/tables-db.mjs.map +1 -0
  90. package/dist/services/teams.d.mts +249 -55
  91. package/dist/services/teams.d.ts +249 -55
  92. package/dist/services/teams.js +170 -135
  93. package/dist/services/teams.js.map +1 -1
  94. package/dist/services/teams.mjs +170 -135
  95. package/dist/services/teams.mjs.map +1 -1
  96. package/dist/services/tokens.d.mts +76 -11
  97. package/dist/services/tokens.d.ts +76 -11
  98. package/dist/services/tokens.js +60 -45
  99. package/dist/services/tokens.js.map +1 -1
  100. package/dist/services/tokens.mjs +60 -45
  101. package/dist/services/tokens.mjs.map +1 -1
  102. package/dist/services/users.d.mts +867 -140
  103. package/dist/services/users.d.ts +867 -140
  104. package/dist/services/users.js +719 -408
  105. package/dist/services/users.js.map +1 -1
  106. package/dist/services/users.mjs +719 -408
  107. package/dist/services/users.mjs.map +1 -1
  108. package/package.json +1 -1
  109. package/dist/enums/v-c-s-deployment-type.js.map +0 -1
  110. package/dist/enums/v-c-s-deployment-type.mjs.map +0 -1
  111. /package/dist/enums/{v-c-s-deployment-type.d.mts → vcs-deployment-type.d.mts} +0 -0
  112. /package/dist/enums/{v-c-s-deployment-type.d.ts → vcs-deployment-type.d.ts} +0 -0
@@ -6,15 +6,18 @@ class Databases {
6
6
  constructor(client) {
7
7
  this.client = client;
8
8
  }
9
- /**
10
- * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
11
- *
12
- * @param {string[]} queries
13
- * @param {string} search
14
- * @throws {AppwriteException}
15
- * @returns {Promise<Models.DatabaseList>}
16
- */
17
- list(queries, search) {
9
+ list(paramsOrFirst, ...rest) {
10
+ let params;
11
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
12
+ params = paramsOrFirst || {};
13
+ } else {
14
+ params = {
15
+ queries: paramsOrFirst,
16
+ search: rest[0]
17
+ };
18
+ }
19
+ const queries = params.queries;
20
+ const search = params.search;
18
21
  const apiPath = "/databases";
19
22
  const payload = {};
20
23
  if (typeof queries !== "undefined") {
@@ -32,17 +35,20 @@ class Databases {
32
35
  payload
33
36
  );
34
37
  }
35
- /**
36
- * Create a new Database.
37
-
38
- *
39
- * @param {string} databaseId
40
- * @param {string} name
41
- * @param {boolean} enabled
42
- * @throws {AppwriteException}
43
- * @returns {Promise<Models.Database>}
44
- */
45
- create(databaseId, name, enabled) {
38
+ create(paramsOrFirst, ...rest) {
39
+ let params;
40
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
41
+ params = paramsOrFirst || {};
42
+ } else {
43
+ params = {
44
+ databaseId: paramsOrFirst,
45
+ name: rest[0],
46
+ enabled: rest[1]
47
+ };
48
+ }
49
+ const databaseId = params.databaseId;
50
+ const name = params.name;
51
+ const enabled = params.enabled;
46
52
  if (typeof databaseId === "undefined") {
47
53
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
48
54
  }
@@ -71,14 +77,16 @@ class Databases {
71
77
  payload
72
78
  );
73
79
  }
74
- /**
75
- * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
76
- *
77
- * @param {string} databaseId
78
- * @throws {AppwriteException}
79
- * @returns {Promise<Models.Database>}
80
- */
81
- get(databaseId) {
80
+ get(paramsOrFirst) {
81
+ let params;
82
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
83
+ params = paramsOrFirst || {};
84
+ } else {
85
+ params = {
86
+ databaseId: paramsOrFirst
87
+ };
88
+ }
89
+ const databaseId = params.databaseId;
82
90
  if (typeof databaseId === "undefined") {
83
91
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
84
92
  }
@@ -93,16 +101,20 @@ class Databases {
93
101
  payload
94
102
  );
95
103
  }
96
- /**
97
- * Update a database by its unique ID.
98
- *
99
- * @param {string} databaseId
100
- * @param {string} name
101
- * @param {boolean} enabled
102
- * @throws {AppwriteException}
103
- * @returns {Promise<Models.Database>}
104
- */
105
- update(databaseId, name, enabled) {
104
+ update(paramsOrFirst, ...rest) {
105
+ let params;
106
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
107
+ params = paramsOrFirst || {};
108
+ } else {
109
+ params = {
110
+ databaseId: paramsOrFirst,
111
+ name: rest[0],
112
+ enabled: rest[1]
113
+ };
114
+ }
115
+ const databaseId = params.databaseId;
116
+ const name = params.name;
117
+ const enabled = params.enabled;
106
118
  if (typeof databaseId === "undefined") {
107
119
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
108
120
  }
@@ -128,14 +140,16 @@ class Databases {
128
140
  payload
129
141
  );
130
142
  }
131
- /**
132
- * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
133
- *
134
- * @param {string} databaseId
135
- * @throws {AppwriteException}
136
- * @returns {Promise<{}>}
137
- */
138
- delete(databaseId) {
143
+ delete(paramsOrFirst) {
144
+ let params;
145
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
146
+ params = paramsOrFirst || {};
147
+ } else {
148
+ params = {
149
+ databaseId: paramsOrFirst
150
+ };
151
+ }
152
+ const databaseId = params.databaseId;
139
153
  if (typeof databaseId === "undefined") {
140
154
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
141
155
  }
@@ -152,16 +166,20 @@ class Databases {
152
166
  payload
153
167
  );
154
168
  }
155
- /**
156
- * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
157
- *
158
- * @param {string} databaseId
159
- * @param {string[]} queries
160
- * @param {string} search
161
- * @throws {AppwriteException}
162
- * @returns {Promise<Models.CollectionList>}
163
- */
164
- listCollections(databaseId, queries, search) {
169
+ listCollections(paramsOrFirst, ...rest) {
170
+ let params;
171
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
172
+ params = paramsOrFirst || {};
173
+ } else {
174
+ params = {
175
+ databaseId: paramsOrFirst,
176
+ queries: rest[0],
177
+ search: rest[1]
178
+ };
179
+ }
180
+ const databaseId = params.databaseId;
181
+ const queries = params.queries;
182
+ const search = params.search;
165
183
  if (typeof databaseId === "undefined") {
166
184
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
167
185
  }
@@ -182,19 +200,26 @@ class Databases {
182
200
  payload
183
201
  );
184
202
  }
185
- /**
186
- * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
187
- *
188
- * @param {string} databaseId
189
- * @param {string} collectionId
190
- * @param {string} name
191
- * @param {string[]} permissions
192
- * @param {boolean} documentSecurity
193
- * @param {boolean} enabled
194
- * @throws {AppwriteException}
195
- * @returns {Promise<Models.Collection>}
196
- */
197
- createCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) {
203
+ createCollection(paramsOrFirst, ...rest) {
204
+ let params;
205
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
206
+ params = paramsOrFirst || {};
207
+ } else {
208
+ params = {
209
+ databaseId: paramsOrFirst,
210
+ collectionId: rest[0],
211
+ name: rest[1],
212
+ permissions: rest[2],
213
+ documentSecurity: rest[3],
214
+ enabled: rest[4]
215
+ };
216
+ }
217
+ const databaseId = params.databaseId;
218
+ const collectionId = params.collectionId;
219
+ const name = params.name;
220
+ const permissions = params.permissions;
221
+ const documentSecurity = params.documentSecurity;
222
+ const enabled = params.enabled;
198
223
  if (typeof databaseId === "undefined") {
199
224
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
200
225
  }
@@ -232,15 +257,18 @@ class Databases {
232
257
  payload
233
258
  );
234
259
  }
235
- /**
236
- * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
237
- *
238
- * @param {string} databaseId
239
- * @param {string} collectionId
240
- * @throws {AppwriteException}
241
- * @returns {Promise<Models.Collection>}
242
- */
243
- getCollection(databaseId, collectionId) {
260
+ getCollection(paramsOrFirst, ...rest) {
261
+ let params;
262
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
263
+ params = paramsOrFirst || {};
264
+ } else {
265
+ params = {
266
+ databaseId: paramsOrFirst,
267
+ collectionId: rest[0]
268
+ };
269
+ }
270
+ const databaseId = params.databaseId;
271
+ const collectionId = params.collectionId;
244
272
  if (typeof databaseId === "undefined") {
245
273
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
246
274
  }
@@ -258,19 +286,26 @@ class Databases {
258
286
  payload
259
287
  );
260
288
  }
261
- /**
262
- * Update a collection by its unique ID.
263
- *
264
- * @param {string} databaseId
265
- * @param {string} collectionId
266
- * @param {string} name
267
- * @param {string[]} permissions
268
- * @param {boolean} documentSecurity
269
- * @param {boolean} enabled
270
- * @throws {AppwriteException}
271
- * @returns {Promise<Models.Collection>}
272
- */
273
- updateCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) {
289
+ updateCollection(paramsOrFirst, ...rest) {
290
+ let params;
291
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
292
+ params = paramsOrFirst || {};
293
+ } else {
294
+ params = {
295
+ databaseId: paramsOrFirst,
296
+ collectionId: rest[0],
297
+ name: rest[1],
298
+ permissions: rest[2],
299
+ documentSecurity: rest[3],
300
+ enabled: rest[4]
301
+ };
302
+ }
303
+ const databaseId = params.databaseId;
304
+ const collectionId = params.collectionId;
305
+ const name = params.name;
306
+ const permissions = params.permissions;
307
+ const documentSecurity = params.documentSecurity;
308
+ const enabled = params.enabled;
274
309
  if (typeof databaseId === "undefined") {
275
310
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
276
311
  }
@@ -305,15 +340,18 @@ class Databases {
305
340
  payload
306
341
  );
307
342
  }
308
- /**
309
- * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
310
- *
311
- * @param {string} databaseId
312
- * @param {string} collectionId
313
- * @throws {AppwriteException}
314
- * @returns {Promise<{}>}
315
- */
316
- deleteCollection(databaseId, collectionId) {
343
+ deleteCollection(paramsOrFirst, ...rest) {
344
+ let params;
345
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
346
+ params = paramsOrFirst || {};
347
+ } else {
348
+ params = {
349
+ databaseId: paramsOrFirst,
350
+ collectionId: rest[0]
351
+ };
352
+ }
353
+ const databaseId = params.databaseId;
354
+ const collectionId = params.collectionId;
317
355
  if (typeof databaseId === "undefined") {
318
356
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
319
357
  }
@@ -333,16 +371,20 @@ class Databases {
333
371
  payload
334
372
  );
335
373
  }
336
- /**
337
- * List attributes in the collection.
338
- *
339
- * @param {string} databaseId
340
- * @param {string} collectionId
341
- * @param {string[]} queries
342
- * @throws {AppwriteException}
343
- * @returns {Promise<Models.AttributeList>}
344
- */
345
- listAttributes(databaseId, collectionId, queries) {
374
+ listAttributes(paramsOrFirst, ...rest) {
375
+ let params;
376
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
377
+ params = paramsOrFirst || {};
378
+ } else {
379
+ params = {
380
+ databaseId: paramsOrFirst,
381
+ collectionId: rest[0],
382
+ queries: rest[1]
383
+ };
384
+ }
385
+ const databaseId = params.databaseId;
386
+ const collectionId = params.collectionId;
387
+ const queries = params.queries;
346
388
  if (typeof databaseId === "undefined") {
347
389
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
348
390
  }
@@ -363,20 +405,26 @@ class Databases {
363
405
  payload
364
406
  );
365
407
  }
366
- /**
367
- * Create a boolean attribute.
368
-
369
- *
370
- * @param {string} databaseId
371
- * @param {string} collectionId
372
- * @param {string} key
373
- * @param {boolean} required
374
- * @param {boolean} xdefault
375
- * @param {boolean} array
376
- * @throws {AppwriteException}
377
- * @returns {Promise<Models.AttributeBoolean>}
378
- */
379
- createBooleanAttribute(databaseId, collectionId, key, required, xdefault, array) {
408
+ createBooleanAttribute(paramsOrFirst, ...rest) {
409
+ let params;
410
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
411
+ params = paramsOrFirst || {};
412
+ } else {
413
+ params = {
414
+ databaseId: paramsOrFirst,
415
+ collectionId: rest[0],
416
+ key: rest[1],
417
+ required: rest[2],
418
+ xdefault: rest[3],
419
+ array: rest[4]
420
+ };
421
+ }
422
+ const databaseId = params.databaseId;
423
+ const collectionId = params.collectionId;
424
+ const key = params.key;
425
+ const required = params.required;
426
+ const xdefault = params.xdefault;
427
+ const array = params.array;
380
428
  if (typeof databaseId === "undefined") {
381
429
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
382
430
  }
@@ -414,19 +462,26 @@ class Databases {
414
462
  payload
415
463
  );
416
464
  }
417
- /**
418
- * Update a boolean attribute. Changing the `default` value will not update already existing documents.
419
- *
420
- * @param {string} databaseId
421
- * @param {string} collectionId
422
- * @param {string} key
423
- * @param {boolean} required
424
- * @param {boolean} xdefault
425
- * @param {string} newKey
426
- * @throws {AppwriteException}
427
- * @returns {Promise<Models.AttributeBoolean>}
428
- */
429
- updateBooleanAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
465
+ updateBooleanAttribute(paramsOrFirst, ...rest) {
466
+ let params;
467
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
468
+ params = paramsOrFirst || {};
469
+ } else {
470
+ params = {
471
+ databaseId: paramsOrFirst,
472
+ collectionId: rest[0],
473
+ key: rest[1],
474
+ required: rest[2],
475
+ xdefault: rest[3],
476
+ newKey: rest[4]
477
+ };
478
+ }
479
+ const databaseId = params.databaseId;
480
+ const collectionId = params.collectionId;
481
+ const key = params.key;
482
+ const required = params.required;
483
+ const xdefault = params.xdefault;
484
+ const newKey = params.newKey;
430
485
  if (typeof databaseId === "undefined") {
431
486
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
432
487
  }
@@ -464,19 +519,26 @@ class Databases {
464
519
  payload
465
520
  );
466
521
  }
467
- /**
468
- * Create a date time attribute according to the ISO 8601 standard.
469
- *
470
- * @param {string} databaseId
471
- * @param {string} collectionId
472
- * @param {string} key
473
- * @param {boolean} required
474
- * @param {string} xdefault
475
- * @param {boolean} array
476
- * @throws {AppwriteException}
477
- * @returns {Promise<Models.AttributeDatetime>}
478
- */
479
- createDatetimeAttribute(databaseId, collectionId, key, required, xdefault, array) {
522
+ createDatetimeAttribute(paramsOrFirst, ...rest) {
523
+ let params;
524
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
525
+ params = paramsOrFirst || {};
526
+ } else {
527
+ params = {
528
+ databaseId: paramsOrFirst,
529
+ collectionId: rest[0],
530
+ key: rest[1],
531
+ required: rest[2],
532
+ xdefault: rest[3],
533
+ array: rest[4]
534
+ };
535
+ }
536
+ const databaseId = params.databaseId;
537
+ const collectionId = params.collectionId;
538
+ const key = params.key;
539
+ const required = params.required;
540
+ const xdefault = params.xdefault;
541
+ const array = params.array;
480
542
  if (typeof databaseId === "undefined") {
481
543
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
482
544
  }
@@ -514,19 +576,26 @@ class Databases {
514
576
  payload
515
577
  );
516
578
  }
517
- /**
518
- * Update a date time attribute. Changing the `default` value will not update already existing documents.
519
- *
520
- * @param {string} databaseId
521
- * @param {string} collectionId
522
- * @param {string} key
523
- * @param {boolean} required
524
- * @param {string} xdefault
525
- * @param {string} newKey
526
- * @throws {AppwriteException}
527
- * @returns {Promise<Models.AttributeDatetime>}
528
- */
529
- updateDatetimeAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
579
+ updateDatetimeAttribute(paramsOrFirst, ...rest) {
580
+ let params;
581
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
582
+ params = paramsOrFirst || {};
583
+ } else {
584
+ params = {
585
+ databaseId: paramsOrFirst,
586
+ collectionId: rest[0],
587
+ key: rest[1],
588
+ required: rest[2],
589
+ xdefault: rest[3],
590
+ newKey: rest[4]
591
+ };
592
+ }
593
+ const databaseId = params.databaseId;
594
+ const collectionId = params.collectionId;
595
+ const key = params.key;
596
+ const required = params.required;
597
+ const xdefault = params.xdefault;
598
+ const newKey = params.newKey;
530
599
  if (typeof databaseId === "undefined") {
531
600
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
532
601
  }
@@ -564,20 +633,26 @@ class Databases {
564
633
  payload
565
634
  );
566
635
  }
567
- /**
568
- * Create an email attribute.
569
-
570
- *
571
- * @param {string} databaseId
572
- * @param {string} collectionId
573
- * @param {string} key
574
- * @param {boolean} required
575
- * @param {string} xdefault
576
- * @param {boolean} array
577
- * @throws {AppwriteException}
578
- * @returns {Promise<Models.AttributeEmail>}
579
- */
580
- createEmailAttribute(databaseId, collectionId, key, required, xdefault, array) {
636
+ createEmailAttribute(paramsOrFirst, ...rest) {
637
+ let params;
638
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
639
+ params = paramsOrFirst || {};
640
+ } else {
641
+ params = {
642
+ databaseId: paramsOrFirst,
643
+ collectionId: rest[0],
644
+ key: rest[1],
645
+ required: rest[2],
646
+ xdefault: rest[3],
647
+ array: rest[4]
648
+ };
649
+ }
650
+ const databaseId = params.databaseId;
651
+ const collectionId = params.collectionId;
652
+ const key = params.key;
653
+ const required = params.required;
654
+ const xdefault = params.xdefault;
655
+ const array = params.array;
581
656
  if (typeof databaseId === "undefined") {
582
657
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
583
658
  }
@@ -615,20 +690,26 @@ class Databases {
615
690
  payload
616
691
  );
617
692
  }
618
- /**
619
- * Update an email attribute. Changing the `default` value will not update already existing documents.
620
-
621
- *
622
- * @param {string} databaseId
623
- * @param {string} collectionId
624
- * @param {string} key
625
- * @param {boolean} required
626
- * @param {string} xdefault
627
- * @param {string} newKey
628
- * @throws {AppwriteException}
629
- * @returns {Promise<Models.AttributeEmail>}
630
- */
631
- updateEmailAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
693
+ updateEmailAttribute(paramsOrFirst, ...rest) {
694
+ let params;
695
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
696
+ params = paramsOrFirst || {};
697
+ } else {
698
+ params = {
699
+ databaseId: paramsOrFirst,
700
+ collectionId: rest[0],
701
+ key: rest[1],
702
+ required: rest[2],
703
+ xdefault: rest[3],
704
+ newKey: rest[4]
705
+ };
706
+ }
707
+ const databaseId = params.databaseId;
708
+ const collectionId = params.collectionId;
709
+ const key = params.key;
710
+ const required = params.required;
711
+ const xdefault = params.xdefault;
712
+ const newKey = params.newKey;
632
713
  if (typeof databaseId === "undefined") {
633
714
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
634
715
  }
@@ -666,21 +747,28 @@ class Databases {
666
747
  payload
667
748
  );
668
749
  }
669
- /**
670
- * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute.
671
-
672
- *
673
- * @param {string} databaseId
674
- * @param {string} collectionId
675
- * @param {string} key
676
- * @param {string[]} elements
677
- * @param {boolean} required
678
- * @param {string} xdefault
679
- * @param {boolean} array
680
- * @throws {AppwriteException}
681
- * @returns {Promise<Models.AttributeEnum>}
682
- */
683
- createEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, array) {
750
+ createEnumAttribute(paramsOrFirst, ...rest) {
751
+ let params;
752
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
753
+ params = paramsOrFirst || {};
754
+ } else {
755
+ params = {
756
+ databaseId: paramsOrFirst,
757
+ collectionId: rest[0],
758
+ key: rest[1],
759
+ elements: rest[2],
760
+ required: rest[3],
761
+ xdefault: rest[4],
762
+ array: rest[5]
763
+ };
764
+ }
765
+ const databaseId = params.databaseId;
766
+ const collectionId = params.collectionId;
767
+ const key = params.key;
768
+ const elements = params.elements;
769
+ const required = params.required;
770
+ const xdefault = params.xdefault;
771
+ const array = params.array;
684
772
  if (typeof databaseId === "undefined") {
685
773
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
686
774
  }
@@ -724,21 +812,28 @@ class Databases {
724
812
  payload
725
813
  );
726
814
  }
727
- /**
728
- * Update an enum attribute. Changing the `default` value will not update already existing documents.
729
-
730
- *
731
- * @param {string} databaseId
732
- * @param {string} collectionId
733
- * @param {string} key
734
- * @param {string[]} elements
735
- * @param {boolean} required
736
- * @param {string} xdefault
737
- * @param {string} newKey
738
- * @throws {AppwriteException}
739
- * @returns {Promise<Models.AttributeEnum>}
740
- */
741
- updateEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, newKey) {
815
+ updateEnumAttribute(paramsOrFirst, ...rest) {
816
+ let params;
817
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
818
+ params = paramsOrFirst || {};
819
+ } else {
820
+ params = {
821
+ databaseId: paramsOrFirst,
822
+ collectionId: rest[0],
823
+ key: rest[1],
824
+ elements: rest[2],
825
+ required: rest[3],
826
+ xdefault: rest[4],
827
+ newKey: rest[5]
828
+ };
829
+ }
830
+ const databaseId = params.databaseId;
831
+ const collectionId = params.collectionId;
832
+ const key = params.key;
833
+ const elements = params.elements;
834
+ const required = params.required;
835
+ const xdefault = params.xdefault;
836
+ const newKey = params.newKey;
742
837
  if (typeof databaseId === "undefined") {
743
838
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
744
839
  }
@@ -782,22 +877,30 @@ class Databases {
782
877
  payload
783
878
  );
784
879
  }
785
- /**
786
- * Create a float attribute. Optionally, minimum and maximum values can be provided.
787
-
788
- *
789
- * @param {string} databaseId
790
- * @param {string} collectionId
791
- * @param {string} key
792
- * @param {boolean} required
793
- * @param {number} min
794
- * @param {number} max
795
- * @param {number} xdefault
796
- * @param {boolean} array
797
- * @throws {AppwriteException}
798
- * @returns {Promise<Models.AttributeFloat>}
799
- */
800
- createFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
880
+ createFloatAttribute(paramsOrFirst, ...rest) {
881
+ let params;
882
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
883
+ params = paramsOrFirst || {};
884
+ } else {
885
+ params = {
886
+ databaseId: paramsOrFirst,
887
+ collectionId: rest[0],
888
+ key: rest[1],
889
+ required: rest[2],
890
+ min: rest[3],
891
+ max: rest[4],
892
+ xdefault: rest[5],
893
+ array: rest[6]
894
+ };
895
+ }
896
+ const databaseId = params.databaseId;
897
+ const collectionId = params.collectionId;
898
+ const key = params.key;
899
+ const required = params.required;
900
+ const min = params.min;
901
+ const max = params.max;
902
+ const xdefault = params.xdefault;
903
+ const array = params.array;
801
904
  if (typeof databaseId === "undefined") {
802
905
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
803
906
  }
@@ -841,22 +944,30 @@ class Databases {
841
944
  payload
842
945
  );
843
946
  }
844
- /**
845
- * Update a float attribute. Changing the `default` value will not update already existing documents.
846
-
847
- *
848
- * @param {string} databaseId
849
- * @param {string} collectionId
850
- * @param {string} key
851
- * @param {boolean} required
852
- * @param {number} xdefault
853
- * @param {number} min
854
- * @param {number} max
855
- * @param {string} newKey
856
- * @throws {AppwriteException}
857
- * @returns {Promise<Models.AttributeFloat>}
858
- */
859
- updateFloatAttribute(databaseId, collectionId, key, required, xdefault, min, max, newKey) {
947
+ updateFloatAttribute(paramsOrFirst, ...rest) {
948
+ let params;
949
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
950
+ params = paramsOrFirst || {};
951
+ } else {
952
+ params = {
953
+ databaseId: paramsOrFirst,
954
+ collectionId: rest[0],
955
+ key: rest[1],
956
+ required: rest[2],
957
+ xdefault: rest[3],
958
+ min: rest[4],
959
+ max: rest[5],
960
+ newKey: rest[6]
961
+ };
962
+ }
963
+ const databaseId = params.databaseId;
964
+ const collectionId = params.collectionId;
965
+ const key = params.key;
966
+ const required = params.required;
967
+ const xdefault = params.xdefault;
968
+ const min = params.min;
969
+ const max = params.max;
970
+ const newKey = params.newKey;
860
971
  if (typeof databaseId === "undefined") {
861
972
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
862
973
  }
@@ -900,22 +1011,30 @@ class Databases {
900
1011
  payload
901
1012
  );
902
1013
  }
903
- /**
904
- * Create an integer attribute. Optionally, minimum and maximum values can be provided.
905
-
906
- *
907
- * @param {string} databaseId
908
- * @param {string} collectionId
909
- * @param {string} key
910
- * @param {boolean} required
911
- * @param {number} min
912
- * @param {number} max
913
- * @param {number} xdefault
914
- * @param {boolean} array
915
- * @throws {AppwriteException}
916
- * @returns {Promise<Models.AttributeInteger>}
917
- */
918
- createIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
1014
+ createIntegerAttribute(paramsOrFirst, ...rest) {
1015
+ let params;
1016
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1017
+ params = paramsOrFirst || {};
1018
+ } else {
1019
+ params = {
1020
+ databaseId: paramsOrFirst,
1021
+ collectionId: rest[0],
1022
+ key: rest[1],
1023
+ required: rest[2],
1024
+ min: rest[3],
1025
+ max: rest[4],
1026
+ xdefault: rest[5],
1027
+ array: rest[6]
1028
+ };
1029
+ }
1030
+ const databaseId = params.databaseId;
1031
+ const collectionId = params.collectionId;
1032
+ const key = params.key;
1033
+ const required = params.required;
1034
+ const min = params.min;
1035
+ const max = params.max;
1036
+ const xdefault = params.xdefault;
1037
+ const array = params.array;
919
1038
  if (typeof databaseId === "undefined") {
920
1039
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
921
1040
  }
@@ -959,22 +1078,30 @@ class Databases {
959
1078
  payload
960
1079
  );
961
1080
  }
962
- /**
963
- * Update an integer attribute. Changing the `default` value will not update already existing documents.
964
-
965
- *
966
- * @param {string} databaseId
967
- * @param {string} collectionId
968
- * @param {string} key
969
- * @param {boolean} required
970
- * @param {number} xdefault
971
- * @param {number} min
972
- * @param {number} max
973
- * @param {string} newKey
974
- * @throws {AppwriteException}
975
- * @returns {Promise<Models.AttributeInteger>}
976
- */
977
- updateIntegerAttribute(databaseId, collectionId, key, required, xdefault, min, max, newKey) {
1081
+ updateIntegerAttribute(paramsOrFirst, ...rest) {
1082
+ let params;
1083
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1084
+ params = paramsOrFirst || {};
1085
+ } else {
1086
+ params = {
1087
+ databaseId: paramsOrFirst,
1088
+ collectionId: rest[0],
1089
+ key: rest[1],
1090
+ required: rest[2],
1091
+ xdefault: rest[3],
1092
+ min: rest[4],
1093
+ max: rest[5],
1094
+ newKey: rest[6]
1095
+ };
1096
+ }
1097
+ const databaseId = params.databaseId;
1098
+ const collectionId = params.collectionId;
1099
+ const key = params.key;
1100
+ const required = params.required;
1101
+ const xdefault = params.xdefault;
1102
+ const min = params.min;
1103
+ const max = params.max;
1104
+ const newKey = params.newKey;
978
1105
  if (typeof databaseId === "undefined") {
979
1106
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
980
1107
  }
@@ -1018,20 +1145,26 @@ class Databases {
1018
1145
  payload
1019
1146
  );
1020
1147
  }
1021
- /**
1022
- * Create IP address attribute.
1023
-
1024
- *
1025
- * @param {string} databaseId
1026
- * @param {string} collectionId
1027
- * @param {string} key
1028
- * @param {boolean} required
1029
- * @param {string} xdefault
1030
- * @param {boolean} array
1031
- * @throws {AppwriteException}
1032
- * @returns {Promise<Models.AttributeIp>}
1033
- */
1034
- createIpAttribute(databaseId, collectionId, key, required, xdefault, array) {
1148
+ createIpAttribute(paramsOrFirst, ...rest) {
1149
+ let params;
1150
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1151
+ params = paramsOrFirst || {};
1152
+ } else {
1153
+ params = {
1154
+ databaseId: paramsOrFirst,
1155
+ collectionId: rest[0],
1156
+ key: rest[1],
1157
+ required: rest[2],
1158
+ xdefault: rest[3],
1159
+ array: rest[4]
1160
+ };
1161
+ }
1162
+ const databaseId = params.databaseId;
1163
+ const collectionId = params.collectionId;
1164
+ const key = params.key;
1165
+ const required = params.required;
1166
+ const xdefault = params.xdefault;
1167
+ const array = params.array;
1035
1168
  if (typeof databaseId === "undefined") {
1036
1169
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1037
1170
  }
@@ -1069,20 +1202,26 @@ class Databases {
1069
1202
  payload
1070
1203
  );
1071
1204
  }
1072
- /**
1073
- * Update an ip attribute. Changing the `default` value will not update already existing documents.
1074
-
1075
- *
1076
- * @param {string} databaseId
1077
- * @param {string} collectionId
1078
- * @param {string} key
1079
- * @param {boolean} required
1080
- * @param {string} xdefault
1081
- * @param {string} newKey
1082
- * @throws {AppwriteException}
1083
- * @returns {Promise<Models.AttributeIp>}
1084
- */
1085
- updateIpAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
1205
+ updateIpAttribute(paramsOrFirst, ...rest) {
1206
+ let params;
1207
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1208
+ params = paramsOrFirst || {};
1209
+ } else {
1210
+ params = {
1211
+ databaseId: paramsOrFirst,
1212
+ collectionId: rest[0],
1213
+ key: rest[1],
1214
+ required: rest[2],
1215
+ xdefault: rest[3],
1216
+ newKey: rest[4]
1217
+ };
1218
+ }
1219
+ const databaseId = params.databaseId;
1220
+ const collectionId = params.collectionId;
1221
+ const key = params.key;
1222
+ const required = params.required;
1223
+ const xdefault = params.xdefault;
1224
+ const newKey = params.newKey;
1086
1225
  if (typeof databaseId === "undefined") {
1087
1226
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1088
1227
  }
@@ -1120,22 +1259,30 @@ class Databases {
1120
1259
  payload
1121
1260
  );
1122
1261
  }
1123
- /**
1124
- * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1125
-
1126
- *
1127
- * @param {string} databaseId
1128
- * @param {string} collectionId
1129
- * @param {string} relatedCollectionId
1130
- * @param {RelationshipType} type
1131
- * @param {boolean} twoWay
1132
- * @param {string} key
1133
- * @param {string} twoWayKey
1134
- * @param {RelationMutate} onDelete
1135
- * @throws {AppwriteException}
1136
- * @returns {Promise<Models.AttributeRelationship>}
1137
- */
1138
- createRelationshipAttribute(databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete) {
1262
+ createRelationshipAttribute(paramsOrFirst, ...rest) {
1263
+ let params;
1264
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1265
+ params = paramsOrFirst || {};
1266
+ } else {
1267
+ params = {
1268
+ databaseId: paramsOrFirst,
1269
+ collectionId: rest[0],
1270
+ relatedCollectionId: rest[1],
1271
+ type: rest[2],
1272
+ twoWay: rest[3],
1273
+ key: rest[4],
1274
+ twoWayKey: rest[5],
1275
+ onDelete: rest[6]
1276
+ };
1277
+ }
1278
+ const databaseId = params.databaseId;
1279
+ const collectionId = params.collectionId;
1280
+ const relatedCollectionId = params.relatedCollectionId;
1281
+ const type = params.type;
1282
+ const twoWay = params.twoWay;
1283
+ const key = params.key;
1284
+ const twoWayKey = params.twoWayKey;
1285
+ const onDelete = params.onDelete;
1139
1286
  if (typeof databaseId === "undefined") {
1140
1287
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1141
1288
  }
@@ -1179,22 +1326,30 @@ class Databases {
1179
1326
  payload
1180
1327
  );
1181
1328
  }
1182
- /**
1183
- * Create a string attribute.
1184
-
1185
- *
1186
- * @param {string} databaseId
1187
- * @param {string} collectionId
1188
- * @param {string} key
1189
- * @param {number} size
1190
- * @param {boolean} required
1191
- * @param {string} xdefault
1192
- * @param {boolean} array
1193
- * @param {boolean} encrypt
1194
- * @throws {AppwriteException}
1195
- * @returns {Promise<Models.AttributeString>}
1196
- */
1197
- createStringAttribute(databaseId, collectionId, key, size, required, xdefault, array, encrypt) {
1329
+ createStringAttribute(paramsOrFirst, ...rest) {
1330
+ let params;
1331
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1332
+ params = paramsOrFirst || {};
1333
+ } else {
1334
+ params = {
1335
+ databaseId: paramsOrFirst,
1336
+ collectionId: rest[0],
1337
+ key: rest[1],
1338
+ size: rest[2],
1339
+ required: rest[3],
1340
+ xdefault: rest[4],
1341
+ array: rest[5],
1342
+ encrypt: rest[6]
1343
+ };
1344
+ }
1345
+ const databaseId = params.databaseId;
1346
+ const collectionId = params.collectionId;
1347
+ const key = params.key;
1348
+ const size = params.size;
1349
+ const required = params.required;
1350
+ const xdefault = params.xdefault;
1351
+ const array = params.array;
1352
+ const encrypt = params.encrypt;
1198
1353
  if (typeof databaseId === "undefined") {
1199
1354
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1200
1355
  }
@@ -1241,21 +1396,28 @@ class Databases {
1241
1396
  payload
1242
1397
  );
1243
1398
  }
1244
- /**
1245
- * Update a string attribute. Changing the `default` value will not update already existing documents.
1246
-
1247
- *
1248
- * @param {string} databaseId
1249
- * @param {string} collectionId
1250
- * @param {string} key
1251
- * @param {boolean} required
1252
- * @param {string} xdefault
1253
- * @param {number} size
1254
- * @param {string} newKey
1255
- * @throws {AppwriteException}
1256
- * @returns {Promise<Models.AttributeString>}
1257
- */
1258
- updateStringAttribute(databaseId, collectionId, key, required, xdefault, size, newKey) {
1399
+ updateStringAttribute(paramsOrFirst, ...rest) {
1400
+ let params;
1401
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1402
+ params = paramsOrFirst || {};
1403
+ } else {
1404
+ params = {
1405
+ databaseId: paramsOrFirst,
1406
+ collectionId: rest[0],
1407
+ key: rest[1],
1408
+ required: rest[2],
1409
+ xdefault: rest[3],
1410
+ size: rest[4],
1411
+ newKey: rest[5]
1412
+ };
1413
+ }
1414
+ const databaseId = params.databaseId;
1415
+ const collectionId = params.collectionId;
1416
+ const key = params.key;
1417
+ const required = params.required;
1418
+ const xdefault = params.xdefault;
1419
+ const size = params.size;
1420
+ const newKey = params.newKey;
1259
1421
  if (typeof databaseId === "undefined") {
1260
1422
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1261
1423
  }
@@ -1296,20 +1458,26 @@ class Databases {
1296
1458
  payload
1297
1459
  );
1298
1460
  }
1299
- /**
1300
- * Create a URL attribute.
1301
-
1302
- *
1303
- * @param {string} databaseId
1304
- * @param {string} collectionId
1305
- * @param {string} key
1306
- * @param {boolean} required
1307
- * @param {string} xdefault
1308
- * @param {boolean} array
1309
- * @throws {AppwriteException}
1310
- * @returns {Promise<Models.AttributeUrl>}
1311
- */
1312
- createUrlAttribute(databaseId, collectionId, key, required, xdefault, array) {
1461
+ createUrlAttribute(paramsOrFirst, ...rest) {
1462
+ let params;
1463
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1464
+ params = paramsOrFirst || {};
1465
+ } else {
1466
+ params = {
1467
+ databaseId: paramsOrFirst,
1468
+ collectionId: rest[0],
1469
+ key: rest[1],
1470
+ required: rest[2],
1471
+ xdefault: rest[3],
1472
+ array: rest[4]
1473
+ };
1474
+ }
1475
+ const databaseId = params.databaseId;
1476
+ const collectionId = params.collectionId;
1477
+ const key = params.key;
1478
+ const required = params.required;
1479
+ const xdefault = params.xdefault;
1480
+ const array = params.array;
1313
1481
  if (typeof databaseId === "undefined") {
1314
1482
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1315
1483
  }
@@ -1347,20 +1515,26 @@ class Databases {
1347
1515
  payload
1348
1516
  );
1349
1517
  }
1350
- /**
1351
- * Update an url attribute. Changing the `default` value will not update already existing documents.
1352
-
1353
- *
1354
- * @param {string} databaseId
1355
- * @param {string} collectionId
1356
- * @param {string} key
1357
- * @param {boolean} required
1358
- * @param {string} xdefault
1359
- * @param {string} newKey
1360
- * @throws {AppwriteException}
1361
- * @returns {Promise<Models.AttributeUrl>}
1362
- */
1363
- updateUrlAttribute(databaseId, collectionId, key, required, xdefault, newKey) {
1518
+ updateUrlAttribute(paramsOrFirst, ...rest) {
1519
+ let params;
1520
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1521
+ params = paramsOrFirst || {};
1522
+ } else {
1523
+ params = {
1524
+ databaseId: paramsOrFirst,
1525
+ collectionId: rest[0],
1526
+ key: rest[1],
1527
+ required: rest[2],
1528
+ xdefault: rest[3],
1529
+ newKey: rest[4]
1530
+ };
1531
+ }
1532
+ const databaseId = params.databaseId;
1533
+ const collectionId = params.collectionId;
1534
+ const key = params.key;
1535
+ const required = params.required;
1536
+ const xdefault = params.xdefault;
1537
+ const newKey = params.newKey;
1364
1538
  if (typeof databaseId === "undefined") {
1365
1539
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1366
1540
  }
@@ -1398,16 +1572,20 @@ class Databases {
1398
1572
  payload
1399
1573
  );
1400
1574
  }
1401
- /**
1402
- * Get attribute by ID.
1403
- *
1404
- * @param {string} databaseId
1405
- * @param {string} collectionId
1406
- * @param {string} key
1407
- * @throws {AppwriteException}
1408
- * @returns {Promise<{}>}
1409
- */
1410
- getAttribute(databaseId, collectionId, key) {
1575
+ getAttribute(paramsOrFirst, ...rest) {
1576
+ let params;
1577
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1578
+ params = paramsOrFirst || {};
1579
+ } else {
1580
+ params = {
1581
+ databaseId: paramsOrFirst,
1582
+ collectionId: rest[0],
1583
+ key: rest[1]
1584
+ };
1585
+ }
1586
+ const databaseId = params.databaseId;
1587
+ const collectionId = params.collectionId;
1588
+ const key = params.key;
1411
1589
  if (typeof databaseId === "undefined") {
1412
1590
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1413
1591
  }
@@ -1428,16 +1606,20 @@ class Databases {
1428
1606
  payload
1429
1607
  );
1430
1608
  }
1431
- /**
1432
- * Deletes an attribute.
1433
- *
1434
- * @param {string} databaseId
1435
- * @param {string} collectionId
1436
- * @param {string} key
1437
- * @throws {AppwriteException}
1438
- * @returns {Promise<{}>}
1439
- */
1440
- deleteAttribute(databaseId, collectionId, key) {
1609
+ deleteAttribute(paramsOrFirst, ...rest) {
1610
+ let params;
1611
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1612
+ params = paramsOrFirst || {};
1613
+ } else {
1614
+ params = {
1615
+ databaseId: paramsOrFirst,
1616
+ collectionId: rest[0],
1617
+ key: rest[1]
1618
+ };
1619
+ }
1620
+ const databaseId = params.databaseId;
1621
+ const collectionId = params.collectionId;
1622
+ const key = params.key;
1441
1623
  if (typeof databaseId === "undefined") {
1442
1624
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1443
1625
  }
@@ -1460,19 +1642,24 @@ class Databases {
1460
1642
  payload
1461
1643
  );
1462
1644
  }
1463
- /**
1464
- * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1465
-
1466
- *
1467
- * @param {string} databaseId
1468
- * @param {string} collectionId
1469
- * @param {string} key
1470
- * @param {RelationMutate} onDelete
1471
- * @param {string} newKey
1472
- * @throws {AppwriteException}
1473
- * @returns {Promise<Models.AttributeRelationship>}
1474
- */
1475
- updateRelationshipAttribute(databaseId, collectionId, key, onDelete, newKey) {
1645
+ updateRelationshipAttribute(paramsOrFirst, ...rest) {
1646
+ let params;
1647
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1648
+ params = paramsOrFirst || {};
1649
+ } else {
1650
+ params = {
1651
+ databaseId: paramsOrFirst,
1652
+ collectionId: rest[0],
1653
+ key: rest[1],
1654
+ onDelete: rest[2],
1655
+ newKey: rest[3]
1656
+ };
1657
+ }
1658
+ const databaseId = params.databaseId;
1659
+ const collectionId = params.collectionId;
1660
+ const key = params.key;
1661
+ const onDelete = params.onDelete;
1662
+ const newKey = params.newKey;
1476
1663
  if (typeof databaseId === "undefined") {
1477
1664
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1478
1665
  }
@@ -1501,16 +1688,20 @@ class Databases {
1501
1688
  payload
1502
1689
  );
1503
1690
  }
1504
- /**
1505
- * Get a list of all the user&#039;s documents in a given collection. You can use the query params to filter your results.
1506
- *
1507
- * @param {string} databaseId
1508
- * @param {string} collectionId
1509
- * @param {string[]} queries
1510
- * @throws {AppwriteException}
1511
- * @returns {Promise<Models.DocumentList<Document>>}
1512
- */
1513
- listDocuments(databaseId, collectionId, queries) {
1691
+ listDocuments(paramsOrFirst, ...rest) {
1692
+ let params;
1693
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1694
+ params = paramsOrFirst || {};
1695
+ } else {
1696
+ params = {
1697
+ databaseId: paramsOrFirst,
1698
+ collectionId: rest[0],
1699
+ queries: rest[1]
1700
+ };
1701
+ }
1702
+ const databaseId = params.databaseId;
1703
+ const collectionId = params.collectionId;
1704
+ const queries = params.queries;
1514
1705
  if (typeof databaseId === "undefined") {
1515
1706
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1516
1707
  }
@@ -1531,18 +1722,24 @@ class Databases {
1531
1722
  payload
1532
1723
  );
1533
1724
  }
1534
- /**
1535
- * 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.
1536
- *
1537
- * @param {string} databaseId
1538
- * @param {string} collectionId
1539
- * @param {string} documentId
1540
- * @param {Omit<Document, keyof Models.Document>} data
1541
- * @param {string[]} permissions
1542
- * @throws {AppwriteException}
1543
- * @returns {Promise<Document>}
1544
- */
1545
- createDocument(databaseId, collectionId, documentId, data, permissions) {
1725
+ createDocument(paramsOrFirst, ...rest) {
1726
+ let params;
1727
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1728
+ params = paramsOrFirst || {};
1729
+ } else {
1730
+ params = {
1731
+ databaseId: paramsOrFirst,
1732
+ collectionId: rest[0],
1733
+ documentId: rest[1],
1734
+ data: rest[2],
1735
+ permissions: rest[3]
1736
+ };
1737
+ }
1738
+ const databaseId = params.databaseId;
1739
+ const collectionId = params.collectionId;
1740
+ const documentId = params.documentId;
1741
+ const data = params.data;
1742
+ const permissions = params.permissions;
1546
1743
  if (typeof databaseId === "undefined") {
1547
1744
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1548
1745
  }
@@ -1555,6 +1752,9 @@ class Databases {
1555
1752
  if (typeof data === "undefined") {
1556
1753
  throw new client.AppwriteException('Missing required parameter: "data"');
1557
1754
  }
1755
+ data == null ? true : delete data.$sequence;
1756
+ data == null ? true : delete data.$collectionId;
1757
+ data == null ? true : delete data.$databaseId;
1558
1758
  const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1559
1759
  const payload = {};
1560
1760
  if (typeof documentId !== "undefined") {
@@ -1577,18 +1777,20 @@ class Databases {
1577
1777
  payload
1578
1778
  );
1579
1779
  }
1580
- /**
1581
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1582
-
1583
- Create new Documents. 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.
1584
- *
1585
- * @param {string} databaseId
1586
- * @param {string} collectionId
1587
- * @param {object[]} documents
1588
- * @throws {AppwriteException}
1589
- * @returns {Promise<Models.DocumentList<Document>>}
1590
- */
1591
- createDocuments(databaseId, collectionId, documents) {
1780
+ createDocuments(paramsOrFirst, ...rest) {
1781
+ let params;
1782
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1783
+ params = paramsOrFirst || {};
1784
+ } else {
1785
+ params = {
1786
+ databaseId: paramsOrFirst,
1787
+ collectionId: rest[0],
1788
+ documents: rest[1]
1789
+ };
1790
+ }
1791
+ const databaseId = params.databaseId;
1792
+ const collectionId = params.collectionId;
1793
+ const documents = params.documents;
1592
1794
  if (typeof databaseId === "undefined") {
1593
1795
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1594
1796
  }
@@ -1614,18 +1816,20 @@ class Databases {
1614
1816
  payload
1615
1817
  );
1616
1818
  }
1617
- /**
1618
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1619
-
1620
- Create or update Documents. 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.
1621
- *
1622
- * @param {string} databaseId
1623
- * @param {string} collectionId
1624
- * @param {object[]} documents
1625
- * @throws {AppwriteException}
1626
- * @returns {Promise<Models.DocumentList<Document>>}
1627
- */
1628
- upsertDocuments(databaseId, collectionId, documents) {
1819
+ upsertDocuments(paramsOrFirst, ...rest) {
1820
+ let params;
1821
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1822
+ params = paramsOrFirst || {};
1823
+ } else {
1824
+ params = {
1825
+ databaseId: paramsOrFirst,
1826
+ collectionId: rest[0],
1827
+ documents: rest[1]
1828
+ };
1829
+ }
1830
+ const databaseId = params.databaseId;
1831
+ const collectionId = params.collectionId;
1832
+ const documents = params.documents;
1629
1833
  if (typeof databaseId === "undefined") {
1630
1834
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1631
1835
  }
@@ -1651,19 +1855,22 @@ class Databases {
1651
1855
  payload
1652
1856
  );
1653
1857
  }
1654
- /**
1655
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1656
-
1657
- Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.
1658
- *
1659
- * @param {string} databaseId
1660
- * @param {string} collectionId
1661
- * @param {object} data
1662
- * @param {string[]} queries
1663
- * @throws {AppwriteException}
1664
- * @returns {Promise<Models.DocumentList<Document>>}
1665
- */
1666
- updateDocuments(databaseId, collectionId, data, queries) {
1858
+ updateDocuments(paramsOrFirst, ...rest) {
1859
+ let params;
1860
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1861
+ params = paramsOrFirst || {};
1862
+ } else {
1863
+ params = {
1864
+ databaseId: paramsOrFirst,
1865
+ collectionId: rest[0],
1866
+ data: rest[1],
1867
+ queries: rest[2]
1868
+ };
1869
+ }
1870
+ const databaseId = params.databaseId;
1871
+ const collectionId = params.collectionId;
1872
+ const data = params.data;
1873
+ const queries = params.queries;
1667
1874
  if (typeof databaseId === "undefined") {
1668
1875
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1669
1876
  }
@@ -1689,18 +1896,20 @@ class Databases {
1689
1896
  payload
1690
1897
  );
1691
1898
  }
1692
- /**
1693
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1694
-
1695
- Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1696
- *
1697
- * @param {string} databaseId
1698
- * @param {string} collectionId
1699
- * @param {string[]} queries
1700
- * @throws {AppwriteException}
1701
- * @returns {Promise<Models.DocumentList<Document>>}
1702
- */
1703
- deleteDocuments(databaseId, collectionId, queries) {
1899
+ deleteDocuments(paramsOrFirst, ...rest) {
1900
+ let params;
1901
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1902
+ params = paramsOrFirst || {};
1903
+ } else {
1904
+ params = {
1905
+ databaseId: paramsOrFirst,
1906
+ collectionId: rest[0],
1907
+ queries: rest[1]
1908
+ };
1909
+ }
1910
+ const databaseId = params.databaseId;
1911
+ const collectionId = params.collectionId;
1912
+ const queries = params.queries;
1704
1913
  if (typeof databaseId === "undefined") {
1705
1914
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1706
1915
  }
@@ -1723,17 +1932,22 @@ class Databases {
1723
1932
  payload
1724
1933
  );
1725
1934
  }
1726
- /**
1727
- * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1728
- *
1729
- * @param {string} databaseId
1730
- * @param {string} collectionId
1731
- * @param {string} documentId
1732
- * @param {string[]} queries
1733
- * @throws {AppwriteException}
1734
- * @returns {Promise<Document>}
1735
- */
1736
- getDocument(databaseId, collectionId, documentId, queries) {
1935
+ getDocument(paramsOrFirst, ...rest) {
1936
+ let params;
1937
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1938
+ params = paramsOrFirst || {};
1939
+ } else {
1940
+ params = {
1941
+ databaseId: paramsOrFirst,
1942
+ collectionId: rest[0],
1943
+ documentId: rest[1],
1944
+ queries: rest[2]
1945
+ };
1946
+ }
1947
+ const databaseId = params.databaseId;
1948
+ const collectionId = params.collectionId;
1949
+ const documentId = params.documentId;
1950
+ const queries = params.queries;
1737
1951
  if (typeof databaseId === "undefined") {
1738
1952
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1739
1953
  }
@@ -1757,20 +1971,24 @@ class Databases {
1757
1971
  payload
1758
1972
  );
1759
1973
  }
1760
- /**
1761
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1762
-
1763
- Create or update a 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.
1764
- *
1765
- * @param {string} databaseId
1766
- * @param {string} collectionId
1767
- * @param {string} documentId
1768
- * @param {object} data
1769
- * @param {string[]} permissions
1770
- * @throws {AppwriteException}
1771
- * @returns {Promise<Document>}
1772
- */
1773
- upsertDocument(databaseId, collectionId, documentId, data, permissions) {
1974
+ upsertDocument(paramsOrFirst, ...rest) {
1975
+ let params;
1976
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1977
+ params = paramsOrFirst || {};
1978
+ } else {
1979
+ params = {
1980
+ databaseId: paramsOrFirst,
1981
+ collectionId: rest[0],
1982
+ documentId: rest[1],
1983
+ data: rest[2],
1984
+ permissions: rest[3]
1985
+ };
1986
+ }
1987
+ const databaseId = params.databaseId;
1988
+ const collectionId = params.collectionId;
1989
+ const documentId = params.documentId;
1990
+ const data = params.data;
1991
+ const permissions = params.permissions;
1774
1992
  if (typeof databaseId === "undefined") {
1775
1993
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1776
1994
  }
@@ -1783,6 +2001,9 @@ class Databases {
1783
2001
  if (typeof data === "undefined") {
1784
2002
  throw new client.AppwriteException('Missing required parameter: "data"');
1785
2003
  }
2004
+ data == null ? true : delete data.$sequence;
2005
+ data == null ? true : delete data.$collectionId;
2006
+ data == null ? true : delete data.$databaseId;
1786
2007
  const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
1787
2008
  const payload = {};
1788
2009
  if (typeof data !== "undefined") {
@@ -1802,18 +2023,24 @@ class Databases {
1802
2023
  payload
1803
2024
  );
1804
2025
  }
1805
- /**
1806
- * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1807
- *
1808
- * @param {string} databaseId
1809
- * @param {string} collectionId
1810
- * @param {string} documentId
1811
- * @param {Partial<Omit<Document, keyof Models.Document>>} data
1812
- * @param {string[]} permissions
1813
- * @throws {AppwriteException}
1814
- * @returns {Promise<Document>}
1815
- */
1816
- updateDocument(databaseId, collectionId, documentId, data, permissions) {
2026
+ updateDocument(paramsOrFirst, ...rest) {
2027
+ let params;
2028
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2029
+ params = paramsOrFirst || {};
2030
+ } else {
2031
+ params = {
2032
+ databaseId: paramsOrFirst,
2033
+ collectionId: rest[0],
2034
+ documentId: rest[1],
2035
+ data: rest[2],
2036
+ permissions: rest[3]
2037
+ };
2038
+ }
2039
+ const databaseId = params.databaseId;
2040
+ const collectionId = params.collectionId;
2041
+ const documentId = params.documentId;
2042
+ const data = params.data;
2043
+ const permissions = params.permissions;
1817
2044
  if (typeof databaseId === "undefined") {
1818
2045
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1819
2046
  }
@@ -1823,6 +2050,9 @@ class Databases {
1823
2050
  if (typeof documentId === "undefined") {
1824
2051
  throw new client.AppwriteException('Missing required parameter: "documentId"');
1825
2052
  }
2053
+ data == null ? true : delete data.$sequence;
2054
+ data == null ? true : delete data.$collectionId;
2055
+ data == null ? true : delete data.$databaseId;
1826
2056
  const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId);
1827
2057
  const payload = {};
1828
2058
  if (typeof data !== "undefined") {
@@ -1842,16 +2072,20 @@ class Databases {
1842
2072
  payload
1843
2073
  );
1844
2074
  }
1845
- /**
1846
- * Delete a document by its unique ID.
1847
- *
1848
- * @param {string} databaseId
1849
- * @param {string} collectionId
1850
- * @param {string} documentId
1851
- * @throws {AppwriteException}
1852
- * @returns {Promise<{}>}
1853
- */
1854
- deleteDocument(databaseId, collectionId, documentId) {
2075
+ deleteDocument(paramsOrFirst, ...rest) {
2076
+ let params;
2077
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2078
+ params = paramsOrFirst || {};
2079
+ } else {
2080
+ params = {
2081
+ databaseId: paramsOrFirst,
2082
+ collectionId: rest[0],
2083
+ documentId: rest[1]
2084
+ };
2085
+ }
2086
+ const databaseId = params.databaseId;
2087
+ const collectionId = params.collectionId;
2088
+ const documentId = params.documentId;
1855
2089
  if (typeof databaseId === "undefined") {
1856
2090
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1857
2091
  }
@@ -1874,16 +2108,122 @@ class Databases {
1874
2108
  payload
1875
2109
  );
1876
2110
  }
1877
- /**
1878
- * List indexes in the collection.
1879
- *
1880
- * @param {string} databaseId
1881
- * @param {string} collectionId
1882
- * @param {string[]} queries
1883
- * @throws {AppwriteException}
1884
- * @returns {Promise<Models.IndexList>}
1885
- */
1886
- listIndexes(databaseId, collectionId, queries) {
2111
+ decrementDocumentAttribute(paramsOrFirst, ...rest) {
2112
+ let params;
2113
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2114
+ params = paramsOrFirst || {};
2115
+ } else {
2116
+ params = {
2117
+ databaseId: paramsOrFirst,
2118
+ collectionId: rest[0],
2119
+ documentId: rest[1],
2120
+ attribute: rest[2],
2121
+ value: rest[3],
2122
+ min: rest[4]
2123
+ };
2124
+ }
2125
+ const databaseId = params.databaseId;
2126
+ const collectionId = params.collectionId;
2127
+ const documentId = params.documentId;
2128
+ const attribute = params.attribute;
2129
+ const value = params.value;
2130
+ const min = params.min;
2131
+ if (typeof databaseId === "undefined") {
2132
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
2133
+ }
2134
+ if (typeof collectionId === "undefined") {
2135
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
2136
+ }
2137
+ if (typeof documentId === "undefined") {
2138
+ throw new client.AppwriteException('Missing required parameter: "documentId"');
2139
+ }
2140
+ if (typeof attribute === "undefined") {
2141
+ throw new client.AppwriteException('Missing required parameter: "attribute"');
2142
+ }
2143
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId).replace("{attribute}", attribute);
2144
+ const payload = {};
2145
+ if (typeof value !== "undefined") {
2146
+ payload["value"] = value;
2147
+ }
2148
+ if (typeof min !== "undefined") {
2149
+ payload["min"] = min;
2150
+ }
2151
+ const uri = new URL(this.client.config.endpoint + apiPath);
2152
+ const apiHeaders = {
2153
+ "content-type": "application/json"
2154
+ };
2155
+ return this.client.call(
2156
+ "patch",
2157
+ uri,
2158
+ apiHeaders,
2159
+ payload
2160
+ );
2161
+ }
2162
+ incrementDocumentAttribute(paramsOrFirst, ...rest) {
2163
+ let params;
2164
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2165
+ params = paramsOrFirst || {};
2166
+ } else {
2167
+ params = {
2168
+ databaseId: paramsOrFirst,
2169
+ collectionId: rest[0],
2170
+ documentId: rest[1],
2171
+ attribute: rest[2],
2172
+ value: rest[3],
2173
+ max: rest[4]
2174
+ };
2175
+ }
2176
+ const databaseId = params.databaseId;
2177
+ const collectionId = params.collectionId;
2178
+ const documentId = params.documentId;
2179
+ const attribute = params.attribute;
2180
+ const value = params.value;
2181
+ const max = params.max;
2182
+ if (typeof databaseId === "undefined") {
2183
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
2184
+ }
2185
+ if (typeof collectionId === "undefined") {
2186
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
2187
+ }
2188
+ if (typeof documentId === "undefined") {
2189
+ throw new client.AppwriteException('Missing required parameter: "documentId"');
2190
+ }
2191
+ if (typeof attribute === "undefined") {
2192
+ throw new client.AppwriteException('Missing required parameter: "attribute"');
2193
+ }
2194
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{documentId}", documentId).replace("{attribute}", attribute);
2195
+ const payload = {};
2196
+ if (typeof value !== "undefined") {
2197
+ payload["value"] = value;
2198
+ }
2199
+ if (typeof max !== "undefined") {
2200
+ payload["max"] = max;
2201
+ }
2202
+ const uri = new URL(this.client.config.endpoint + apiPath);
2203
+ const apiHeaders = {
2204
+ "content-type": "application/json"
2205
+ };
2206
+ return this.client.call(
2207
+ "patch",
2208
+ uri,
2209
+ apiHeaders,
2210
+ payload
2211
+ );
2212
+ }
2213
+ listIndexes(paramsOrFirst, ...rest) {
2214
+ let params;
2215
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2216
+ params = paramsOrFirst || {};
2217
+ } else {
2218
+ params = {
2219
+ databaseId: paramsOrFirst,
2220
+ collectionId: rest[0],
2221
+ queries: rest[1]
2222
+ };
2223
+ }
2224
+ const databaseId = params.databaseId;
2225
+ const collectionId = params.collectionId;
2226
+ const queries = params.queries;
1887
2227
  if (typeof databaseId === "undefined") {
1888
2228
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1889
2229
  }
@@ -1904,21 +2244,28 @@ class Databases {
1904
2244
  payload
1905
2245
  );
1906
2246
  }
1907
- /**
1908
- * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
1909
- Attributes can be `key`, `fulltext`, and `unique`.
1910
- *
1911
- * @param {string} databaseId
1912
- * @param {string} collectionId
1913
- * @param {string} key
1914
- * @param {IndexType} type
1915
- * @param {string[]} attributes
1916
- * @param {string[]} orders
1917
- * @param {number[]} lengths
1918
- * @throws {AppwriteException}
1919
- * @returns {Promise<Models.Index>}
1920
- */
1921
- createIndex(databaseId, collectionId, key, type, attributes, orders, lengths) {
2247
+ createIndex(paramsOrFirst, ...rest) {
2248
+ let params;
2249
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2250
+ params = paramsOrFirst || {};
2251
+ } else {
2252
+ params = {
2253
+ databaseId: paramsOrFirst,
2254
+ collectionId: rest[0],
2255
+ key: rest[1],
2256
+ type: rest[2],
2257
+ attributes: rest[3],
2258
+ orders: rest[4],
2259
+ lengths: rest[5]
2260
+ };
2261
+ }
2262
+ const databaseId = params.databaseId;
2263
+ const collectionId = params.collectionId;
2264
+ const key = params.key;
2265
+ const type = params.type;
2266
+ const attributes = params.attributes;
2267
+ const orders = params.orders;
2268
+ const lengths = params.lengths;
1922
2269
  if (typeof databaseId === "undefined") {
1923
2270
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1924
2271
  }
@@ -1962,16 +2309,20 @@ class Databases {
1962
2309
  payload
1963
2310
  );
1964
2311
  }
1965
- /**
1966
- * Get index by ID.
1967
- *
1968
- * @param {string} databaseId
1969
- * @param {string} collectionId
1970
- * @param {string} key
1971
- * @throws {AppwriteException}
1972
- * @returns {Promise<Models.Index>}
1973
- */
1974
- getIndex(databaseId, collectionId, key) {
2312
+ getIndex(paramsOrFirst, ...rest) {
2313
+ let params;
2314
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2315
+ params = paramsOrFirst || {};
2316
+ } else {
2317
+ params = {
2318
+ databaseId: paramsOrFirst,
2319
+ collectionId: rest[0],
2320
+ key: rest[1]
2321
+ };
2322
+ }
2323
+ const databaseId = params.databaseId;
2324
+ const collectionId = params.collectionId;
2325
+ const key = params.key;
1975
2326
  if (typeof databaseId === "undefined") {
1976
2327
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1977
2328
  }
@@ -1992,16 +2343,20 @@ class Databases {
1992
2343
  payload
1993
2344
  );
1994
2345
  }
1995
- /**
1996
- * Delete an index.
1997
- *
1998
- * @param {string} databaseId
1999
- * @param {string} collectionId
2000
- * @param {string} key
2001
- * @throws {AppwriteException}
2002
- * @returns {Promise<{}>}
2003
- */
2004
- deleteIndex(databaseId, collectionId, key) {
2346
+ deleteIndex(paramsOrFirst, ...rest) {
2347
+ let params;
2348
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2349
+ params = paramsOrFirst || {};
2350
+ } else {
2351
+ params = {
2352
+ databaseId: paramsOrFirst,
2353
+ collectionId: rest[0],
2354
+ key: rest[1]
2355
+ };
2356
+ }
2357
+ const databaseId = params.databaseId;
2358
+ const collectionId = params.collectionId;
2359
+ const key = params.key;
2005
2360
  if (typeof databaseId === "undefined") {
2006
2361
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
2007
2362
  }