node-appwrite 17.2.0 → 19.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 (126) 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/credit-card.d.mts +1 -1
  7. package/dist/enums/credit-card.d.ts +1 -1
  8. package/dist/enums/credit-card.js +1 -1
  9. package/dist/enums/credit-card.js.map +1 -1
  10. package/dist/enums/credit-card.mjs +1 -1
  11. package/dist/enums/credit-card.mjs.map +1 -1
  12. package/dist/enums/execution-method.d.mts +2 -1
  13. package/dist/enums/execution-method.d.ts +2 -1
  14. package/dist/enums/execution-method.js +1 -0
  15. package/dist/enums/execution-method.js.map +1 -1
  16. package/dist/enums/execution-method.mjs +1 -0
  17. package/dist/enums/execution-method.mjs.map +1 -1
  18. package/dist/enums/index-type.d.mts +2 -1
  19. package/dist/enums/index-type.d.ts +2 -1
  20. package/dist/enums/index-type.js +1 -0
  21. package/dist/enums/index-type.js.map +1 -1
  22. package/dist/enums/index-type.mjs +1 -0
  23. package/dist/enums/index-type.mjs.map +1 -1
  24. package/dist/enums/{v-c-s-deployment-type.js → vcs-deployment-type.js} +1 -1
  25. package/dist/enums/vcs-deployment-type.js.map +1 -0
  26. package/dist/enums/{v-c-s-deployment-type.mjs → vcs-deployment-type.mjs} +2 -2
  27. package/dist/enums/vcs-deployment-type.mjs.map +1 -0
  28. package/dist/index.d.mts +2 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +7 -2
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +2 -1
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/models.d.mts +1058 -153
  35. package/dist/models.d.ts +1058 -153
  36. package/dist/query.d.mts +196 -6
  37. package/dist/query.d.ts +196 -6
  38. package/dist/query.js +192 -2
  39. package/dist/query.js.map +1 -1
  40. package/dist/query.mjs +192 -2
  41. package/dist/query.mjs.map +1 -1
  42. package/dist/services/account.d.mts +625 -70
  43. package/dist/services/account.d.ts +625 -70
  44. package/dist/services/account.js +592 -292
  45. package/dist/services/account.js.map +1 -1
  46. package/dist/services/account.mjs +592 -292
  47. package/dist/services/account.mjs.map +1 -1
  48. package/dist/services/avatars.d.mts +157 -26
  49. package/dist/services/avatars.d.ts +157 -26
  50. package/dist/services/avatars.js +104 -93
  51. package/dist/services/avatars.js.map +1 -1
  52. package/dist/services/avatars.mjs +104 -93
  53. package/dist/services/avatars.mjs.map +1 -1
  54. package/dist/services/databases.d.mts +1425 -248
  55. package/dist/services/databases.d.ts +1425 -248
  56. package/dist/services/databases.js +1186 -611
  57. package/dist/services/databases.js.map +1 -1
  58. package/dist/services/databases.mjs +1186 -611
  59. package/dist/services/databases.mjs.map +1 -1
  60. package/dist/services/functions.d.mts +530 -107
  61. package/dist/services/functions.d.ts +530 -107
  62. package/dist/services/functions.js +393 -276
  63. package/dist/services/functions.js.map +1 -1
  64. package/dist/services/functions.mjs +393 -276
  65. package/dist/services/functions.mjs.map +1 -1
  66. package/dist/services/graphql.d.mts +24 -2
  67. package/dist/services/graphql.d.ts +24 -2
  68. package/dist/services/graphql.js +20 -16
  69. package/dist/services/graphql.js.map +1 -1
  70. package/dist/services/graphql.mjs +20 -16
  71. package/dist/services/graphql.mjs.map +1 -1
  72. package/dist/services/health.d.mts +175 -16
  73. package/dist/services/health.d.ts +175 -16
  74. package/dist/services/health.js +144 -115
  75. package/dist/services/health.js.map +1 -1
  76. package/dist/services/health.mjs +144 -115
  77. package/dist/services/health.mjs.map +1 -1
  78. package/dist/services/locale.js.map +1 -1
  79. package/dist/services/locale.mjs.map +1 -1
  80. package/dist/services/messaging.d.mts +1544 -262
  81. package/dist/services/messaging.d.ts +1544 -262
  82. package/dist/services/messaging.js +1417 -592
  83. package/dist/services/messaging.js.map +1 -1
  84. package/dist/services/messaging.mjs +1417 -592
  85. package/dist/services/messaging.mjs.map +1 -1
  86. package/dist/services/sites.d.mts +495 -99
  87. package/dist/services/sites.d.ts +495 -99
  88. package/dist/services/sites.js +371 -258
  89. package/dist/services/sites.js.map +1 -1
  90. package/dist/services/sites.mjs +371 -258
  91. package/dist/services/sites.mjs.map +1 -1
  92. package/dist/services/storage.d.mts +306 -63
  93. package/dist/services/storage.d.ts +306 -63
  94. package/dist/services/storage.js +225 -158
  95. package/dist/services/storage.js.map +1 -1
  96. package/dist/services/storage.mjs +225 -158
  97. package/dist/services/storage.mjs.map +1 -1
  98. package/dist/services/tables-db.d.mts +1744 -0
  99. package/dist/services/tables-db.d.ts +1744 -0
  100. package/dist/services/tables-db.js +2692 -0
  101. package/dist/services/tables-db.js.map +1 -0
  102. package/dist/services/tables-db.mjs +2691 -0
  103. package/dist/services/tables-db.mjs.map +1 -0
  104. package/dist/services/teams.d.mts +233 -39
  105. package/dist/services/teams.d.ts +233 -39
  106. package/dist/services/teams.js +170 -135
  107. package/dist/services/teams.js.map +1 -1
  108. package/dist/services/teams.mjs +170 -135
  109. package/dist/services/teams.mjs.map +1 -1
  110. package/dist/services/tokens.d.mts +76 -11
  111. package/dist/services/tokens.d.ts +76 -11
  112. package/dist/services/tokens.js +60 -45
  113. package/dist/services/tokens.js.map +1 -1
  114. package/dist/services/tokens.mjs +60 -45
  115. package/dist/services/tokens.mjs.map +1 -1
  116. package/dist/services/users.d.mts +842 -115
  117. package/dist/services/users.d.ts +842 -115
  118. package/dist/services/users.js +719 -408
  119. package/dist/services/users.js.map +1 -1
  120. package/dist/services/users.mjs +719 -408
  121. package/dist/services/users.mjs.map +1 -1
  122. package/package.json +1 -1
  123. package/dist/enums/v-c-s-deployment-type.js.map +0 -1
  124. package/dist/enums/v-c-s-deployment-type.mjs.map +0 -1
  125. /package/dist/enums/{v-c-s-deployment-type.d.mts → vcs-deployment-type.d.mts} +0 -0
  126. /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,348 @@ 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
