node-appwrite 8.2.0 → 10.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 (185) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/docs/examples/account/create-phone-verification.md +1 -1
  4. package/docs/examples/account/create-recovery.md +1 -1
  5. package/docs/examples/account/create-verification.md +1 -1
  6. package/docs/examples/account/delete-identity.md +20 -0
  7. package/docs/examples/account/delete-session.md +1 -1
  8. package/docs/examples/account/delete-sessions.md +1 -1
  9. package/docs/examples/account/get-prefs.md +1 -1
  10. package/docs/examples/account/get-session.md +1 -1
  11. package/docs/examples/account/get.md +1 -1
  12. package/docs/examples/account/list-identities.md +20 -0
  13. package/docs/examples/account/list-logs.md +1 -1
  14. package/docs/examples/account/list-sessions.md +1 -1
  15. package/docs/examples/account/update-email.md +1 -1
  16. package/docs/examples/account/update-name.md +1 -1
  17. package/docs/examples/account/update-password.md +2 -2
  18. package/docs/examples/account/update-phone-verification.md +1 -1
  19. package/docs/examples/account/update-phone.md +1 -1
  20. package/docs/examples/account/update-prefs.md +1 -1
  21. package/docs/examples/account/update-recovery.md +1 -1
  22. package/docs/examples/account/update-session.md +1 -1
  23. package/docs/examples/account/update-status.md +1 -1
  24. package/docs/examples/account/update-verification.md +1 -1
  25. package/docs/examples/avatars/get-browser.md +1 -1
  26. package/docs/examples/avatars/get-credit-card.md +1 -1
  27. package/docs/examples/avatars/get-favicon.md +1 -1
  28. package/docs/examples/avatars/get-flag.md +1 -1
  29. package/docs/examples/avatars/get-image.md +1 -1
  30. package/docs/examples/avatars/get-initials.md +1 -1
  31. package/docs/examples/avatars/get-q-r.md +1 -1
  32. package/docs/examples/databases/create-boolean-attribute.md +1 -1
  33. package/docs/examples/databases/create-collection.md +1 -1
  34. package/docs/examples/databases/create-datetime-attribute.md +1 -1
  35. package/docs/examples/databases/create-document.md +1 -1
  36. package/docs/examples/databases/create-email-attribute.md +1 -1
  37. package/docs/examples/databases/create-enum-attribute.md +1 -1
  38. package/docs/examples/databases/create-float-attribute.md +1 -1
  39. package/docs/examples/databases/create-index.md +1 -1
  40. package/docs/examples/databases/create-integer-attribute.md +1 -1
  41. package/docs/examples/databases/create-ip-attribute.md +1 -1
  42. package/docs/examples/databases/create-relationship-attribute.md +20 -0
  43. package/docs/examples/databases/create-string-attribute.md +1 -1
  44. package/docs/examples/databases/create-url-attribute.md +1 -1
  45. package/docs/examples/databases/create.md +1 -1
  46. package/docs/examples/databases/delete-attribute.md +1 -1
  47. package/docs/examples/databases/delete-collection.md +1 -1
  48. package/docs/examples/databases/delete-document.md +1 -1
  49. package/docs/examples/databases/delete-index.md +1 -1
  50. package/docs/examples/databases/delete.md +1 -1
  51. package/docs/examples/databases/get-attribute.md +1 -1
  52. package/docs/examples/databases/get-collection.md +1 -1
  53. package/docs/examples/databases/get-document.md +1 -1
  54. package/docs/examples/databases/get-index.md +1 -1
  55. package/docs/examples/databases/get.md +1 -1
  56. package/docs/examples/databases/list-attributes.md +1 -1
  57. package/docs/examples/databases/list-collections.md +1 -1
  58. package/docs/examples/databases/list-documents.md +1 -1
  59. package/docs/examples/databases/list-indexes.md +1 -1
  60. package/docs/examples/databases/list.md +1 -1
  61. package/docs/examples/databases/update-boolean-attribute.md +20 -0
  62. package/docs/examples/databases/update-collection.md +1 -1
  63. package/docs/examples/databases/update-datetime-attribute.md +20 -0
  64. package/docs/examples/databases/update-document.md +1 -1
  65. package/docs/examples/databases/update-email-attribute.md +20 -0
  66. package/docs/examples/databases/update-enum-attribute.md +20 -0
  67. package/docs/examples/databases/update-float-attribute.md +20 -0
  68. package/docs/examples/databases/update-integer-attribute.md +20 -0
  69. package/docs/examples/databases/update-ip-attribute.md +20 -0
  70. package/docs/examples/databases/update-relationship-attribute.md +20 -0
  71. package/docs/examples/databases/update-string-attribute.md +20 -0
  72. package/docs/examples/databases/update-url-attribute.md +20 -0
  73. package/docs/examples/databases/update.md +1 -1
  74. package/docs/examples/functions/create-build.md +1 -1
  75. package/docs/examples/functions/create-deployment.md +2 -2
  76. package/docs/examples/functions/create-execution.md +1 -1
  77. package/docs/examples/functions/create-variable.md +1 -1
  78. package/docs/examples/functions/create.md +2 -2
  79. package/docs/examples/functions/delete-deployment.md +1 -1
  80. package/docs/examples/functions/delete-variable.md +1 -1
  81. package/docs/examples/functions/delete.md +1 -1
  82. package/docs/examples/functions/download-deployment.md +20 -0
  83. package/docs/examples/functions/get-deployment.md +1 -1
  84. package/docs/examples/functions/get-execution.md +1 -1
  85. package/docs/examples/functions/get-variable.md +1 -1
  86. package/docs/examples/functions/get.md +1 -1
  87. package/docs/examples/functions/list-deployments.md +1 -1
  88. package/docs/examples/functions/list-executions.md +1 -1
  89. package/docs/examples/functions/list-runtimes.md +1 -1
  90. package/docs/examples/functions/list-variables.md +1 -1
  91. package/docs/examples/functions/list.md +1 -1
  92. package/docs/examples/functions/update-deployment.md +1 -1
  93. package/docs/examples/functions/update-variable.md +1 -1
  94. package/docs/examples/functions/update.md +2 -2
  95. package/docs/examples/graphql/mutation.md +1 -1
  96. package/docs/examples/graphql/query.md +1 -1
  97. package/docs/examples/health/get-antivirus.md +1 -1
  98. package/docs/examples/health/get-cache.md +1 -1
  99. package/docs/examples/health/get-d-b.md +1 -1
  100. package/docs/examples/health/get-pub-sub.md +20 -0
  101. package/docs/examples/health/get-queue-certificates.md +1 -1
  102. package/docs/examples/health/get-queue-functions.md +1 -1
  103. package/docs/examples/health/get-queue-logs.md +1 -1
  104. package/docs/examples/health/get-queue-webhooks.md +1 -1
  105. package/docs/examples/health/get-queue.md +20 -0
  106. package/docs/examples/health/get-storage-local.md +1 -1
  107. package/docs/examples/health/get-time.md +1 -1
  108. package/docs/examples/health/get.md +1 -1
  109. package/docs/examples/locale/get.md +1 -1
  110. package/docs/examples/locale/list-codes.md +20 -0
  111. package/docs/examples/locale/list-continents.md +1 -1
  112. package/docs/examples/locale/list-countries-e-u.md +1 -1
  113. package/docs/examples/locale/list-countries-phones.md +1 -1
  114. package/docs/examples/locale/list-countries.md +1 -1
  115. package/docs/examples/locale/list-currencies.md +1 -1
  116. package/docs/examples/locale/list-languages.md +1 -1
  117. package/docs/examples/storage/create-bucket.md +1 -1
  118. package/docs/examples/storage/create-file.md +1 -1
  119. package/docs/examples/storage/delete-bucket.md +1 -1
  120. package/docs/examples/storage/delete-file.md +1 -1
  121. package/docs/examples/storage/get-bucket.md +1 -1
  122. package/docs/examples/storage/get-file-download.md +1 -1
  123. package/docs/examples/storage/get-file-preview.md +1 -1
  124. package/docs/examples/storage/get-file-view.md +1 -1
  125. package/docs/examples/storage/get-file.md +1 -1
  126. package/docs/examples/storage/list-buckets.md +1 -1
  127. package/docs/examples/storage/list-files.md +1 -1
  128. package/docs/examples/storage/update-bucket.md +1 -1
  129. package/docs/examples/storage/update-file.md +1 -1
  130. package/docs/examples/teams/create-membership.md +2 -2
  131. package/docs/examples/teams/create.md +1 -1
  132. package/docs/examples/teams/delete-membership.md +1 -1
  133. package/docs/examples/teams/delete.md +1 -1
  134. package/docs/examples/teams/get-membership.md +1 -1
  135. package/docs/examples/teams/get-prefs.md +20 -0
  136. package/docs/examples/teams/get.md +1 -1
  137. package/docs/examples/teams/list-memberships.md +1 -1
  138. package/docs/examples/teams/list.md +1 -1
  139. package/docs/examples/teams/update-membership-status.md +1 -1
  140. package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
  141. package/docs/examples/teams/{update.md → update-name.md} +2 -2
  142. package/docs/examples/teams/update-prefs.md +20 -0
  143. package/docs/examples/users/create-argon2user.md +1 -1
  144. package/docs/examples/users/create-bcrypt-user.md +1 -1
  145. package/docs/examples/users/create-m-d5user.md +1 -1
  146. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  147. package/docs/examples/users/create-s-h-a-user.md +1 -1
  148. package/docs/examples/users/create-scrypt-modified-user.md +1 -1
  149. package/docs/examples/users/create-scrypt-user.md +1 -1
  150. package/docs/examples/users/create.md +1 -1
  151. package/docs/examples/users/delete-identity.md +20 -0
  152. package/docs/examples/users/delete-session.md +1 -1
  153. package/docs/examples/users/delete-sessions.md +1 -1
  154. package/docs/examples/users/delete.md +1 -1
  155. package/docs/examples/users/get-prefs.md +1 -1
  156. package/docs/examples/users/get.md +1 -1
  157. package/docs/examples/users/list-identities.md +20 -0
  158. package/docs/examples/users/list-logs.md +1 -1
  159. package/docs/examples/users/list-memberships.md +1 -1
  160. package/docs/examples/users/list-sessions.md +1 -1
  161. package/docs/examples/users/list.md +1 -1
  162. package/docs/examples/users/update-email-verification.md +1 -1
  163. package/docs/examples/users/update-email.md +1 -1
  164. package/docs/examples/users/update-labels.md +20 -0
  165. package/docs/examples/users/update-name.md +1 -1
  166. package/docs/examples/users/update-password.md +2 -2
  167. package/docs/examples/users/update-phone-verification.md +1 -1
  168. package/docs/examples/users/update-phone.md +1 -1
  169. package/docs/examples/users/update-prefs.md +1 -1
  170. package/docs/examples/users/update-status.md +1 -1
  171. package/index.d.ts +767 -165
  172. package/lib/client.js +5 -2
  173. package/lib/inputFile.js +6 -8
  174. package/lib/query.js +18 -0
  175. package/lib/services/account.js +94 -50
  176. package/lib/services/avatars.js +14 -14
  177. package/lib/services/databases.js +826 -180
  178. package/lib/services/functions.js +254 -101
  179. package/lib/services/graphql.js +4 -4
  180. package/lib/services/health.js +57 -22
  181. package/lib/services/locale.js +32 -14
  182. package/lib/services/storage.js +76 -63
  183. package/lib/services/teams.js +112 -43
  184. package/lib/services/users.js +135 -50
  185. package/package.json +6 -4