+ createLineAttribute(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
+ key: rest[1],
1271
+ required: rest[2],
1272
+ xdefault: rest[3]
1273
+ };
1274
+ }
1275
+ const databaseId = params.databaseId;
1276
+ const collectionId = params.collectionId;
1277
+ const key = params.key;
1278
+ const required = params.required;
1279
+ const xdefault = params.xdefault;
1280
+ if (typeof databaseId === "undefined") {
1281
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1282
+ }
1283
+ if (typeof collectionId === "undefined") {
1284
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1285
+ }
1286
+ if (typeof key === "undefined") {
1287
+ throw new client.AppwriteException('Missing required parameter: "key"');
1288
+ }
1289
+ if (typeof required === "undefined") {
1290
+ throw new client.AppwriteException('Missing required parameter: "required"');
1291
+ }
1292
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1293
+ const payload = {};
1294
+ if (typeof key !== "undefined") {
1295
+ payload["key"] = key;
1296
+ }
1297
+ if (typeof required !== "undefined") {
1298
+ payload["required"] = required;
1299
+ }
1300
+ if (typeof xdefault !== "undefined") {
1301
+ payload["default"] = xdefault;
1302
+ }
1303
+ const uri = new URL(this.client.config.endpoint + apiPath);
1304
+ const apiHeaders = {
1305
+ "content-type": "application/json"
1306
+ };
1307
+ return this.client.call(
1308
+ "post",
1309
+ uri,
1310
+ apiHeaders,
1311
+ payload
1312
+ );
1313
+ }
1314
+ updateLineAttribute(paramsOrFirst, ...rest) {
1315
+ let params;
1316
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1317
+ params = paramsOrFirst || {};
1318
+ } else {
1319
+ params = {
1320
+ databaseId: paramsOrFirst,
1321
+ collectionId: rest[0],
1322
+ key: rest[1],
1323
+ required: rest[2],
1324
+ xdefault: rest[3],
1325
+ newKey: rest[4]
1326
+ };
1327
+ }
1328
+ const databaseId = params.databaseId;
1329
+ const collectionId = params.collectionId;
1330
+ const key = params.key;
1331
+ const required = params.required;
1332
+ const xdefault = params.xdefault;
1333
+ const newKey = params.newKey;
1334
+ if (typeof databaseId === "undefined") {
1335
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1336
+ }
1337
+ if (typeof collectionId === "undefined") {
1338
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1339
+ }
1340
+ if (typeof key === "undefined") {
1341
+ throw new client.AppwriteException('Missing required parameter: "key"');
1342
+ }
1343
+ if (typeof required === "undefined") {
1344
+ throw new client.AppwriteException('Missing required parameter: "required"');
1345
+ }
1346
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
1347
+ const payload = {};
1348
+ if (typeof required !== "undefined") {
1349
+ payload["required"] = required;
1350
+ }
1351
+ if (typeof xdefault !== "undefined") {
1352
+ payload["default"] = xdefault;
1353
+ }
1354
+ if (typeof newKey !== "undefined") {
1355
+ payload["newKey"] = newKey;
1356
+ }
1357
+ const uri = new URL(this.client.config.endpoint + apiPath);
1358
+ const apiHeaders = {
1359
+ "content-type": "application/json"
1360
+ };
1361
+ return this.client.call(
1362
+ "patch",
1363
+ uri,
1364
+ apiHeaders,
1365
+ payload
1366
+ );
1367
+ }
1368
+ createPointAttribute(paramsOrFirst, ...rest) {
1369
+ let params;
1370
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1371
+ params = paramsOrFirst || {};
1372
+ } else {
1373
+ params = {
1374
+ databaseId: paramsOrFirst,
1375
+ collectionId: rest[0],
1376
+ key: rest[1],
1377
+ required: rest[2],
1378
+ xdefault: rest[3]
1379
+ };
1380
+ }
1381
+ const databaseId = params.databaseId;
1382
+ const collectionId = params.collectionId;
1383
+ const key = params.key;
1384
+ const required = params.required;
1385
+ const xdefault = params.xdefault;
1386
+ if (typeof databaseId === "undefined") {
1387
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1388
+ }
1389
+ if (typeof collectionId === "undefined") {
1390
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1391
+ }
1392
+ if (typeof key === "undefined") {
1393
+ throw new client.AppwriteException('Missing required parameter: "key"');
1394
+ }
1395
+ if (typeof required === "undefined") {
1396
+ throw new client.AppwriteException('Missing required parameter: "required"');
1397
+ }
1398
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1399
+ const payload = {};
1400
+ if (typeof key !== "undefined") {
1401
+ payload["key"] = key;
1402
+ }
1403
+ if (typeof required !== "undefined") {
1404
+ payload["required"] = required;
1405
+ }
1406
+ if (typeof xdefault !== "undefined") {
1407
+ payload["default"] = xdefault;
1408
+ }
1409
+ const uri = new URL(this.client.config.endpoint + apiPath);
1410
+ const apiHeaders = {
1411
+ "content-type": "application/json"
1412
+ };
1413
+ return this.client.call(
1414
+ "post",
1415
+ uri,
1416
+ apiHeaders,
1417
+ payload
1418
+ );
1419
+ }
1420
+ updatePointAttribute(paramsOrFirst, ...rest) {
1421
+ let params;
1422
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1423
+ params = paramsOrFirst || {};
1424
+ } else {
1425
+ params = {
1426
+ databaseId: paramsOrFirst,
1427
+ collectionId: rest[0],
1428
+ key: rest[1],
1429
+ required: rest[2],
1430
+ xdefault: rest[3],
1431
+ newKey: rest[4]
1432
+ };
1433
+ }
1434
+ const databaseId = params.databaseId;
1435
+ const collectionId = params.collectionId;
1436
+ const key = params.key;
1437
+ const required = params.required;
1438
+ const xdefault = params.xdefault;
1439
+ const newKey = params.newKey;
1440
+ if (typeof databaseId === "undefined") {
1441
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1442
+ }
1443
+ if (typeof collectionId === "undefined") {
1444
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1445
+ }
1446
+ if (typeof key === "undefined") {
1447
+ throw new client.AppwriteException('Missing required parameter: "key"');
1448
+ }
1449
+ if (typeof required === "undefined") {
1450
+ throw new client.AppwriteException('Missing required parameter: "required"');
1451
+ }
1452
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
1453
+ const payload = {};
1454
+ if (typeof required !== "undefined") {
1455
+ payload["required"] = required;
1456
+ }
1457
+ if (typeof xdefault !== "undefined") {
1458
+ payload["default"] = xdefault;
1459
+ }
1460
+ if (typeof newKey !== "undefined") {
1461
+ payload["newKey"] = newKey;
1462
+ }
1463
+ const uri = new URL(this.client.config.endpoint + apiPath);
1464
+ const apiHeaders = {
1465
+ "content-type": "application/json"
1466
+ };
1467
+ return this.client.call(
1468
+ "patch",
1469
+ uri,
1470
+ apiHeaders,
1471
+ payload
1472
+ );
1473
+ }
1474
+ createPolygonAttribute(paramsOrFirst, ...rest) {
1475
+ let params;
1476
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1477
+ params = paramsOrFirst || {};
1478
+ } else {
1479
+ params = {
1480
+ databaseId: paramsOrFirst,
1481
+ collectionId: rest[0],
1482
+ key: rest[1],
1483
+ required: rest[2],
1484
+ xdefault: rest[3]
1485
+ };
1486
+ }
1487
+ const databaseId = params.databaseId;
1488
+ const collectionId = params.collectionId;
1489
+ const key = params.key;
1490
+ const required = params.required;
1491
+ const xdefault = params.xdefault;
1492
+ if (typeof databaseId === "undefined") {
1493
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1494
+ }
1495
+ if (typeof collectionId === "undefined") {
1496
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1497
+ }
1498
+ if (typeof key === "undefined") {
1499
+ throw new client.AppwriteException('Missing required parameter: "key"');
1500
+ }
1501
+ if (typeof required === "undefined") {
1502
+ throw new client.AppwriteException('Missing required parameter: "required"');
1503
+ }
1504
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1505
+ const payload = {};
1506
+ if (typeof key !== "undefined") {
1507
+ payload["key"] = key;
1508
+ }
1509
+ if (typeof required !== "undefined") {
1510
+ payload["required"] = required;
1511
+ }
1512
+ if (typeof xdefault !== "undefined") {
1513
+ payload["default"] = xdefault;
1514
+ }
1515
+ const uri = new URL(this.client.config.endpoint + apiPath);
1516
+ const apiHeaders = {
1517
+ "content-type": "application/json"
1518
+ };
1519
+ return this.client.call(
1520
+ "post",
1521
+ uri,
1522
+ apiHeaders,
1523
+ payload
1524
+ );
1525
+ }
1526
+ updatePolygonAttribute(paramsOrFirst, ...rest) {
1527
+ let params;
1528
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1529
+ params = paramsOrFirst || {};
1530
+ } else {
1531
+ params = {
1532
+ databaseId: paramsOrFirst,
1533
+ collectionId: rest[0],
1534
+ key: rest[1],
1535
+ required: rest[2],
1536
+ xdefault: rest[3],
1537
+ newKey: rest[4]
1538
+ };
1539
+ }
1540
+ const databaseId = params.databaseId;
1541
+ const collectionId = params.collectionId;
1542
+ const key = params.key;
1543
+ const required = params.required;
1544
+ const xdefault = params.xdefault;
1545
+ const newKey = params.newKey;
1546
+ if (typeof databaseId === "undefined") {
1547
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1548
+ }
1549
+ if (typeof collectionId === "undefined") {
1550
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1551
+ }
1552
+ if (typeof key === "undefined") {
1553
+ throw new client.AppwriteException('Missing required parameter: "key"');
1554
+ }
1555
+ if (typeof required === "undefined") {
1556
+ throw new client.AppwriteException('Missing required parameter: "required"');
1557
+ }
1558
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
1559
+ const payload = {};
1560
+ if (typeof required !== "undefined") {
1561
+ payload["required"] = required;
1562
+ }
1563
+ if (typeof xdefault !== "undefined") {
1564
+ payload["default"] = xdefault;
1565
+ }
1566
+ if (typeof newKey !== "undefined") {
1567
+ payload["newKey"] = newKey;
1568
+ }
1569
+ const uri = new URL(this.client.config.endpoint + apiPath);
1570
+ const apiHeaders = {
1571
+ "content-type": "application/json"
1572
+ };
1573
+ return this.client.call(
1574
+ "patch",
1575
+ uri,
1576
+ apiHeaders,
1577
+ payload
1578
+ );
1579
+ }
1580
+ createRelationshipAttribute(paramsOrFirst, ...rest) {
1581
+ let params;
1582
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1583
+ params = paramsOrFirst || {};
1584
+ } else {
1585
+ params = {
1586
+ databaseId: paramsOrFirst,
1587
+ collectionId: rest[0],
1588
+ relatedCollectionId: rest[1],
1589
+ type: rest[2],
1590
+ twoWay: rest[3],
1591
+ key: rest[4],
1592
+ twoWayKey: rest[5],
1593
+ onDelete: rest[6]
1594
+ };
1595
+ }
1596
+ const databaseId = params.databaseId;
1597
+ const collectionId = params.collectionId;
1598
+ const relatedCollectionId = params.relatedCollectionId;
1599
+ const type = params.type;
1600
+ const twoWay = params.twoWay;
1601
+ const key = params.key;
1602
+ const twoWayKey = params.twoWayKey;
1603
+ const onDelete = params.onDelete;
1139
1604
  if (typeof databaseId === "undefined") {
1140
1605
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1141
1606
  }
@@ -1179,22 +1644,30 @@ class Databases {
1179
1644
  payload
1180
1645
  );
1181
1646
  }
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) {
1647
+ createStringAttribute(paramsOrFirst, ...rest) {
1648
+ let params;
1649
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1650
+ params = paramsOrFirst || {};
1651
+ } else {
1652
+ params = {
1653
+ databaseId: paramsOrFirst,
1654
+ collectionId: rest[0],
1655
+ key: rest[1],
1656
+ size: rest[2],
1657
+ required: rest[3],
1658
+ xdefault: rest[4],
1659
+ array: rest[5],
1660
+ encrypt: rest[6]
1661
+ };
1662
+ }
1663
+ const databaseId = params.databaseId;
1664
+ const collectionId = params.collectionId;
1665
+ const key = params.key;
1666
+ const size = params.size;
1667
+ const required = params.required;
1668
+ const xdefault = params.xdefault;
1669
+ const array = params.array;
1670
+ const encrypt = params.encrypt;
1198
1671
  if (typeof databaseId === "undefined") {
1199
1672
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1200
1673
  }
@@ -1241,21 +1714,28 @@ class Databases {
1241
1714
  payload
1242
1715
  );
1243
1716
  }
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) {
1717
+ updateStringAttribute(paramsOrFirst, ...rest) {
1718
+ let params;
1719
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1720
+ params = paramsOrFirst || {};
1721
+ } else {
1722
+ params = {
1723
+ databaseId: paramsOrFirst,
1724
+ collectionId: rest[0],
1725
+ key: rest[1],
1726
+ required: rest[2],
1727
+ xdefault: rest[3],
1728
+ size: rest[4],
1729
+ newKey: rest[5]
1730
+ };
1731
+ }
1732
+ const databaseId = params.databaseId;
1733
+ const collectionId = params.collectionId;
1734
+ const key = params.key;
1735
+ const required = params.required;
1736
+ const xdefault = params.xdefault;
1737
+ const size = params.size;
1738
+ const newKey = params.newKey;
1259
1739
  if (typeof databaseId === "undefined") {
1260
1740
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1261
1741
  }
@@ -1296,20 +1776,26 @@ class Databases {
1296
1776
  payload
1297
1777
  );
1298
1778
  }
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) {
1779
+ createUrlAttribute(paramsOrFirst, ...rest) {
1780
+ let params;
1781
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1782
+ params = paramsOrFirst || {};
1783
+ } else {
1784
+ params = {
1785
+ databaseId: paramsOrFirst,
1786
+ collectionId: rest[0],
1787
+ key: rest[1],
1788
+ required: rest[2],
1789
+ xdefault: rest[3],
1790
+ array: rest[4]
1791
+ };
1792
+ }
1793
+ const databaseId = params.databaseId;
1794
+ const collectionId = params.collectionId;
1795
+ const key = params.key;
1796
+ const required = params.required;
1797
+ const xdefault = params.xdefault;
1798
+ const array = params.array;
1313
1799
  if (typeof databaseId === "undefined") {
1314
1800
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1315
1801
  }
@@ -1347,20 +1833,26 @@ class Databases {
1347
1833
  payload
1348
1834
  );
1349
1835
  }
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) {
1836
+ updateUrlAttribute(paramsOrFirst, ...rest) {
1837
+ let params;
1838
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1839
+ params = paramsOrFirst || {};
1840
+ } else {
1841
+ params = {
1842
+ databaseId: paramsOrFirst,
1843
+ collectionId: rest[0],
1844
+ key: rest[1],
1845
+ required: rest[2],
1846
+ xdefault: rest[3],
1847
+ newKey: rest[4]
1848
+ };
1849
+ }
1850
+ const databaseId = params.databaseId;
1851
+ const collectionId = params.collectionId;
1852
+ const key = params.key;
1853
+ const required = params.required;
1854
+ const xdefault = params.xdefault;
1855
+ const newKey = params.newKey;
1364
1856
  if (typeof databaseId === "undefined") {
1365
1857
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1366
1858
  }
@@ -1398,16 +1890,20 @@ class Databases {
1398
1890
  payload
1399
1891
  );
1400
1892
  }
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) {
1893
+ getAttribute(paramsOrFirst, ...rest) {
1894
+ let params;
1895
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1896
+ params = paramsOrFirst || {};
1897
+ } else {
1898
+ params = {
1899
+ databaseId: paramsOrFirst,
1900
+ collectionId: rest[0],
1901
+ key: rest[1]
1902
+ };
1903
+ }
1904
+ const databaseId = params.databaseId;
1905
+ const collectionId = params.collectionId;
1906
+ const key = params.key;
1411
1907
  if (typeof databaseId === "undefined") {
1412
1908
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1413
1909
  }
@@ -1428,16 +1924,20 @@ class Databases {
1428
1924
  payload
1429
1925
  );
1430
1926
  }
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) {
1927
+ deleteAttribute(paramsOrFirst, ...rest) {
1928
+ let params;
1929
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1930
+ params = paramsOrFirst || {};
1931
+ } else {
1932
+ params = {
1933
+ databaseId: paramsOrFirst,
1934
+ collectionId: rest[0],
1935
+ key: rest[1]
1936
+ };
1937
+ }
1938
+ const databaseId = params.databaseId;
1939
+ const collectionId = params.collectionId;
1940
+ const key = params.key;
1441
1941
  if (typeof databaseId === "undefined") {
1442
1942
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1443
1943
  }
@@ -1460,19 +1960,24 @@ class Databases {
1460
1960
  payload
1461
1961
  );
1462
1962
  }
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) {
1963
+ updateRelationshipAttribute(paramsOrFirst, ...rest) {
1964
+ let params;
1965
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1966
+ params = paramsOrFirst || {};
1967
+ } else {
1968
+ params = {
1969
+ databaseId: paramsOrFirst,
1970
+ collectionId: rest[0],
1971
+ key: rest[1],
1972
+ onDelete: rest[2],
1973
+ newKey: rest[3]
1974
+ };
1975
+ }
1976
+ const databaseId = params.databaseId;
1977
+ const collectionId = params.collectionId;
1978
+ const key = params.key;
1979
+ const onDelete = params.onDelete;
1980
+ const newKey = params.newKey;
1476
1981
  if (typeof databaseId === "undefined") {
1477
1982
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1478
1983
  }
@@ -1501,16 +2006,20 @@ class Databases {
1501
2006
  payload
1502
2007
  );
1503
2008
  }
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) {
2009
+ listDocuments(paramsOrFirst, ...rest) {
2010
+ let params;
2011
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2012
+ params = paramsOrFirst || {};
2013
+ } else {
2014
+ params = {
2015
+ databaseId: paramsOrFirst,
2016
+ collectionId: rest[0],
2017
+ queries: rest[1]
2018
+ };
2019
+ }
2020
+ const databaseId = params.databaseId;
2021
+ const collectionId = params.collectionId;
2022
+ const queries = params.queries;
1514
2023
  if (typeof databaseId === "undefined") {
1515
2024
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1516
2025
  }
@@ -1531,18 +2040,24 @@ class Databases {
1531
2040
  payload
1532
2041
  );
1533
2042
  }
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 {Document extends Models.DefaultDocument ? Models.DataWithoutDocumentKeys : 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) {
2043
+ createDocument(paramsOrFirst, ...rest) {
2044
+ let params;
2045
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2046
+ params = paramsOrFirst || {};
2047
+ } else {
2048
+ params = {
2049
+ databaseId: paramsOrFirst,
2050
+ collectionId: rest[0],
2051
+ documentId: rest[1],
2052
+ data: rest[2],
2053
+ permissions: rest[3]
2054
+ };
2055
+ }
2056
+ const databaseId = params.databaseId;
2057
+ const collectionId = params.collectionId;
2058
+ const documentId = params.documentId;
2059
+ const data = params.data;
2060
+ const permissions = params.permissions;
1546
2061
  if (typeof databaseId === "undefined") {
1547
2062
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1548
2063
  }
@@ -1577,18 +2092,20 @@ class Databases {
1577
2092
  payload
1578
2093
  );
1579
2094
  }
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) {
2095
+ createDocuments(paramsOrFirst, ...rest) {
2096
+ let params;
2097
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2098
+ params = paramsOrFirst || {};
2099
+ } else {
2100
+ params = {
2101
+ databaseId: paramsOrFirst,
2102
+ collectionId: rest[0],
2103
+ documents: rest[1]
2104
+ };
2105
+ }
2106
+ const databaseId = params.databaseId;
2107
+ const collectionId = params.collectionId;
2108
+ const documents = params.documents;
1592
2109
  if (typeof databaseId === "undefined") {
1593
2110
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1594
2111
  }
@@ -1614,19 +2131,20 @@ class Databases {
1614
2131
  payload
1615
2132
  );
1616
2133
  }
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
- *
1623
- * @param {string} databaseId
1624
- * @param {string} collectionId
1625
- * @param {object[]} documents
1626
- * @throws {AppwriteException}
1627
- * @returns {Promise<Models.DocumentList<Document>>}
1628
- */
1629
- upsertDocuments(databaseId, collectionId, documents) {
2134
+ upsertDocuments(paramsOrFirst, ...rest) {
2135
+ let params;
2136
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2137
+ params = paramsOrFirst || {};
2138
+ } else {
2139
+ params = {
2140
+ databaseId: paramsOrFirst,
2141
+ collectionId: rest[0],
2142
+ documents: rest[1]
2143
+ };
2144
+ }
2145
+ const databaseId = params.databaseId;
2146
+ const collectionId = params.collectionId;
2147
+ const documents = params.documents;
1630
2148
  if (typeof databaseId === "undefined") {
1631
2149
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1632
2150
  }
@@ -1652,19 +2170,22 @@ class Databases {
1652
2170
  payload
1653
2171
  );
1654
2172
  }