@@ -26,7 +26,7 @@ class Databases extends Service {
26
26
  * @returns {Promise}
27
27
  */
28
28
  async list(queries, search) {
29
- let path = '/databases';
29
+ const apiPath = '/databases';
30
30
  let payload = {};
31
31
 
32
32
  if (typeof queries !== 'undefined') {
@@ -37,7 +37,7 @@ class Databases extends Service {
37
37
  payload['search'] = search;
38
38
  }
39
39
 
40
- return await this.client.call('get', path, {
40
+ return await this.client.call('get', apiPath, {
41
41
  'content-type': 'application/json',
42
42
  }, payload);
43
43
  }
@@ -50,11 +50,12 @@ class Databases extends Service {
50
50
  *
51
51
  * @param {string} databaseId
52
52
  * @param {string} name
53
+ * @param {boolean} enabled
53
54
  * @throws {AppwriteException}
54
55
  * @returns {Promise}
55
56
  */
56
- async create(databaseId, name) {
57
- let path = '/databases';
57
+ async create(databaseId, name, enabled) {
58
+ const apiPath = '/databases';
58
59
  let payload = {};
59
60
  if (typeof databaseId === 'undefined') {
60
61
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -73,7 +74,11 @@ class Databases extends Service {
73
74
  payload['name'] = name;
74
75
  }
75
76
 
76
- return await this.client.call('post', path, {
77
+ if (typeof enabled !== 'undefined') {
78
+ payload['enabled'] = enabled;
79
+ }
80
+
81
+ return await this.client.call('post', apiPath, {
77
82
  'content-type': 'application/json',
78
83
  }, payload);
79
84
  }
@@ -89,14 +94,14 @@ class Databases extends Service {
89
94
  * @returns {Promise}
90
95
  */
91
96
  async get(databaseId) {
92
- let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
97
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
93
98
  let payload = {};
94
99
  if (typeof databaseId === 'undefined') {
95
100
  throw new AppwriteException('Missing required parameter: "databaseId"');
96
101
  }
97
102
 
98
103
 
99
- return await this.client.call('get', path, {
104
+ return await this.client.call('get', apiPath, {
100
105
  'content-type': 'application/json',
101
106
  }, payload);
102
107
  }
@@ -108,11 +113,12 @@ class Databases extends Service {
108
113
  *
109
114
  * @param {string} databaseId
110
115
  * @param {string} name
116
+ * @param {boolean} enabled
111
117
  * @throws {AppwriteException}
112
118
  * @returns {Promise}
113
119
  */
114
- async update(databaseId, name) {
115
- let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
120
+ async update(databaseId, name, enabled) {
121
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
116
122
  let payload = {};
117
123
  if (typeof databaseId === 'undefined') {
118
124
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -127,7 +133,11 @@ class Databases extends Service {
127
133
  payload['name'] = name;
128
134
  }
129
135
 
130
- return await this.client.call('put', path, {
136
+ if (typeof enabled !== 'undefined') {
137
+ payload['enabled'] = enabled;
138
+ }
139
+
140
+ return await this.client.call('put', apiPath, {
131
141
  'content-type': 'application/json',
132
142
  }, payload);
133
143
  }
@@ -143,14 +153,14 @@ class Databases extends Service {
143
153
  * @returns {Promise}
144
154
  */
145
155
  async delete(databaseId) {
146
- let path = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
156
+ const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
147
157
  let payload = {};
148
158
  if (typeof databaseId === 'undefined') {
149
159
  throw new AppwriteException('Missing required parameter: "databaseId"');
150
160
  }
151
161
 
152
162
 
153
- return await this.client.call('delete', path, {
163
+ return await this.client.call('delete', apiPath, {
154
164
  'content-type': 'application/json',
155
165
  }, payload);
156
166
  }
@@ -168,7 +178,7 @@ class Databases extends Service {
168
178
  * @returns {Promise}
169
179
  */
170
180
  async listCollections(databaseId, queries, search) {
171
- let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
181
+ const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
172
182
  let payload = {};
173
183
  if (typeof databaseId === 'undefined') {
174
184
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -183,7 +193,7 @@ class Databases extends Service {
183
193
  payload['search'] = search;
184
194
  }
185
195
 
186
- return await this.client.call('get', path, {
196
+ return await this.client.call('get', apiPath, {
187
197
  'content-type': 'application/json',
188
198
  }, payload);
189
199
  }
@@ -201,11 +211,12 @@ class Databases extends Service {
201
211
  * @param {string} name
202
212
  * @param {string[]} permissions
203
213
  * @param {boolean} documentSecurity
214
+ * @param {boolean} enabled
204
215
  * @throws {AppwriteException}
205
216
  * @returns {Promise}
206
217
  */
207
- async createCollection(databaseId, collectionId, name, permissions, documentSecurity) {
208
- let path = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
218
+ async createCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) {
219
+ const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
209
220
  let payload = {};
210
221
  if (typeof databaseId === 'undefined') {
211
222
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -236,7 +247,11 @@ class Databases extends Service {
236
247
  payload['documentSecurity'] = documentSecurity;
237
248
  }
238
249
 
239
- return await this.client.call('post', path, {
250
+ if (typeof enabled !== 'undefined') {
251
+ payload['enabled'] = enabled;
252
+ }
253
+
254
+ return await this.client.call('post', apiPath, {
240
255
  'content-type': 'application/json',
241
256
  }, payload);
242
257
  }
@@ -253,7 +268,7 @@ class Databases extends Service {
253
268
  * @returns {Promise}
254
269
  */
255
270
  async getCollection(databaseId, collectionId) {
256
- let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
271
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
257
272
  let payload = {};
258
273
  if (typeof databaseId === 'undefined') {
259
274
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -264,7 +279,7 @@ class Databases extends Service {
264
279
  }
265
280
 
266
281
 
267
- return await this.client.call('get', path, {
282
+ return await this.client.call('get', apiPath, {
268
283
  'content-type': 'application/json',
269
284
  }, payload);
270
285
  }
@@ -284,7 +299,7 @@ class Databases extends Service {
284
299
  * @returns {Promise}
285
300
  */
286
301
  async updateCollection(databaseId, collectionId, name, permissions, documentSecurity, enabled) {
287
- let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
302
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
288
303
  let payload = {};
289
304
  if (typeof databaseId === 'undefined') {
290
305
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -315,7 +330,7 @@ class Databases extends Service {
315
330
  payload['enabled'] = enabled;
316
331
  }
317
332
 
318
- return await this.client.call('put', path, {
333
+ return await this.client.call('put', apiPath, {
319
334
  'content-type': 'application/json',
320
335
  }, payload);
321
336
  }
@@ -332,7 +347,7 @@ class Databases extends Service {
332
347
  * @returns {Promise}
333
348
  */
334
349
  async deleteCollection(databaseId, collectionId) {
335
- let path = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
350
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
336
351
  let payload = {};
337
352
  if (typeof databaseId === 'undefined') {
338
353
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -343,7 +358,7 @@ class Databases extends Service {
343
358
  }
344
359
 
345
360
 
346
- return await this.client.call('delete', path, {
361
+ return await this.client.call('delete', apiPath, {
347
362
  'content-type': 'application/json',
348
363
  }, payload);
349
364
  }
@@ -353,11 +368,12 @@ class Databases extends Service {
353
368
  *
354
369
  * @param {string} databaseId
355
370
  * @param {string} collectionId
371
+ * @param {string[]} queries
356
372
  * @throws {AppwriteException}
357
373
  * @returns {Promise}
358
374
  */
359
- async listAttributes(databaseId, collectionId) {
360
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
375
+ async listAttributes(databaseId, collectionId, queries) {
376
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
361
377
  let payload = {};
362
378
  if (typeof databaseId === 'undefined') {
363
379
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -368,7 +384,11 @@ class Databases extends Service {
368
384
  }
369
385
 
370
386
 
371
- return await this.client.call('get', path, {
387
+ if (typeof queries !== 'undefined') {
388
+ payload['queries'] = queries;
389
+ }
390
+
391
+ return await this.client.call('get', apiPath, {
372
392
  'content-type': 'application/json',
373
393
  }, payload);
374
394
  }
@@ -389,7 +409,7 @@ class Databases extends Service {
389
409
  * @returns {Promise}
390
410
  */
391
411
  async createBooleanAttribute(databaseId, collectionId, key, required, xdefault, array) {
392
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
412
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
393
413
  let payload = {};
394
414
  if (typeof databaseId === 'undefined') {
395
415
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -424,25 +444,24 @@ class Databases extends Service {
424
444
  payload['array'] = array;
425
445
  }
426
446
 
427
- return await this.client.call('post', path, {
447
+ return await this.client.call('post', apiPath, {
428
448
  'content-type': 'application/json',
429
449
  }, payload);
430
450
  }
431
451
 
432
452
  /**
433
- * Create DateTime Attribute
453
+ * Update Boolean Attribute
434
454
  *
435
455
  * @param {string} databaseId
436
456
  * @param {string} collectionId
437
457
  * @param {string} key
438
458
  * @param {boolean} required
439
- * @param {string} xdefault
440
- * @param {boolean} array
459
+ * @param {boolean} xdefault
441
460
  * @throws {AppwriteException}
442
461
  * @returns {Promise}
443
462
  */
444
- async createDatetimeAttribute(databaseId, collectionId, key, required, xdefault, array) {
445
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
463
+ async updateBooleanAttribute(databaseId, collectionId, key, required, xdefault) {
464
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
446
465
  let payload = {};
447
466
  if (typeof databaseId === 'undefined') {
448
467
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -460,11 +479,11 @@ class Databases extends Service {
460
479
  throw new AppwriteException('Missing required parameter: "required"');
461
480
  }
462
481
 
463
-
464
- if (typeof key !== 'undefined') {
465
- payload['key'] = key;
482
+ if (typeof xdefault === 'undefined') {
483
+ throw new AppwriteException('Missing required parameter: "xdefault"');
466
484
  }
467
485
 
486
+
468
487
  if (typeof required !== 'undefined') {
469
488
  payload['required'] = required;
470
489
  }
@@ -473,20 +492,13 @@ class Databases extends Service {
473
492
  payload['default'] = xdefault;
474
493
  }
475
494
 
476
- if (typeof array !== 'undefined') {
477
- payload['array'] = array;
478
- }
479
-
480
- return await this.client.call('post', path, {
495
+ return await this.client.call('patch', apiPath, {
481
496
  'content-type': 'application/json',
482
497
  }, payload);
483
498
  }
484
499
 
485
500
  /**
486
- * Create Email Attribute
487
- *
488
- * Create an email attribute.
489
- *
501
+ * Create DateTime Attribute
490
502
  *
491
503
  * @param {string} databaseId
492
504
  * @param {string} collectionId
@@ -497,8 +509,8 @@ class Databases extends Service {
497
509
  * @throws {AppwriteException}
498
510
  * @returns {Promise}
499
511
  */
500
- async createEmailAttribute(databaseId, collectionId, key, required, xdefault, array) {
501
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
512
+ async createDatetimeAttribute(databaseId, collectionId, key, required, xdefault, array) {
513
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
502
514
  let payload = {};
503
515
  if (typeof databaseId === 'undefined') {
504
516
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -533,26 +545,24 @@ class Databases extends Service {
533
545
  payload['array'] = array;
534
546
  }
535
547
 
536
- return await this.client.call('post', path, {
548
+ return await this.client.call('post', apiPath, {
537
549
  'content-type': 'application/json',
538
550
  }, payload);
539
551
  }
540
552
 
541
553
  /**
542
- * Create Enum Attribute
554
+ * Update DateTime Attribute
543
555
  *
544
556
  * @param {string} databaseId
545
557
  * @param {string} collectionId
546
558
  * @param {string} key
547
- * @param {string[]} elements
548
559
  * @param {boolean} required
549
560
  * @param {string} xdefault
550
- * @param {boolean} array
551
561
  * @throws {AppwriteException}
552
562
  * @returns {Promise}
553
563
  */
554
- async createEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, array) {
555
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
564
+ async updateDatetimeAttribute(databaseId, collectionId, key, required, xdefault) {
565
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
556
566
  let payload = {};
557
567
  if (typeof databaseId === 'undefined') {
558
568
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -566,22 +576,14 @@ class Databases extends Service {
566
576
  throw new AppwriteException('Missing required parameter: "key"');
567
577
  }
568
578
 
569
- if (typeof elements === 'undefined') {
570
- throw new AppwriteException('Missing required parameter: "elements"');
571
- }
572
-
573
579
  if (typeof required === 'undefined') {
574
580
  throw new AppwriteException('Missing required parameter: "required"');
575
581
  }
576
582
 
577
-
578
- if (typeof key !== 'undefined') {
579
- payload['key'] = key;
583
+ if (typeof xdefault === 'undefined') {
584
+ throw new AppwriteException('Missing required parameter: "xdefault"');
580
585
  }
581
586
 
582
- if (typeof elements !== 'undefined') {
583
- payload['elements'] = elements;
584
- }
585
587
 
586
588
  if (typeof required !== 'undefined') {
587
589
  payload['required'] = required;
@@ -591,35 +593,28 @@ class Databases extends Service {
591
593
  payload['default'] = xdefault;
592
594
  }
593
595
 
594
- if (typeof array !== 'undefined') {
595
- payload['array'] = array;
596
- }
597
-
598
- return await this.client.call('post', path, {
596
+ return await this.client.call('patch', apiPath, {
599
597
  'content-type': 'application/json',
600
598
  }, payload);
601
599
  }
602
600
 
603
601
  /**
604
- * Create Float Attribute
602
+ * Create Email Attribute
605
603
  *
606
- * Create a float attribute. Optionally, minimum and maximum values can be
607
- * provided.
604
+ * Create an email attribute.
608
605
  *
609
606
  *
610
607
  * @param {string} databaseId
611
608
  * @param {string} collectionId
612
609
  * @param {string} key
613
610
  * @param {boolean} required
614
- * @param {number} min
615
- * @param {number} max
616
- * @param {number} xdefault
611
+ * @param {string} xdefault
617
612
  * @param {boolean} array
618
613
  * @throws {AppwriteException}
619
614
  * @returns {Promise}
620
615
  */
621
- async createFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
622
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
616
+ async createEmailAttribute(databaseId, collectionId, key, required, xdefault, array) {
617
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
623
618
  let payload = {};
624
619
  if (typeof databaseId === 'undefined') {
625
620
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -646,14 +641,6 @@ class Databases extends Service {
646
641
  payload['required'] = required;
647
642
  }
648
643
 
649
- if (typeof min !== 'undefined') {
650
- payload['min'] = min;
651
- }
652
-
653
- if (typeof max !== 'undefined') {
654
- payload['max'] = max;
655
- }
656
-
657
644
  if (typeof xdefault !== 'undefined') {
658
645
  payload['default'] = xdefault;
659
646
  }
@@ -662,31 +649,28 @@ class Databases extends Service {
662
649
  payload['array'] = array;
663
650
  }
664
651
 
665
- return await this.client.call('post', path, {
652
+ return await this.client.call('post', apiPath, {
666
653
  'content-type': 'application/json',
667
654
  }, payload);
668
655
  }
669
656
 
670
657
  /**
671
- * Create Integer Attribute
658
+ * Update Email Attribute
672
659
  *
673
- * Create an integer attribute. Optionally, minimum and maximum values can be
674
- * provided.
660
+ * Update an email attribute. Changing the `default` value will not update
661
+ * already existing documents.
675
662
  *
676
663
  *
677
664
  * @param {string} databaseId
678
665
  * @param {string} collectionId
679
666
  * @param {string} key
680
667
  * @param {boolean} required
681
- * @param {number} min
682
- * @param {number} max
683
- * @param {number} xdefault
684
- * @param {boolean} array
668
+ * @param {string} xdefault
685
669
  * @throws {AppwriteException}
686
670
  * @returns {Promise}
687
671
  */
688
- async createIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
689
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
672
+ async updateEmailAttribute(databaseId, collectionId, key, required, xdefault) {
673
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
690
674
  let payload = {};
691
675
  if (typeof databaseId === 'undefined') {
692
676
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -704,53 +688,39 @@ class Databases extends Service {
704
688
  throw new AppwriteException('Missing required parameter: "required"');
705
689
  }
706
690
 
707
-
708
- if (typeof key !== 'undefined') {
709
- payload['key'] = key;
691
+ if (typeof xdefault === 'undefined') {
692
+ throw new AppwriteException('Missing required parameter: "xdefault"');
710
693
  }
711
694
 
695
+
712
696
  if (typeof required !== 'undefined') {
713
697
  payload['required'] = required;
714
698
  }
715
699
 
716
- if (typeof min !== 'undefined') {
717
- payload['min'] = min;
718
- }
719
-
720
- if (typeof max !== 'undefined') {
721
- payload['max'] = max;
722
- }
723
-
724
700
  if (typeof xdefault !== 'undefined') {
725
701
  payload['default'] = xdefault;
726
702
  }
727
703
 
728
- if (typeof array !== 'undefined') {
729
- payload['array'] = array;
730
- }
731
-
732
- return await this.client.call('post', path, {
704
+ return await this.client.call('patch', apiPath, {
733
705
  'content-type': 'application/json',
734
706
  }, payload);
735
707
  }
736
708
 
737
709
  /**
738
- * Create IP Address Attribute
739
- *
740
- * Create IP address attribute.
741
- *
710
+ * Create Enum Attribute
742
711
  *
743
712
  * @param {string} databaseId
744
713
  * @param {string} collectionId
745
714
  * @param {string} key
715
+ * @param {string[]} elements
746
716
  * @param {boolean} required
747
717
  * @param {string} xdefault
748
718
  * @param {boolean} array
749
719
  * @throws {AppwriteException}
750
720
  * @returns {Promise}
751
721
  */
752
- async createIpAttribute(databaseId, collectionId, key, required, xdefault, array) {
753
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
722
+ async createEnumAttribute(databaseId, collectionId, key, elements, required, xdefault, array) {
723
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
754
724
  let payload = {};
755
725
  if (typeof databaseId === 'undefined') {
756
726
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -764,6 +734,10 @@ class Databases extends Service {
764
734
  throw new AppwriteException('Missing required parameter: "key"');
765
735
  }
766
736
 
737
+ if (typeof elements === 'undefined') {
738
+ throw new AppwriteException('Missing required parameter: "elements"');
739
+ }
740
+
767
741
  if (typeof required === 'undefined') {
768
742
  throw new AppwriteException('Missing required parameter: "required"');
769
743
  }
@@ -773,6 +747,10 @@ class Databases extends Service {
773
747
  payload['key'] = key;
774
748
  }
775
749
 
750
+ if (typeof elements !== 'undefined') {
751
+ payload['elements'] = elements;
752
+ }
753
+
776
754
  if (typeof required !== 'undefined') {
777
755
  payload['required'] = required;
778
756
  }
@@ -785,29 +763,29 @@ class Databases extends Service {
785
763
  payload['array'] = array;
786
764
  }
787
765
 
788
- return await this.client.call('post', path, {
766
+ return await this.client.call('post', apiPath, {
789
767
  'content-type': 'application/json',
790
768
  }, payload);
791
769
  }
792
770
 
793
771
  /**
794
- * Create String Attribute
772
+ * Update Enum Attribute
795
773
  *
796
- * Create a string attribute.
774
+ * Update an enum attribute. Changing the `default` value will not update
775
+ * already existing documents.
797
776
  *
798
777
  *
799
778
  * @param {string} databaseId
800
779
  * @param {string} collectionId
801
780
  * @param {string} key
802
- * @param {number} size
781
+ * @param {string[]} elements
803
782
  * @param {boolean} required
804
783
  * @param {string} xdefault
805
- * @param {boolean} array
806
784
  * @throws {AppwriteException}
807
785
  * @returns {Promise}
808
786
  */
809
- async createStringAttribute(databaseId, collectionId, key, size, required, xdefault, array) {
810
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
787
+ async updateEnumAttribute(databaseId, collectionId, key, elements, required, xdefault) {
788
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
811
789
  let payload = {};
812
790
  if (typeof databaseId === 'undefined') {
813
791
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -821,21 +799,21 @@ class Databases extends Service {
821
799
  throw new AppwriteException('Missing required parameter: "key"');
822
800
  }
823
801
 
824
- if (typeof size === 'undefined') {
825
- throw new AppwriteException('Missing required parameter: "size"');
802
+ if (typeof elements === 'undefined') {
803
+ throw new AppwriteException('Missing required parameter: "elements"');
826
804
  }
827
805
 
828
806
  if (typeof required === 'undefined') {
829
807
  throw new AppwriteException('Missing required parameter: "required"');
830
808
  }
831
809
 
832
-
833
- if (typeof key !== 'undefined') {
834
- payload['key'] = key;
810
+ if (typeof xdefault === 'undefined') {
811
+ throw new AppwriteException('Missing required parameter: "xdefault"');
835
812
  }
836
813
 
837
- if (typeof size !== 'undefined') {
838
- payload['size'] = size;
814
+
815
+ if (typeof elements !== 'undefined') {
816
+ payload['elements'] = elements;
839
817
  }
840
818
 
841
819
  if (typeof required !== 'undefined') {
@@ -846,32 +824,31 @@ class Databases extends Service {
846
824
  payload['default'] = xdefault;
847
825
  }
848
826
 
849
- if (typeof array !== 'undefined') {
850
- payload['array'] = array;
851
- }
852
-
853
- return await this.client.call('post', path, {
827
+ return await this.client.call('patch', apiPath, {
854
828
  'content-type': 'application/json',
855
829
  }, payload);
856
830
  }
857
831
 
858
832
  /**
859
- * Create URL Attribute
833
+ * Create Float Attribute
860
834
  *
861
- * Create a URL attribute.
835
+ * Create a float attribute. Optionally, minimum and maximum values can be
836
+ * provided.
862
837
  *
863
838
  *
864
839
  * @param {string} databaseId
865
840
  * @param {string} collectionId
866
841
  * @param {string} key
867
842
  * @param {boolean} required
868
- * @param {string} xdefault
843
+ * @param {number} min
844
+ * @param {number} max
845
+ * @param {number} xdefault
869
846
  * @param {boolean} array
870
847
  * @throws {AppwriteException}
871
848
  * @returns {Promise}
872
849
  */
873
- async createUrlAttribute(databaseId, collectionId, key, required, xdefault, array) {
874
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
850
+ async createFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
851
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
875
852
  let payload = {};
876
853
  if (typeof databaseId === 'undefined') {
877
854
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -898,6 +875,14 @@ class Databases extends Service {
898
875
  payload['required'] = required;
899
876
  }
900
877
 
878
+ if (typeof min !== 'undefined') {
879
+ payload['min'] = min;
880
+ }
881
+
882
+ if (typeof max !== 'undefined') {
883
+ payload['max'] = max;
884
+ }
885
+
901
886
  if (typeof xdefault !== 'undefined') {
902
887
  payload['default'] = xdefault;
903
888
  }
@@ -906,22 +891,30 @@ class Databases extends Service {
906
891
  payload['array'] = array;
907
892
  }
908
893
 
909
- return await this.client.call('post', path, {
894
+ return await this.client.call('post', apiPath, {
910
895
  'content-type': 'application/json',
911
896
  }, payload);
912
897
  }
913
898
 
914
899
  /**
915
- * Get Attribute
900
+ * Update Float Attribute
901
+ *
902
+ * Update a float attribute. Changing the `default` value will not update
903
+ * already existing documents.
904
+ *
916
905
  *
917
906
  * @param {string} databaseId
918
907
  * @param {string} collectionId
919
908
  * @param {string} key
909
+ * @param {boolean} required
910
+ * @param {number} min
911
+ * @param {number} max
912
+ * @param {number} xdefault
920
913
  * @throws {AppwriteException}
921
914
  * @returns {Promise}
922
915
  */
923
- async getAttribute(databaseId, collectionId, key) {
924
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
916
+ async updateFloatAttribute(databaseId, collectionId, key, required, min, max, xdefault) {
917
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
925
918
  let payload = {};
926
919
  if (typeof databaseId === 'undefined') {
927
920
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -935,23 +928,64 @@ class Databases extends Service {
935
928
  throw new AppwriteException('Missing required parameter: "key"');
936
929
  }
937
930
 
931
+ if (typeof required === 'undefined') {
932
+ throw new AppwriteException('Missing required parameter: "required"');
933
+ }
934
+
935
+ if (typeof min === 'undefined') {
936
+ throw new AppwriteException('Missing required parameter: "min"');
937
+ }
938
+
939
+ if (typeof max === 'undefined') {
940
+ throw new AppwriteException('Missing required parameter: "max"');
941
+ }
942
+
943
+ if (typeof xdefault === 'undefined') {
944
+ throw new AppwriteException('Missing required parameter: "xdefault"');
945
+ }
946
+
947
+
948
+ if (typeof required !== 'undefined') {
949
+ payload['required'] = required;
950
+ }
951
+
952
+ if (typeof min !== 'undefined') {
953
+ payload['min'] = min;
954
+ }
955
+
956
+ if (typeof max !== 'undefined') {
957
+ payload['max'] = max;
958
+ }
959
+
960
+ if (typeof xdefault !== 'undefined') {
961
+ payload['default'] = xdefault;
962
+ }
938
963
 
939
- return await this.client.call('get', path, {
964
+ return await this.client.call('patch', apiPath, {
940
965
  'content-type': 'application/json',
941
966
  }, payload);
942
967
  }
943
968
 
944
969
  /**
945
- * Delete Attribute
970
+ * Create Integer Attribute
971
+ *
972
+ * Create an integer attribute. Optionally, minimum and maximum values can be
973
+ * provided.
974
+ *
946
975
  *
947
976
  * @param {string} databaseId
948
977
  * @param {string} collectionId
949
978
  * @param {string} key
979
+ * @param {boolean} required
980
+ * @param {number} min
981
+ * @param {number} max
982
+ * @param {number} xdefault
983
+ * @param {boolean} array
950
984
  * @throws {AppwriteException}
951
985
  * @returns {Promise}
952
986
  */
953
- async deleteAttribute(databaseId, collectionId, key) {
954
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
987
+ async createIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault, array) {
988
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
955
989
  let payload = {};
956
990
  if (typeof databaseId === 'undefined') {
957
991
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -965,26 +999,59 @@ class Databases extends Service {
965
999
  throw new AppwriteException('Missing required parameter: "key"');
966
1000
  }
967
1001
 
1002
+ if (typeof required === 'undefined') {
1003
+ throw new AppwriteException('Missing required parameter: "required"');
1004
+ }
1005
+
1006
+
1007
+ if (typeof key !== 'undefined') {
1008
+ payload['key'] = key;
1009
+ }
1010
+
1011
+ if (typeof required !== 'undefined') {
1012
+ payload['required'] = required;
1013
+ }
1014
+
1015
+ if (typeof min !== 'undefined') {
1016
+ payload['min'] = min;
1017
+ }
1018
+
1019
+ if (typeof max !== 'undefined') {
1020
+ payload['max'] = max;
1021
+ }
1022
+
1023
+ if (typeof xdefault !== 'undefined') {
1024
+ payload['default'] = xdefault;
1025
+ }
1026
+
1027
+ if (typeof array !== 'undefined') {
1028
+ payload['array'] = array;
1029
+ }
968
1030
 
969
- return await this.client.call('delete', path, {
1031
+ return await this.client.call('post', apiPath, {
970
1032
  'content-type': 'application/json',
971
1033
  }, payload);
972
1034
  }
973
1035
 
974
1036
  /**
975
- * List Documents
1037
+ * Update Integer Attribute
976
1038
  *
977
- * Get a list of all the user's documents in a given collection. You can use
978
- * the query params to filter your results.
1039
+ * Update an integer attribute. Changing the `default` value will not update
1040
+ * already existing documents.
1041
+ *
979
1042
  *
980
1043
  * @param {string} databaseId
981
1044
  * @param {string} collectionId
982
- * @param {string[]} queries
1045
+ * @param {string} key
1046
+ * @param {boolean} required
1047
+ * @param {number} min
1048
+ * @param {number} max
1049
+ * @param {number} xdefault
983
1050
  * @throws {AppwriteException}
984
1051
  * @returns {Promise}
985
1052
  */
986
- async listDocuments(databaseId, collectionId, queries) {
987
- let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1053
+ async updateIntegerAttribute(databaseId, collectionId, key, required, min, max, xdefault) {
1054
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
988
1055
  let payload = {};
989
1056
  if (typeof databaseId === 'undefined') {
990
1057
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -994,17 +1061,586 @@ class Databases extends Service {
994
1061
  throw new AppwriteException('Missing required parameter: "collectionId"');
995
1062
  }
996
1063
 
1064
+ if (typeof key === 'undefined') {
1065
+ throw new AppwriteException('Missing required parameter: "key"');
1066
+ }
997
1067
 
998
- if (typeof queries !== 'undefined') {
999
- payload['queries'] = queries;
1068
+ if (typeof required === 'undefined') {
1069
+ throw new AppwriteException('Missing required parameter: "required"');
1000
1070
  }
1001
1071
 
1002
- return await this.client.call('get', path, {
1003
- 'content-type': 'application/json',
1004
- }, payload);
1005
- }
1072
+ if (typeof min === 'undefined') {
1073
+ throw new AppwriteException('Missing required parameter: "min"');
1074
+ }
1006
1075
 
1007
- /**
1076
+ if (typeof max === 'undefined') {
1077
+ throw new AppwriteException('Missing required parameter: "max"');
1078
+ }
1079
+
1080
+ if (typeof xdefault === 'undefined') {
1081
+ throw new AppwriteException('Missing required parameter: "xdefault"');
1082
+ }
1083
+
1084
+
1085
+ if (typeof required !== 'undefined') {
1086
+ payload['required'] = required;
1087
+ }
1088
+
1089
+ if (typeof min !== 'undefined') {
1090
+ payload['min'] = min;
1091
+ }
1092
+
1093
+ if (typeof max !== 'undefined') {
1094
+ payload['max'] = max;
1095
+ }
1096
+
1097
+ if (typeof xdefault !== 'undefined') {
1098
+ payload['default'] = xdefault;
1099
+ }
1100
+
1101
+ return await this.client.call('patch', apiPath, {
1102
+ 'content-type': 'application/json',
1103
+ }, payload);
1104
+ }
1105
+
1106
+ /**
1107
+ * Create IP Address Attribute
1108
+ *
1109
+ * Create IP address attribute.
1110
+ *
1111
+ *
1112
+ * @param {string} databaseId
1113
+ * @param {string} collectionId
1114
+ * @param {string} key
1115
+ * @param {boolean} required
1116
+ * @param {string} xdefault
1117
+ * @param {boolean} array
1118
+ * @throws {AppwriteException}
1119
+ * @returns {Promise}
1120
+ */
1121
+ async createIpAttribute(databaseId, collectionId, key, required, xdefault, array) {
1122
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1123
+ let payload = {};
1124
+ if (typeof databaseId === 'undefined') {
1125
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1126
+ }
1127
+
1128
+ if (typeof collectionId === 'undefined') {
1129
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1130
+ }
1131
+
1132
+ if (typeof key === 'undefined') {
1133
+ throw new AppwriteException('Missing required parameter: "key"');
1134
+ }
1135
+
1136
+ if (typeof required === 'undefined') {
1137
+ throw new AppwriteException('Missing required parameter: "required"');
1138
+ }
1139
+
1140
+
1141
+ if (typeof key !== 'undefined') {
1142
+ payload['key'] = key;
1143
+ }
1144
+
1145
+ if (typeof required !== 'undefined') {
1146
+ payload['required'] = required;
1147
+ }
1148
+
1149
+ if (typeof xdefault !== 'undefined') {
1150
+ payload['default'] = xdefault;
1151
+ }
1152
+
1153
+ if (typeof array !== 'undefined') {
1154
+ payload['array'] = array;
1155
+ }
1156
+
1157
+ return await this.client.call('post', apiPath, {
1158
+ 'content-type': 'application/json',
1159
+ }, payload);
1160
+ }
1161
+
1162
+ /**
1163
+ * Update IP Address Attribute
1164
+ *
1165
+ * Update an ip attribute. Changing the `default` value will not update
1166
+ * already existing documents.
1167
+ *
1168
+ *
1169
+ * @param {string} databaseId
1170
+ * @param {string} collectionId
1171
+ * @param {string} key
1172
+ * @param {boolean} required
1173
+ * @param {string} xdefault
1174
+ * @throws {AppwriteException}
1175
+ * @returns {Promise}
1176
+ */
1177
+ async updateIpAttribute(databaseId, collectionId, key, required, xdefault) {
1178
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1179
+ let payload = {};
1180
+ if (typeof databaseId === 'undefined') {
1181
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1182
+ }
1183
+
1184
+ if (typeof collectionId === 'undefined') {
1185
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1186
+ }
1187
+
1188
+ if (typeof key === 'undefined') {
1189
+ throw new AppwriteException('Missing required parameter: "key"');
1190
+ }
1191
+
1192
+ if (typeof required === 'undefined') {
1193
+ throw new AppwriteException('Missing required parameter: "required"');
1194
+ }
1195
+
1196
+ if (typeof xdefault === 'undefined') {
1197
+ throw new AppwriteException('Missing required parameter: "xdefault"');
1198
+ }
1199
+
1200
+
1201
+ if (typeof required !== 'undefined') {
1202
+ payload['required'] = required;
1203
+ }
1204
+
1205
+ if (typeof xdefault !== 'undefined') {
1206
+ payload['default'] = xdefault;
1207
+ }
1208
+
1209
+ return await this.client.call('patch', apiPath, {
1210
+ 'content-type': 'application/json',
1211
+ }, payload);
1212
+ }
1213
+
1214
+ /**
1215
+ * Create Relationship Attribute
1216
+ *
1217
+ * Create relationship attribute. [Learn more about relationship
1218
+ * attributes](/docs/databases-relationships#relationship-attributes).
1219
+ *
1220
+ *
1221
+ * @param {string} databaseId
1222
+ * @param {string} collectionId
1223
+ * @param {string} relatedCollectionId
1224
+ * @param {string} type
1225
+ * @param {boolean} twoWay
1226
+ * @param {string} key
1227
+ * @param {string} twoWayKey
1228
+ * @param {string} onDelete
1229
+ * @throws {AppwriteException}
1230
+ * @returns {Promise}
1231
+ */
1232
+ async createRelationshipAttribute(databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete) {
1233
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1234
+ let payload = {};
1235
+ if (typeof databaseId === 'undefined') {
1236
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1237
+ }
1238
+
1239
+ if (typeof collectionId === 'undefined') {
1240
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1241
+ }
1242
+
1243
+ if (typeof relatedCollectionId === 'undefined') {
1244
+ throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
1245
+ }
1246
+
1247
+ if (typeof type === 'undefined') {
1248
+ throw new AppwriteException('Missing required parameter: "type"');
1249
+ }
1250
+
1251
+
1252
+ if (typeof relatedCollectionId !== 'undefined') {
1253
+ payload['relatedCollectionId'] = relatedCollectionId;
1254
+ }
1255
+
1256
+ if (typeof type !== 'undefined') {
1257
+ payload['type'] = type;
1258
+ }
1259
+
1260
+ if (typeof twoWay !== 'undefined') {
1261
+ payload['twoWay'] = twoWay;
1262
+ }
1263
+
1264
+ if (typeof key !== 'undefined') {
1265
+ payload['key'] = key;
1266
+ }
1267
+
1268
+ if (typeof twoWayKey !== 'undefined') {
1269
+ payload['twoWayKey'] = twoWayKey;
1270
+ }
1271
+
1272
+ if (typeof onDelete !== 'undefined') {
1273
+ payload['onDelete'] = onDelete;
1274
+ }
1275
+
1276
+ return await this.client.call('post', apiPath, {
1277
+ 'content-type': 'application/json',
1278
+ }, payload);
1279
+ }
1280
+
1281
+ /**
1282
+ * Create String Attribute
1283
+ *
1284
+ * Create a string attribute.
1285
+ *
1286
+ *
1287
+ * @param {string} databaseId
1288
+ * @param {string} collectionId
1289
+ * @param {string} key
1290
+ * @param {number} size
1291
+ * @param {boolean} required
1292
+ * @param {string} xdefault
1293
+ * @param {boolean} array
1294
+ * @param {boolean} encrypt
1295
+ * @throws {AppwriteException}
1296
+ * @returns {Promise}
1297
+ */
1298
+ async createStringAttribute(databaseId, collectionId, key, size, required, xdefault, array, encrypt) {
1299
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1300
+ let payload = {};
1301
+ if (typeof databaseId === 'undefined') {
1302
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1303
+ }
1304
+
1305
+ if (typeof collectionId === 'undefined') {
1306
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1307
+ }
1308
+
1309
+ if (typeof key === 'undefined') {
1310
+ throw new AppwriteException('Missing required parameter: "key"');
1311
+ }
1312
+
1313
+ if (typeof size === 'undefined') {
1314
+ throw new AppwriteException('Missing required parameter: "size"');
1315
+ }
1316
+
1317
+ if (typeof required === 'undefined') {
1318
+ throw new AppwriteException('Missing required parameter: "required"');
1319
+ }
1320
+
1321
+
1322
+ if (typeof key !== 'undefined') {
1323
+ payload['key'] = key;
1324
+ }
1325
+
1326
+ if (typeof size !== 'undefined') {
1327
+ payload['size'] = size;
1328
+ }
1329
+
1330
+ if (typeof required !== 'undefined') {
1331
+ payload['required'] = required;
1332
+ }
1333
+
1334
+ if (typeof xdefault !== 'undefined') {
1335
+ payload['default'] = xdefault;
1336
+ }
1337
+
1338
+ if (typeof array !== 'undefined') {
1339
+ payload['array'] = array;
1340
+ }
1341
+
1342
+ if (typeof encrypt !== 'undefined') {
1343
+ payload['encrypt'] = encrypt;
1344
+ }
1345
+
1346
+ return await this.client.call('post', apiPath, {
1347
+ 'content-type': 'application/json',
1348
+ }, payload);
1349
+ }
1350
+
1351
+ /**
1352
+ * Update String Attribute
1353
+ *
1354
+ * Update a string attribute. Changing the `default` value will not update
1355
+ * already existing documents.
1356
+ *
1357
+ *
1358
+ * @param {string} databaseId
1359
+ * @param {string} collectionId
1360
+ * @param {string} key
1361
+ * @param {boolean} required
1362
+ * @param {string} xdefault
1363
+ * @throws {AppwriteException}
1364
+ * @returns {Promise}
1365
+ */
1366
+ async updateStringAttribute(databaseId, collectionId, key, required, xdefault) {
1367
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1368
+ let payload = {};
1369
+ if (typeof databaseId === 'undefined') {
1370
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1371
+ }
1372
+
1373
+ if (typeof collectionId === 'undefined') {
1374
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1375
+ }
1376
+
1377
+ if (typeof key === 'undefined') {
1378
+ throw new AppwriteException('Missing required parameter: "key"');
1379
+ }
1380
+
1381
+ if (typeof required === 'undefined') {
1382
+ throw new AppwriteException('Missing required parameter: "required"');
1383
+ }
1384
+
1385
+ if (typeof xdefault === 'undefined') {
1386
+ throw new AppwriteException('Missing required parameter: "xdefault"');
1387
+ }
1388
+
1389
+
1390
+ if (typeof required !== 'undefined') {
1391
+ payload['required'] = required;
1392
+ }
1393
+
1394
+ if (typeof xdefault !== 'undefined') {
1395
+ payload['default'] = xdefault;
1396
+ }
1397
+
1398
+ return await this.client.call('patch', apiPath, {
1399
+ 'content-type': 'application/json',
1400
+ }, payload);
1401
+ }
1402
+
1403
+ /**
1404
+ * Create URL Attribute
1405
+ *
1406
+ * Create a URL attribute.
1407
+ *
1408
+ *
1409
+ * @param {string} databaseId
1410
+ * @param {string} collectionId
1411
+ * @param {string} key
1412
+ * @param {boolean} required
1413
+ * @param {string} xdefault
1414
+ * @param {boolean} array
1415
+ * @throws {AppwriteException}
1416
+ * @returns {Promise}
1417
+ */
1418
+ async createUrlAttribute(databaseId, collectionId, key, required, xdefault, array) {
1419
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1420
+ let payload = {};
1421
+ if (typeof databaseId === 'undefined') {
1422
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1423
+ }
1424
+
1425
+ if (typeof collectionId === 'undefined') {
1426
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1427
+ }
1428
+
1429
+ if (typeof key === 'undefined') {
1430
+ throw new AppwriteException('Missing required parameter: "key"');
1431
+ }
1432
+
1433
+ if (typeof required === 'undefined') {
1434
+ throw new AppwriteException('Missing required parameter: "required"');
1435
+ }
1436
+
1437
+
1438
+ if (typeof key !== 'undefined') {
1439
+ payload['key'] = key;
1440
+ }
1441
+
1442
+ if (typeof required !== 'undefined') {
1443
+ payload['required'] = required;
1444
+ }
1445
+
1446
+ if (typeof xdefault !== 'undefined') {
1447
+ payload['default'] = xdefault;
1448
+ }
1449
+
1450
+ if (typeof array !== 'undefined') {
1451
+ payload['array'] = array;
1452
+ }
1453
+
1454
+ return await this.client.call('post', apiPath, {
1455
+ 'content-type': 'application/json',
1456
+ }, payload);
1457
+ }
1458
+
1459
+ /**
1460
+ * Update URL Attribute
1461
+ *
1462
+ * Update an url attribute. Changing the `default` value will not update
1463
+ * already existing documents.
1464
+ *
1465
+ *
1466
+ * @param {string} databaseId
1467
+ * @param {string} collectionId
1468
+ * @param {string} key
1469
+ * @param {boolean} required
1470
+ * @param {string} xdefault
1471
+ * @throws {AppwriteException}
1472
+ * @returns {Promise}
1473
+ */
1474
+ async updateUrlAttribute(databaseId, collectionId, key, required, xdefault) {
1475
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1476
+ let payload = {};
1477
+ if (typeof databaseId === 'undefined') {
1478
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1479
+ }
1480
+
1481
+ if (typeof collectionId === 'undefined') {
1482
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1483
+ }
1484
+
1485
+ if (typeof key === 'undefined') {
1486
+ throw new AppwriteException('Missing required parameter: "key"');
1487
+ }
1488
+
1489
+ if (typeof required === 'undefined') {
1490
+ throw new AppwriteException('Missing required parameter: "required"');
1491
+ }
1492
+
1493
+ if (typeof xdefault === 'undefined') {
1494
+ throw new AppwriteException('Missing required parameter: "xdefault"');
1495
+ }
1496
+
1497
+
1498
+ if (typeof required !== 'undefined') {
1499
+ payload['required'] = required;
1500
+ }
1501
+
1502
+ if (typeof xdefault !== 'undefined') {
1503
+ payload['default'] = xdefault;
1504
+ }
1505
+
1506
+ return await this.client.call('patch', apiPath, {
1507
+ 'content-type': 'application/json',
1508
+ }, payload);
1509
+ }
1510
+
1511
+ /**
1512
+ * Get Attribute
1513
+ *
1514
+ * @param {string} databaseId
1515
+ * @param {string} collectionId
1516
+ * @param {string} key
1517
+ * @throws {AppwriteException}
1518
+ * @returns {Promise}
1519
+ */
1520
+ async getAttribute(databaseId, collectionId, key) {
1521
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1522
+ let payload = {};
1523
+ if (typeof databaseId === 'undefined') {
1524
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1525
+ }
1526
+
1527
+ if (typeof collectionId === 'undefined') {
1528
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1529
+ }
1530
+
1531
+ if (typeof key === 'undefined') {
1532
+ throw new AppwriteException('Missing required parameter: "key"');
1533
+ }
1534
+
1535
+
1536
+ return await this.client.call('get', apiPath, {
1537
+ 'content-type': 'application/json',
1538
+ }, payload);
1539
+ }
1540
+
1541
+ /**
1542
+ * Delete Attribute
1543
+ *
1544
+ * @param {string} databaseId
1545
+ * @param {string} collectionId
1546
+ * @param {string} key
1547
+ * @throws {AppwriteException}
1548
+ * @returns {Promise}
1549
+ */
1550
+ async deleteAttribute(databaseId, collectionId, key) {
1551
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1552
+ let payload = {};
1553
+ if (typeof databaseId === 'undefined') {
1554
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1555
+ }
1556
+
1557
+ if (typeof collectionId === 'undefined') {
1558
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1559
+ }
1560
+
1561
+ if (typeof key === 'undefined') {
1562
+ throw new AppwriteException('Missing required parameter: "key"');
1563
+ }
1564
+
1565
+
1566
+ return await this.client.call('delete', apiPath, {
1567
+ 'content-type': 'application/json',
1568
+ }, payload);
1569
+ }
1570
+
1571
+ /**
1572
+ * Update Relationship Attribute
1573
+ *
1574
+ * Update relationship attribute. [Learn more about relationship
1575
+ * attributes](/docs/databases-relationships#relationship-attributes).
1576
+ *
1577
+ *
1578
+ * @param {string} databaseId
1579
+ * @param {string} collectionId
1580
+ * @param {string} key
1581
+ * @param {string} onDelete
1582
+ * @throws {AppwriteException}
1583
+ * @returns {Promise}
1584
+ */
1585
+ async updateRelationshipAttribute(databaseId, collectionId, key, onDelete) {
1586
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1587
+ let payload = {};
1588
+ if (typeof databaseId === 'undefined') {
1589
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1590
+ }
1591
+
1592
+ if (typeof collectionId === 'undefined') {
1593
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1594
+ }
1595
+
1596
+ if (typeof key === 'undefined') {
1597
+ throw new AppwriteException('Missing required parameter: "key"');
1598
+ }
1599
+
1600
+
1601
+ if (typeof onDelete !== 'undefined') {
1602
+ payload['onDelete'] = onDelete;
1603
+ }
1604
+
1605
+ return await this.client.call('patch', apiPath, {
1606
+ 'content-type': 'application/json',
1607
+ }, payload);
1608
+ }
1609
+
1610
+ /**
1611
+ * List Documents
1612
+ *
1613
+ * Get a list of all the user's documents in a given collection. You can use
1614
+ * the query params to filter your results.
1615
+ *
1616
+ * @param {string} databaseId
1617
+ * @param {string} collectionId
1618
+ * @param {string[]} queries
1619
+ * @throws {AppwriteException}
1620
+ * @returns {Promise}
1621
+ */
1622
+ async listDocuments(databaseId, collectionId, queries) {
1623
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1624
+ let payload = {};
1625
+ if (typeof databaseId === 'undefined') {
1626
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1627
+ }
1628
+
1629
+ if (typeof collectionId === 'undefined') {
1630
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1631
+ }
1632
+
1633
+
1634
+ if (typeof queries !== 'undefined') {
1635
+ payload['queries'] = queries;
1636
+ }
1637
+
1638
+ return await this.client.call('get', apiPath, {
1639
+ 'content-type': 'application/json',
1640
+ }, payload);
1641
+ }
1642
+
1643
+ /**
1008
1644
  * Create Document
1009
1645
  *
1010
1646
  * Create a new Document. Before using this route, you should create a new
@@ -1021,7 +1657,7 @@ class Databases extends Service {
1021
1657
  * @returns {Promise}
1022
1658
  */
1023
1659
  async createDocument(databaseId, collectionId, documentId, data, permissions) {
1024
- let path = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1660
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1025
1661
  let payload = {};
1026
1662
  if (typeof databaseId === 'undefined') {
1027
1663
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1052,7 +1688,7 @@ class Databases extends Service {
1052
1688
  payload['permissions'] = permissions;
1053
1689
  }
1054
1690
 
1055
- return await this.client.call('post', path, {
1691
+ return await this.client.call('post', apiPath, {
1056
1692
  'content-type': 'application/json',
1057
1693
  }, payload);
1058
1694
  }
@@ -1066,11 +1702,12 @@ class Databases extends Service {
1066
1702
  * @param {string} databaseId
1067
1703
  * @param {string} collectionId
1068
1704
  * @param {string} documentId
1705
+ * @param {string[]} queries
1069
1706
  * @throws {AppwriteException}
1070
1707
  * @returns {Promise}
1071
1708
  */
1072
- async getDocument(databaseId, collectionId, documentId) {
1073
- let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1709
+ async getDocument(databaseId, collectionId, documentId, queries) {
1710
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1074
1711
  let payload = {};
1075
1712
  if (typeof databaseId === 'undefined') {
1076
1713
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1085,7 +1722,11 @@ class Databases extends Service {
1085
1722
  }
1086
1723
 
1087
1724
 
1088
- return await this.client.call('get', path, {
1725
+ if (typeof queries !== 'undefined') {
1726
+ payload['queries'] = queries;
1727
+ }
1728
+
1729
+ return await this.client.call('get', apiPath, {
1089
1730
  'content-type': 'application/json',
1090
1731
  }, payload);
1091
1732
  }
@@ -1105,7 +1746,7 @@ class Databases extends Service {
1105
1746
  * @returns {Promise}
1106
1747
  */
1107
1748
  async updateDocument(databaseId, collectionId, documentId, data, permissions) {
1108
- let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1749
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1109
1750
  let payload = {};
1110
1751
  if (typeof databaseId === 'undefined') {
1111
1752
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1128,7 +1769,7 @@ class Databases extends Service {
1128
1769
  payload['permissions'] = permissions;
1129
1770
  }
1130
1771
 
1131
- return await this.client.call('patch', path, {
1772
+ return await this.client.call('patch', apiPath, {
1132
1773
  'content-type': 'application/json',
1133
1774
  }, payload);
1134
1775
  }
@@ -1145,7 +1786,7 @@ class Databases extends Service {
1145
1786
  * @returns {Promise}
1146
1787
  */
1147
1788
  async deleteDocument(databaseId, collectionId, documentId) {
1148
- let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1789
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1149
1790
  let payload = {};
1150
1791
  if (typeof databaseId === 'undefined') {
1151
1792
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1160,7 +1801,7 @@ class Databases extends Service {
1160
1801
  }
1161
1802
 
1162
1803
 
1163
- return await this.client.call('delete', path, {
1804
+ return await this.client.call('delete', apiPath, {
1164
1805
  'content-type': 'application/json',
1165
1806
  }, payload);
1166
1807
  }
@@ -1170,11 +1811,12 @@ class Databases extends Service {
1170
1811
  *
1171
1812
  * @param {string} databaseId
1172
1813
  * @param {string} collectionId
1814
+ * @param {string[]} queries
1173
1815
  * @throws {AppwriteException}
1174
1816
  * @returns {Promise}
1175
1817
  */
1176
- async listIndexes(databaseId, collectionId) {
1177
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1818
+ async listIndexes(databaseId, collectionId, queries) {
1819
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1178
1820
  let payload = {};
1179
1821
  if (typeof databaseId === 'undefined') {
1180
1822
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1185,7 +1827,11 @@ class Databases extends Service {
1185
1827
  }
1186
1828
 
1187
1829
 
1188
- return await this.client.call('get', path, {
1830
+ if (typeof queries !== 'undefined') {
1831
+ payload['queries'] = queries;
1832
+ }
1833
+
1834
+ return await this.client.call('get', apiPath, {
1189
1835
  'content-type': 'application/json',
1190
1836
  }, payload);
1191
1837
  }
@@ -1203,7 +1849,7 @@ class Databases extends Service {
1203
1849
  * @returns {Promise}
1204
1850
  */
1205
1851
  async createIndex(databaseId, collectionId, key, type, attributes, orders) {
1206
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1852
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1207
1853
  let payload = {};
1208
1854
  if (typeof databaseId === 'undefined') {
1209
1855
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1242,7 +1888,7 @@ class Databases extends Service {
1242
1888
  payload['orders'] = orders;
1243
1889
  }
1244
1890
 
1245
- return await this.client.call('post', path, {
1891
+ return await this.client.call('post', apiPath, {
1246
1892
  'content-type': 'application/json',
1247
1893
  }, payload);
1248
1894
  }
@@ -1257,7 +1903,7 @@ class Databases extends Service {
1257
1903
  * @returns {Promise}
1258
1904
  */
1259
1905
  async getIndex(databaseId, collectionId, key) {
1260
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1906
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1261
1907
  let payload = {};
1262
1908
  if (typeof databaseId === 'undefined') {
1263
1909
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1272,7 +1918,7 @@ class Databases extends Service {
1272
1918
  }
1273
1919
 
1274
1920
 
1275
- return await this.client.call('get', path, {
1921
+ return await this.client.call('get', apiPath, {
1276
1922
  'content-type': 'application/json',
1277
1923
  }, payload);
1278
1924
  }
@@ -1287,7 +1933,7 @@ class Databases extends Service {
1287
1933
  * @returns {Promise}
1288
1934
  */
1289
1935
  async deleteIndex(databaseId, collectionId, key) {
1290
- let path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1936
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1291
1937
  let payload = {};
1292
1938
  if (typeof databaseId === 'undefined') {
1293
1939
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1302,7 +1948,7 @@ class Databases extends Service {
1302
1948
  }
1303
1949
 
1304
1950
 
1305
- return await this.client.call('delete', path, {
1951
+ return await this.client.call('delete', apiPath, {
1306
1952
  'content-type': 'application/json',
1307
1953
  }, payload);
1308
1954
  }