1655
- /**
1656
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1657
- *
1658
- * 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.
1659
- *
1660
- * @param {string} databaseId
1661
- * @param {string} collectionId
1662
- * @param {object} data
1663
- * @param {string[]} queries
1664
- * @throws {AppwriteException}
1665
- * @returns {Promise<Models.DocumentList<Document>>}
1666
- */
1667
- updateDocuments(databaseId, collectionId, data, queries) {
2173
+ updateDocuments(paramsOrFirst, ...rest) {
2174
+ let params;
2175
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2176
+ params = paramsOrFirst || {};
2177
+ } else {
2178
+ params = {
2179
+ databaseId: paramsOrFirst,
2180
+ collectionId: rest[0],
2181
+ data: rest[1],
2182
+ queries: rest[2]
2183
+ };
2184
+ }
2185
+ const databaseId = params.databaseId;
2186
+ const collectionId = params.collectionId;
2187
+ const data = params.data;
2188
+ const queries = params.queries;
1668
2189
  if (typeof databaseId === "undefined") {
1669
2190
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1670
2191
  }
@@ -1690,18 +2211,20 @@ class Databases {
1690
2211
  payload
1691
2212
  );
1692
2213
  }
1693
- /**
1694
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1695
- *
1696
- * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1697
- *
1698
- * @param {string} databaseId
1699
- * @param {string} collectionId
1700
- * @param {string[]} queries
1701
- * @throws {AppwriteException}
1702
- * @returns {Promise<Models.DocumentList<Document>>}
1703
- */
1704
- deleteDocuments(databaseId, collectionId, queries) {
2214
+ deleteDocuments(paramsOrFirst, ...rest) {
2215
+ let params;
2216
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2217
+ params = paramsOrFirst || {};
2218
+ } else {
2219
+ params = {
2220
+ databaseId: paramsOrFirst,
2221
+ collectionId: rest[0],
2222
+ queries: rest[1]
2223
+ };
2224
+ }
2225
+ const databaseId = params.databaseId;
2226
+ const collectionId = params.collectionId;
2227
+ const queries = params.queries;
1705
2228
  if (typeof databaseId === "undefined") {
1706
2229
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1707
2230
  }
@@ -1724,17 +2247,22 @@ class Databases {
1724
2247
  payload
1725
2248
  );
1726
2249
  }
1727
- /**
1728
- * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1729
- *
1730
- * @param {string} databaseId
1731
- * @param {string} collectionId
1732
- * @param {string} documentId
1733
- * @param {string[]} queries
1734
- * @throws {AppwriteException}
1735
- * @returns {Promise<Document>}
1736
- */
1737
- getDocument(databaseId, collectionId, documentId, queries) {
2250
+ getDocument(paramsOrFirst, ...rest) {
2251
+ let params;
2252
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2253
+ params = paramsOrFirst || {};
2254
+ } else {
2255
+ params = {
2256
+ databaseId: paramsOrFirst,
2257
+ collectionId: rest[0],
2258
+ documentId: rest[1],
2259
+ queries: rest[2]
2260
+ };
2261
+ }
2262
+ const databaseId = params.databaseId;
2263
+ const collectionId = params.collectionId;
2264
+ const documentId = params.documentId;
2265
+ const queries = params.queries;
1738
2266
  if (typeof databaseId === "undefined") {
1739
2267
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1740
2268
  }
@@ -1758,20 +2286,24 @@ class Databases {
1758
2286
  payload
1759
2287
  );
1760
2288
  }
1761
- /**
1762
- * **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
1763
- *
1764
- * 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.
1765
- *
1766
- * @param {string} databaseId
1767
- * @param {string} collectionId
1768
- * @param {string} documentId
1769
- * @param {object} data
1770
- * @param {string[]} permissions
1771
- * @throws {AppwriteException}
1772
- * @returns {Promise<Document>}
1773
- */
1774
- upsertDocument(databaseId, collectionId, documentId, data, permissions) {
2289
+ upsertDocument(paramsOrFirst, ...rest) {
2290
+ let params;
2291
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2292
+ params = paramsOrFirst || {};
2293
+ } else {
2294
+ params = {
2295
+ databaseId: paramsOrFirst,
2296
+ collectionId: rest[0],
2297
+ documentId: rest[1],
2298
+ data: rest[2],
2299
+ permissions: rest[3]
2300
+ };
2301
+ }
2302
+ const databaseId = params.databaseId;
2303
+ const collectionId = params.collectionId;
2304
+ const documentId = params.documentId;
2305
+ const data = params.data;
2306
+ const permissions = params.permissions;
1775
2307
  if (typeof databaseId === "undefined") {
1776
2308
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1777
2309
  }
@@ -1803,18 +2335,24 @@ class Databases {
1803
2335
  payload
1804
2336
  );
1805
2337
  }
1806
- /**
1807
- * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1808
- *
1809
- * @param {string} databaseId
1810
- * @param {string} collectionId
1811
- * @param {string} documentId
1812
- * @param {Partial<Document extends Models.DefaultDocument ? Models.DataWithoutDocumentKeys : Omit<Document, keyof Models.Document>>} data
1813
- * @param {string[]} permissions
1814
- * @throws {AppwriteException}
1815
- * @returns {Promise<Document>}
1816
- */
1817
- updateDocument(databaseId, collectionId, documentId, data, permissions) {
2338
+ updateDocument(paramsOrFirst, ...rest) {
2339
+ let params;
2340
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2341
+ params = paramsOrFirst || {};
2342
+ } else {
2343
+ params = {
2344
+ databaseId: paramsOrFirst,
2345
+ collectionId: rest[0],
2346
+ documentId: rest[1],
2347
+ data: rest[2],
2348
+ permissions: rest[3]
2349
+ };
2350
+ }
2351
+ const databaseId = params.databaseId;
2352
+ const collectionId = params.collectionId;
2353
+ const documentId = params.documentId;
2354
+ const data = params.data;
2355
+ const permissions = params.permissions;
1818
2356
  if (typeof databaseId === "undefined") {
1819
2357
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1820
2358
  }
@@ -1843,16 +2381,20 @@ class Databases {
1843
2381
  payload
1844
2382
  );
1845
2383
  }
1846
- /**
1847
- * Delete a document by its unique ID.
1848
- *
1849
- * @param {string} databaseId
1850
- * @param {string} collectionId
1851
- * @param {string} documentId
1852
- * @throws {AppwriteException}
1853
- * @returns {Promise<{}>}
1854
- */
1855
- deleteDocument(databaseId, collectionId, documentId) {
2384
+ deleteDocument(paramsOrFirst, ...rest) {
2385
+ let params;
2386
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2387
+ params = paramsOrFirst || {};
2388
+ } else {
2389
+ params = {
2390
+ databaseId: paramsOrFirst,
2391
+ collectionId: rest[0],
2392
+ documentId: rest[1]
2393
+ };
2394
+ }
2395
+ const databaseId = params.databaseId;
2396
+ const collectionId = params.collectionId;
2397
+ const documentId = params.documentId;
1856
2398
  if (typeof databaseId === "undefined") {
1857
2399
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1858
2400
  }
@@ -1875,19 +2417,26 @@ class Databases {
1875
2417
  payload
1876
2418
  );
1877
2419
  }
1878
- /**
1879
- * Decrement a specific attribute of a document by a given value.
1880
- *
1881
- * @param {string} databaseId
1882
- * @param {string} collectionId
1883
- * @param {string} documentId
1884
- * @param {string} attribute
1885
- * @param {number} value
1886
- * @param {number} min
1887
- * @throws {AppwriteException}
1888
- * @returns {Promise<Document>}
1889
- */
1890
- decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min) {
2420
+ decrementDocumentAttribute(paramsOrFirst, ...rest) {
2421
+ let params;
2422
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2423
+ params = paramsOrFirst || {};
2424
+ } else {
2425
+ params = {
2426
+ databaseId: paramsOrFirst,
2427
+ collectionId: rest[0],
2428
+ documentId: rest[1],
2429
+ attribute: rest[2],
2430
+ value: rest[3],
2431
+ min: rest[4]
2432
+ };
2433
+ }
2434
+ const databaseId = params.databaseId;
2435
+ const collectionId = params.collectionId;
2436
+ const documentId = params.documentId;
2437
+ const attribute = params.attribute;
2438
+ const value = params.value;
2439
+ const min = params.min;
1891
2440
  if (typeof databaseId === "undefined") {
1892
2441
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1893
2442
  }
@@ -1919,19 +2468,26 @@ class Databases {
1919
2468
  payload
1920
2469
  );
1921
2470
  }
1922
- /**
1923
- * Increment a specific attribute of a document by a given value.
1924
- *
1925
- * @param {string} databaseId
1926
- * @param {string} collectionId
1927
- * @param {string} documentId
1928
- * @param {string} attribute
1929
- * @param {number} value
1930
- * @param {number} max
1931
- * @throws {AppwriteException}
1932
- * @returns {Promise<Document>}
1933
- */
1934
- incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max) {
2471
+ incrementDocumentAttribute(paramsOrFirst, ...rest) {
2472
+ let params;
2473
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2474
+ params = paramsOrFirst || {};
2475
+ } else {
2476
+ params = {
2477
+ databaseId: paramsOrFirst,
2478
+ collectionId: rest[0],
2479
+ documentId: rest[1],
2480
+ attribute: rest[2],
2481
+ value: rest[3],
2482
+ max: rest[4]
2483
+ };
2484
+ }
2485
+ const databaseId = params.databaseId;
2486
+ const collectionId = params.collectionId;
2487
+ const documentId = params.documentId;
2488
+ const attribute = params.attribute;
2489
+ const value = params.value;
2490
+ const max = params.max;
1935
2491
  if (typeof databaseId === "undefined") {
1936
2492
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1937
2493
  }
@@ -1963,16 +2519,20 @@ class Databases {
1963
2519
  payload
1964
2520
  );
1965
2521
  }
1966
- /**
1967
- * List indexes in the collection.
1968
- *
1969
- * @param {string} databaseId
1970
- * @param {string} collectionId
1971
- * @param {string[]} queries
1972
- * @throws {AppwriteException}
1973
- * @returns {Promise<Models.IndexList>}
1974
- */
1975
- listIndexes(databaseId, collectionId, queries) {
2522
+ listIndexes(paramsOrFirst, ...rest) {
2523
+ let params;
2524
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2525
+ params = paramsOrFirst || {};
2526
+ } else {
2527
+ params = {
2528
+ databaseId: paramsOrFirst,
2529
+ collectionId: rest[0],
2530
+ queries: rest[1]
2531
+ };
2532
+ }
2533
+ const databaseId = params.databaseId;
2534
+ const collectionId = params.collectionId;
2535
+ const queries = params.queries;
1976
2536
  if (typeof databaseId === "undefined") {
1977
2537
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1978
2538
  }
@@ -1993,21 +2553,28 @@ class Databases {
1993
2553
  payload
1994
2554
  );
1995
2555
  }
1996
- /**
1997
- * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
1998
- * Attributes can be `key`, `fulltext`, and `unique`.
1999
- *
2000
- * @param {string} databaseId
2001
- * @param {string} collectionId
2002
- * @param {string} key
2003
- * @param {IndexType} type
2004
- * @param {string[]} attributes
2005
- * @param {string[]} orders
2006
- * @param {number[]} lengths
2007
- * @throws {AppwriteException}
2008
- * @returns {Promise<Models.Index>}
2009
- */
2010
- createIndex(databaseId, collectionId, key, type, attributes, orders, lengths) {
2556
+ createIndex(paramsOrFirst, ...rest) {
2557
+ let params;
2558
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2559
+ params = paramsOrFirst || {};
2560
+ } else {
2561
+ params = {
2562
+ databaseId: paramsOrFirst,
2563
+ collectionId: rest[0],
2564
+ key: rest[1],
2565
+ type: rest[2],
2566
+ attributes: rest[3],
2567
+ orders: rest[4],
2568
+ lengths: rest[5]
2569
+ };
2570
+ }
2571
+ const databaseId = params.databaseId;
2572
+ const collectionId = params.collectionId;
2573
+ const key = params.key;
2574
+ const type = params.type;
2575
+ const attributes = params.attributes;
2576
+ const orders = params.orders;
2577
+ const lengths = params.lengths;
2011
2578
  if (typeof databaseId === "undefined") {
2012
2579
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
2013
2580
  }
@@ -2051,16 +2618,20 @@ class Databases {
2051
2618
  payload
2052
2619
  );
2053
2620
  }
2054
- /**
2055
- * Get index by ID.
2056
- *
2057
- * @param {string} databaseId
2058
- * @param {string} collectionId
2059
- * @param {string} key
2060
- * @throws {AppwriteException}
2061
- * @returns {Promise<Models.Index>}
2062
- */
2063
- getIndex(databaseId, collectionId, key) {
2621
+ getIndex(paramsOrFirst, ...rest) {
2622
+ let params;
2623
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2624
+ params = paramsOrFirst || {};
2625
+ } else {
2626
+ params = {
2627
+ databaseId: paramsOrFirst,
2628
+ collectionId: rest[0],
2629
+ key: rest[1]
2630
+ };
2631
+ }
2632
+ const databaseId = params.databaseId;
2633
+ const collectionId = params.collectionId;
2634
+ const key = params.key;
2064
2635
  if (typeof databaseId === "undefined") {
2065
2636
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
2066
2637
  }
@@ -2081,16 +2652,20 @@ class Databases {
2081
2652
  payload
2082
2653
  );
2083
2654
  }
2084
- /**
2085
- * Delete an index.
2086
- *
2087
- * @param {string} databaseId
2088
- * @param {string} collectionId
2089
- * @param {string} key
2090
- * @throws {AppwriteException}
2091
- * @returns {Promise<{}>}
2092
- */
2093
- deleteIndex(databaseId, collectionId, key) {
2655
+ deleteIndex(paramsOrFirst, ...rest) {
2656
+ let params;
2657
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
2658
+ params = paramsOrFirst || {};
2659
+ } else {
2660
+ params = {
2661
+ databaseId: paramsOrFirst,
2662
+ collectionId: rest[0],
2663
+ key: rest[1]
2664
+ };
2665
+ }
2666
+ const databaseId = params.databaseId;
2667
+ const collectionId = params.collectionId;
2668
+ const key = params.key;
2094
2669
  if (typeof databaseId === "undefined") {
2095
2670
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
2096
2671
  }