node-appwrite 9.0.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 (182) hide show
  1. package/README.md +2 -2
  2. package/docs/examples/account/create-phone-verification.md +1 -1
  3. package/docs/examples/account/create-recovery.md +1 -1
  4. package/docs/examples/account/create-verification.md +1 -1
  5. package/docs/examples/account/delete-identity.md +20 -0
  6. package/docs/examples/account/delete-session.md +1 -1
  7. package/docs/examples/account/delete-sessions.md +1 -1
  8. package/docs/examples/account/get-prefs.md +1 -1
  9. package/docs/examples/account/get-session.md +1 -1
  10. package/docs/examples/account/get.md +1 -1
  11. package/docs/examples/account/list-identities.md +20 -0
  12. package/docs/examples/account/list-logs.md +1 -1
  13. package/docs/examples/account/list-sessions.md +1 -1
  14. package/docs/examples/account/update-email.md +1 -1
  15. package/docs/examples/account/update-name.md +1 -1
  16. package/docs/examples/account/update-password.md +1 -1
  17. package/docs/examples/account/update-phone-verification.md +1 -1
  18. package/docs/examples/account/update-phone.md +1 -1
  19. package/docs/examples/account/update-prefs.md +1 -1
  20. package/docs/examples/account/update-recovery.md +1 -1
  21. package/docs/examples/account/update-session.md +1 -1
  22. package/docs/examples/account/update-status.md +1 -1
  23. package/docs/examples/account/update-verification.md +1 -1
  24. package/docs/examples/avatars/get-browser.md +1 -1
  25. package/docs/examples/avatars/get-credit-card.md +1 -1
  26. package/docs/examples/avatars/get-favicon.md +1 -1
  27. package/docs/examples/avatars/get-flag.md +1 -1
  28. package/docs/examples/avatars/get-image.md +1 -1
  29. package/docs/examples/avatars/get-initials.md +1 -1
  30. package/docs/examples/avatars/get-q-r.md +1 -1
  31. package/docs/examples/databases/create-boolean-attribute.md +1 -1
  32. package/docs/examples/databases/create-collection.md +1 -1
  33. package/docs/examples/databases/create-datetime-attribute.md +1 -1
  34. package/docs/examples/databases/create-document.md +1 -1
  35. package/docs/examples/databases/create-email-attribute.md +1 -1
  36. package/docs/examples/databases/create-enum-attribute.md +1 -1
  37. package/docs/examples/databases/create-float-attribute.md +1 -1
  38. package/docs/examples/databases/create-index.md +1 -1
  39. package/docs/examples/databases/create-integer-attribute.md +1 -1
  40. package/docs/examples/databases/create-ip-attribute.md +1 -1
  41. package/docs/examples/databases/create-relationship-attribute.md +1 -1
  42. package/docs/examples/databases/create-string-attribute.md +1 -1
  43. package/docs/examples/databases/create-url-attribute.md +1 -1
  44. package/docs/examples/databases/create.md +1 -1
  45. package/docs/examples/databases/delete-attribute.md +1 -1
  46. package/docs/examples/databases/delete-collection.md +1 -1
  47. package/docs/examples/databases/delete-document.md +1 -1
  48. package/docs/examples/databases/delete-index.md +1 -1
  49. package/docs/examples/databases/delete.md +1 -1
  50. package/docs/examples/databases/get-attribute.md +1 -1
  51. package/docs/examples/databases/get-collection.md +1 -1
  52. package/docs/examples/databases/get-document.md +1 -1
  53. package/docs/examples/databases/get-index.md +1 -1
  54. package/docs/examples/databases/get.md +1 -1
  55. package/docs/examples/databases/list-attributes.md +1 -1
  56. package/docs/examples/databases/list-collections.md +1 -1
  57. package/docs/examples/databases/list-documents.md +1 -1
  58. package/docs/examples/databases/list-indexes.md +1 -1
  59. package/docs/examples/databases/list.md +1 -1
  60. package/docs/examples/databases/update-boolean-attribute.md +1 -1
  61. package/docs/examples/databases/update-collection.md +1 -1
  62. package/docs/examples/databases/update-datetime-attribute.md +1 -1
  63. package/docs/examples/databases/update-document.md +1 -1
  64. package/docs/examples/databases/update-email-attribute.md +1 -1
  65. package/docs/examples/databases/update-enum-attribute.md +1 -1
  66. package/docs/examples/databases/update-float-attribute.md +1 -1
  67. package/docs/examples/databases/update-integer-attribute.md +1 -1
  68. package/docs/examples/databases/update-ip-attribute.md +1 -1
  69. package/docs/examples/databases/update-relationship-attribute.md +1 -1
  70. package/docs/examples/databases/update-string-attribute.md +1 -1
  71. package/docs/examples/databases/update-url-attribute.md +1 -1
  72. package/docs/examples/databases/update.md +1 -1
  73. package/docs/examples/functions/create-build.md +1 -1
  74. package/docs/examples/functions/create-deployment.md +2 -2
  75. package/docs/examples/functions/create-execution.md +1 -1
  76. package/docs/examples/functions/create-variable.md +1 -1
  77. package/docs/examples/functions/create.md +1 -1
  78. package/docs/examples/functions/delete-deployment.md +1 -1
  79. package/docs/examples/functions/delete-variable.md +1 -1
  80. package/docs/examples/functions/delete.md +1 -1
  81. package/docs/examples/functions/download-deployment.md +20 -0
  82. package/docs/examples/functions/get-deployment.md +1 -1
  83. package/docs/examples/functions/get-execution.md +1 -1
  84. package/docs/examples/functions/get-variable.md +1 -1
  85. package/docs/examples/functions/get.md +1 -1
  86. package/docs/examples/functions/list-deployments.md +1 -1
  87. package/docs/examples/functions/list-executions.md +1 -1
  88. package/docs/examples/functions/list-runtimes.md +1 -1
  89. package/docs/examples/functions/list-variables.md +1 -1
  90. package/docs/examples/functions/list.md +1 -1
  91. package/docs/examples/functions/update-deployment.md +1 -1
  92. package/docs/examples/functions/update-variable.md +1 -1
  93. package/docs/examples/functions/update.md +2 -2
  94. package/docs/examples/graphql/mutation.md +1 -1
  95. package/docs/examples/graphql/query.md +1 -1
  96. package/docs/examples/health/get-antivirus.md +1 -1
  97. package/docs/examples/health/get-cache.md +1 -1
  98. package/docs/examples/health/get-d-b.md +1 -1
  99. package/docs/examples/health/get-pub-sub.md +20 -0
  100. package/docs/examples/health/get-queue-certificates.md +1 -1
  101. package/docs/examples/health/get-queue-functions.md +1 -1
  102. package/docs/examples/health/get-queue-logs.md +1 -1
  103. package/docs/examples/health/get-queue-webhooks.md +1 -1
  104. package/docs/examples/health/get-queue.md +20 -0
  105. package/docs/examples/health/get-storage-local.md +1 -1
  106. package/docs/examples/health/get-time.md +1 -1
  107. package/docs/examples/health/get.md +1 -1
  108. package/docs/examples/locale/get.md +1 -1
  109. package/docs/examples/locale/list-codes.md +20 -0
  110. package/docs/examples/locale/list-continents.md +1 -1
  111. package/docs/examples/locale/list-countries-e-u.md +1 -1
  112. package/docs/examples/locale/list-countries-phones.md +1 -1
  113. package/docs/examples/locale/list-countries.md +1 -1
  114. package/docs/examples/locale/list-currencies.md +1 -1
  115. package/docs/examples/locale/list-languages.md +1 -1
  116. package/docs/examples/storage/create-bucket.md +1 -1
  117. package/docs/examples/storage/create-file.md +1 -1
  118. package/docs/examples/storage/delete-bucket.md +1 -1
  119. package/docs/examples/storage/delete-file.md +1 -1
  120. package/docs/examples/storage/get-bucket.md +1 -1
  121. package/docs/examples/storage/get-file-download.md +1 -1
  122. package/docs/examples/storage/get-file-preview.md +1 -1
  123. package/docs/examples/storage/get-file-view.md +1 -1
  124. package/docs/examples/storage/get-file.md +1 -1
  125. package/docs/examples/storage/list-buckets.md +1 -1
  126. package/docs/examples/storage/list-files.md +1 -1
  127. package/docs/examples/storage/update-bucket.md +1 -1
  128. package/docs/examples/storage/update-file.md +1 -1
  129. package/docs/examples/teams/create-membership.md +1 -1
  130. package/docs/examples/teams/create.md +1 -1
  131. package/docs/examples/teams/delete-membership.md +1 -1
  132. package/docs/examples/teams/delete.md +1 -1
  133. package/docs/examples/teams/get-membership.md +1 -1
  134. package/docs/examples/teams/get-prefs.md +1 -1
  135. package/docs/examples/teams/get.md +1 -1
  136. package/docs/examples/teams/list-memberships.md +1 -1
  137. package/docs/examples/teams/list.md +1 -1
  138. package/docs/examples/teams/update-membership-status.md +1 -1
  139. package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
  140. package/docs/examples/teams/update-name.md +1 -1
  141. package/docs/examples/teams/update-prefs.md +1 -1
  142. package/docs/examples/users/create-argon2user.md +1 -1
  143. package/docs/examples/users/create-bcrypt-user.md +1 -1
  144. package/docs/examples/users/create-m-d5user.md +1 -1
  145. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  146. package/docs/examples/users/create-s-h-a-user.md +1 -1
  147. package/docs/examples/users/create-scrypt-modified-user.md +1 -1
  148. package/docs/examples/users/create-scrypt-user.md +1 -1
  149. package/docs/examples/users/create.md +1 -1
  150. package/docs/examples/users/delete-identity.md +20 -0
  151. package/docs/examples/users/delete-session.md +1 -1
  152. package/docs/examples/users/delete-sessions.md +1 -1
  153. package/docs/examples/users/delete.md +1 -1
  154. package/docs/examples/users/get-prefs.md +1 -1
  155. package/docs/examples/users/get.md +1 -1
  156. package/docs/examples/users/list-identities.md +20 -0
  157. package/docs/examples/users/list-logs.md +1 -1
  158. package/docs/examples/users/list-memberships.md +1 -1
  159. package/docs/examples/users/list-sessions.md +1 -1
  160. package/docs/examples/users/list.md +1 -1
  161. package/docs/examples/users/update-email-verification.md +1 -1
  162. package/docs/examples/users/update-email.md +1 -1
  163. package/docs/examples/users/update-labels.md +20 -0
  164. package/docs/examples/users/update-name.md +1 -1
  165. package/docs/examples/users/update-password.md +1 -1
  166. package/docs/examples/users/update-phone-verification.md +1 -1
  167. package/docs/examples/users/update-phone.md +1 -1
  168. package/docs/examples/users/update-prefs.md +1 -1
  169. package/docs/examples/users/update-status.md +1 -1
  170. package/index.d.ts +435 -55
  171. package/lib/client.js +4 -2
  172. package/lib/services/account.js +94 -50
  173. package/lib/services/avatars.js +14 -14
  174. package/lib/services/databases.js +120 -90
  175. package/lib/services/functions.js +212 -59
  176. package/lib/services/graphql.js +4 -4
  177. package/lib/services/health.js +57 -22
  178. package/lib/services/locale.js +32 -14
  179. package/lib/services/storage.js +33 -28
  180. package/lib/services/teams.js +29 -28
  181. package/lib/services/users.js +135 -50
  182. package/package.json +2 -2
@@ -26,7 +26,7 @@ class Functions extends Service {
26
26
  * @returns {Promise}
27
27
  */
28
28
  async list(queries, search) {
29
- let path = '/functions';
29
+ const apiPath = '/functions';
30
30
  let payload = {};
31
31
 
32
32
  if (typeof queries !== 'undefined') {
@@ -37,7 +37,7 @@ class Functions 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
  }
@@ -57,11 +57,23 @@ class Functions extends Service {
57
57
  * @param {string} schedule
58
58
  * @param {number} timeout
59
59
  * @param {boolean} enabled
60
+ * @param {boolean} logging
61
+ * @param {string} entrypoint
62
+ * @param {string} commands
63
+ * @param {string} installationId
64
+ * @param {string} providerRepositoryId
65
+ * @param {string} providerBranch
66
+ * @param {boolean} providerSilentMode
67
+ * @param {string} providerRootDirectory
68
+ * @param {string} templateRepository
69
+ * @param {string} templateOwner
70
+ * @param {string} templateRootDirectory
71
+ * @param {string} templateBranch
60
72
  * @throws {AppwriteException}
61
73
  * @returns {Promise}
62
74
  */
63
- async create(functionId, name, runtime, execute, events, schedule, timeout, enabled) {
64
- let path = '/functions';
75
+ async create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, templateRepository, templateOwner, templateRootDirectory, templateBranch) {
76
+ const apiPath = '/functions';
65
77
  let payload = {};
66
78
  if (typeof functionId === 'undefined') {
67
79
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -84,14 +96,14 @@ class Functions extends Service {
84
96
  payload['name'] = name;
85
97
  }
86
98
 
87
- if (typeof execute !== 'undefined') {
88
- payload['execute'] = execute;
89
- }
90
-
91
99
  if (typeof runtime !== 'undefined') {
92
100
  payload['runtime'] = runtime;
93
101
  }
94
102
 
103
+ if (typeof execute !== 'undefined') {
104
+ payload['execute'] = execute;
105
+ }
106
+
95
107
  if (typeof events !== 'undefined') {
96
108
  payload['events'] = events;
97
109
  }
@@ -108,7 +120,55 @@ class Functions extends Service {
108
120
  payload['enabled'] = enabled;
109
121
  }
110
122
 
111
- return await this.client.call('post', path, {
123
+ if (typeof logging !== 'undefined') {
124
+ payload['logging'] = logging;
125
+ }
126
+
127
+ if (typeof entrypoint !== 'undefined') {
128
+ payload['entrypoint'] = entrypoint;
129
+ }
130
+
131
+ if (typeof commands !== 'undefined') {
132
+ payload['commands'] = commands;
133
+ }
134
+
135
+ if (typeof installationId !== 'undefined') {
136
+ payload['installationId'] = installationId;
137
+ }
138
+
139
+ if (typeof providerRepositoryId !== 'undefined') {
140
+ payload['providerRepositoryId'] = providerRepositoryId;
141
+ }
142
+
143
+ if (typeof providerBranch !== 'undefined') {
144
+ payload['providerBranch'] = providerBranch;
145
+ }
146
+
147
+ if (typeof providerSilentMode !== 'undefined') {
148
+ payload['providerSilentMode'] = providerSilentMode;
149
+ }
150
+
151
+ if (typeof providerRootDirectory !== 'undefined') {
152
+ payload['providerRootDirectory'] = providerRootDirectory;
153
+ }
154
+
155
+ if (typeof templateRepository !== 'undefined') {
156
+ payload['templateRepository'] = templateRepository;
157
+ }
158
+
159
+ if (typeof templateOwner !== 'undefined') {
160
+ payload['templateOwner'] = templateOwner;
161
+ }
162
+
163
+ if (typeof templateRootDirectory !== 'undefined') {
164
+ payload['templateRootDirectory'] = templateRootDirectory;
165
+ }
166
+
167
+ if (typeof templateBranch !== 'undefined') {
168
+ payload['templateBranch'] = templateBranch;
169
+ }
170
+
171
+ return await this.client.call('post', apiPath, {
112
172
  'content-type': 'application/json',
113
173
  }, payload);
114
174
  }
@@ -122,10 +182,10 @@ class Functions extends Service {
122
182
  * @returns {Promise}
123
183
  */
124
184
  async listRuntimes() {
125
- let path = '/functions/runtimes';
185
+ const apiPath = '/functions/runtimes';
126
186
  let payload = {};
127
187
 
128
- return await this.client.call('get', path, {
188
+ return await this.client.call('get', apiPath, {
129
189
  'content-type': 'application/json',
130
190
  }, payload);
131
191
  }
@@ -140,14 +200,14 @@ class Functions extends Service {
140
200
  * @returns {Promise}
141
201
  */
142
202
  async get(functionId) {
143
- let path = '/functions/{functionId}'.replace('{functionId}', functionId);
203
+ const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
144
204
  let payload = {};
145
205
  if (typeof functionId === 'undefined') {
146
206
  throw new AppwriteException('Missing required parameter: "functionId"');
147
207
  }
148
208
 
149
209
 
150
- return await this.client.call('get', path, {
210
+ return await this.client.call('get', apiPath, {
151
211
  'content-type': 'application/json',
152
212
  }, payload);
153
213
  }
@@ -159,16 +219,25 @@ class Functions extends Service {
159
219
  *
160
220
  * @param {string} functionId
161
221
  * @param {string} name
222
+ * @param {string} runtime
162
223
  * @param {string[]} execute
163
224
  * @param {string[]} events
164
225
  * @param {string} schedule
165
226
  * @param {number} timeout
166
227
  * @param {boolean} enabled
228
+ * @param {boolean} logging
229
+ * @param {string} entrypoint
230
+ * @param {string} commands
231
+ * @param {string} installationId
232
+ * @param {string} providerRepositoryId
233
+ * @param {string} providerBranch
234
+ * @param {boolean} providerSilentMode
235
+ * @param {string} providerRootDirectory
167
236
  * @throws {AppwriteException}
168
237
  * @returns {Promise}
169
238
  */
170
- async update(functionId, name, execute, events, schedule, timeout, enabled) {
171
- let path = '/functions/{functionId}'.replace('{functionId}', functionId);
239
+ async update(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory) {
240
+ const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
172
241
  let payload = {};
173
242
  if (typeof functionId === 'undefined') {
174
243
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -178,11 +247,19 @@ class Functions extends Service {
178
247
  throw new AppwriteException('Missing required parameter: "name"');
179
248
  }
180
249
 
250
+ if (typeof runtime === 'undefined') {
251
+ throw new AppwriteException('Missing required parameter: "runtime"');
252
+ }
253
+
181
254
 
182
255
  if (typeof name !== 'undefined') {
183
256
  payload['name'] = name;
184
257
  }
185
258
 
259
+ if (typeof runtime !== 'undefined') {
260
+ payload['runtime'] = runtime;
261
+ }
262
+
186
263
  if (typeof execute !== 'undefined') {
187
264
  payload['execute'] = execute;
188
265
  }
@@ -203,7 +280,39 @@ class Functions extends Service {
203
280
  payload['enabled'] = enabled;
204
281
  }
205
282
 
206
- return await this.client.call('put', path, {
283
+ if (typeof logging !== 'undefined') {
284
+ payload['logging'] = logging;
285
+ }
286
+
287
+ if (typeof entrypoint !== 'undefined') {
288
+ payload['entrypoint'] = entrypoint;
289
+ }
290
+
291
+ if (typeof commands !== 'undefined') {
292
+ payload['commands'] = commands;
293
+ }
294
+
295
+ if (typeof installationId !== 'undefined') {
296
+ payload['installationId'] = installationId;
297
+ }
298
+
299
+ if (typeof providerRepositoryId !== 'undefined') {
300
+ payload['providerRepositoryId'] = providerRepositoryId;
301
+ }
302
+
303
+ if (typeof providerBranch !== 'undefined') {
304
+ payload['providerBranch'] = providerBranch;
305
+ }
306
+
307
+ if (typeof providerSilentMode !== 'undefined') {
308
+ payload['providerSilentMode'] = providerSilentMode;
309
+ }
310
+
311
+ if (typeof providerRootDirectory !== 'undefined') {
312
+ payload['providerRootDirectory'] = providerRootDirectory;
313
+ }
314
+
315
+ return await this.client.call('put', apiPath, {
207
316
  'content-type': 'application/json',
208
317
  }, payload);
209
318
  }
@@ -218,14 +327,14 @@ class Functions extends Service {
218
327
  * @returns {Promise}
219
328
  */
220
329
  async delete(functionId) {
221
- let path = '/functions/{functionId}'.replace('{functionId}', functionId);
330
+ const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
222
331
  let payload = {};
223
332
  if (typeof functionId === 'undefined') {
224
333
  throw new AppwriteException('Missing required parameter: "functionId"');
225
334
  }
226
335
 
227
336
 
228
- return await this.client.call('delete', path, {
337
+ return await this.client.call('delete', apiPath, {
229
338
  'content-type': 'application/json',
230
339
  }, payload);
231
340
  }
@@ -243,7 +352,7 @@ class Functions extends Service {
243
352
  * @returns {Promise}
244
353
  */
245
354
  async listDeployments(functionId, queries, search) {
246
- let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
355
+ const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
247
356
  let payload = {};
248
357
  if (typeof functionId === 'undefined') {
249
358
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -258,7 +367,7 @@ class Functions extends Service {
258
367
  payload['search'] = search;
259
368
  }
260
369
 
261
- return await this.client.call('get', path, {
370
+ return await this.client.call('get', apiPath, {
262
371
  'content-type': 'application/json',
263
372
  }, payload);
264
373
  }
@@ -275,26 +384,23 @@ class Functions extends Service {
275
384
  * learn more about code packaging in the [Appwrite Cloud Functions
276
385
  * tutorial](/docs/functions).
277
386
  *
278
- * Use the "command" param to set the entry point used to execute your code.
387
+ * Use the "command" param to set the entrypoint used to execute your code.
279
388
  *
280
389
  * @param {string} functionId
281
- * @param {string} entrypoint
282
390
  * @param {InputFile} code
283
391
  * @param {boolean} activate
392
+ * @param {string} entrypoint
393
+ * @param {string} commands
284
394
  * @throws {AppwriteException}
285
395
  * @returns {Promise}
286
396
  */
287
- async createDeployment(functionId, entrypoint, code, activate, onProgress = () => {}) {
288
- let path = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
397
+ async createDeployment(functionId, code, activate, entrypoint, commands, onProgress = () => {}) {
398
+ const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
289
399
  let payload = {};
290
400
  if (typeof functionId === 'undefined') {
291
401
  throw new AppwriteException('Missing required parameter: "functionId"');
292
402
  }
293
403
 
294
- if (typeof entrypoint === 'undefined') {
295
- throw new AppwriteException('Missing required parameter: "entrypoint"');
296
- }
297
-
298
404
  if (typeof code === 'undefined') {
299
405
  throw new AppwriteException('Missing required parameter: "code"');
300
406
  }
@@ -308,6 +414,10 @@ class Functions extends Service {
308
414
  payload['entrypoint'] = entrypoint;
309
415
  }
310
416
 
417
+ if (typeof commands !== 'undefined') {
418
+ payload['commands'] = commands;
419
+ }
420
+
311
421
  if (typeof code !== 'undefined') {
312
422
  payload['code'] = code;
313
423
  }
@@ -353,7 +463,7 @@ class Functions extends Service {
353
463
  const stream = Stream.Readable.from(currentChunk);
354
464
  payload['code'] = { type: 'file', file: stream, filename: code.filename };
355
465
 
356
- response = await selfClient.call('post', path, headers, payload);
466
+ response = await selfClient.call('post', apiPath, headers, payload);
357
467
 
358
468
  if (!id) {
359
469
  id = response['$id'];
@@ -449,7 +559,7 @@ class Functions extends Service {
449
559
  * @returns {Promise}
450
560
  */
451
561
  async getDeployment(functionId, deploymentId) {
452
- let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
562
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
453
563
  let payload = {};
454
564
  if (typeof functionId === 'undefined') {
455
565
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -460,7 +570,7 @@ class Functions extends Service {
460
570
  }
461
571
 
462
572
 
463
- return await this.client.call('get', path, {
573
+ return await this.client.call('get', apiPath, {
464
574
  'content-type': 'application/json',
465
575
  }, payload);
466
576
  }
@@ -478,7 +588,7 @@ class Functions extends Service {
478
588
  * @returns {Promise}
479
589
  */
480
590
  async updateDeployment(functionId, deploymentId) {
481
- let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
591
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
482
592
  let payload = {};
483
593
  if (typeof functionId === 'undefined') {
484
594
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -489,7 +599,7 @@ class Functions extends Service {
489
599
  }
490
600
 
491
601
 
492
- return await this.client.call('patch', path, {
602
+ return await this.client.call('patch', apiPath, {
493
603
  'content-type': 'application/json',
494
604
  }, payload);
495
605
  }
@@ -505,7 +615,7 @@ class Functions extends Service {
505
615
  * @returns {Promise}
506
616
  */
507
617
  async deleteDeployment(functionId, deploymentId) {
508
- let path = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
618
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
509
619
  let payload = {};
510
620
  if (typeof functionId === 'undefined') {
511
621
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -516,7 +626,7 @@ class Functions extends Service {
516
626
  }
517
627
 
518
628
 
519
- return await this.client.call('delete', path, {
629
+ return await this.client.call('delete', apiPath, {
520
630
  'content-type': 'application/json',
521
631
  }, payload);
522
632
  }
@@ -524,6 +634,9 @@ class Functions extends Service {
524
634
  /**
525
635
  * Create Build
526
636
  *
637
+ * Create a new build for an Appwrite Function deployment. This endpoint can
638
+ * be used to retry a failed build.
639
+ *
527
640
  * @param {string} functionId
528
641
  * @param {string} deploymentId
529
642
  * @param {string} buildId
@@ -531,7 +644,7 @@ class Functions extends Service {
531
644
  * @returns {Promise}
532
645
  */
533
646
  async createBuild(functionId, deploymentId, buildId) {
534
- let path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
647
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId);
535
648
  let payload = {};
536
649
  if (typeof functionId === 'undefined') {
537
650
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -546,11 +659,36 @@ class Functions extends Service {
546
659
  }
547
660
 
548
661
 
549
- return await this.client.call('post', path, {
662
+ return await this.client.call('post', apiPath, {
550
663
  'content-type': 'application/json',
551
664
  }, payload);
552
665
  }
553
666
 
667
+ /**
668
+ * Download Deployment
669
+ *
670
+ * @param {string} functionId
671
+ * @param {string} deploymentId
672
+ * @throws {AppwriteException}
673
+ * @returns {Promise}
674
+ */
675
+ async downloadDeployment(functionId, deploymentId) {
676
+ const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
677
+ let payload = {};
678
+ if (typeof functionId === 'undefined') {
679
+ throw new AppwriteException('Missing required parameter: "functionId"');
680
+ }
681
+
682
+ if (typeof deploymentId === 'undefined') {
683
+ throw new AppwriteException('Missing required parameter: "deploymentId"');
684
+ }
685
+
686
+
687
+ return await this.client.call('get', apiPath, {
688
+ 'content-type': 'application/json',
689
+ }, payload, 'arraybuffer');
690
+ }
691
+
554
692
  /**
555
693
  * List Executions
556
694
  *
@@ -564,7 +702,7 @@ class Functions extends Service {
564
702
  * @returns {Promise}
565
703
  */
566
704
  async listExecutions(functionId, queries, search) {
567
- let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
705
+ const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
568
706
  let payload = {};
569
707
  if (typeof functionId === 'undefined') {
570
708
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -579,7 +717,7 @@ class Functions extends Service {
579
717
  payload['search'] = search;
580
718
  }
581
719
 
582
- return await this.client.call('get', path, {
720
+ return await this.client.call('get', apiPath, {
583
721
  'content-type': 'application/json',
584
722
  }, payload);
585
723
  }
@@ -593,28 +731,43 @@ class Functions extends Service {
593
731
  * function execution process will start asynchronously.
594
732
  *
595
733
  * @param {string} functionId
596
- * @param {string} data
734
+ * @param {string} body
597
735
  * @param {boolean} async
736
+ * @param {string} xpath
737
+ * @param {string} method
738
+ * @param {object} headers
598
739
  * @throws {AppwriteException}
599
740
  * @returns {Promise}
600
741
  */
601
- async createExecution(functionId, data, async) {
602
- let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
742
+ async createExecution(functionId, body, async, xpath, method, headers) {
743
+ const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
603
744
  let payload = {};
604
745
  if (typeof functionId === 'undefined') {
605
746
  throw new AppwriteException('Missing required parameter: "functionId"');
606
747
  }
607
748
 
608
749
 
609
- if (typeof data !== 'undefined') {
610
- payload['data'] = data;
750
+ if (typeof body !== 'undefined') {
751
+ payload['body'] = body;
611
752
  }
612
753
 
613
754
  if (typeof async !== 'undefined') {
614
755
  payload['async'] = async;
615
756
  }
616
757
 
617
- return await this.client.call('post', path, {
758
+ if (typeof xpath !== 'undefined') {
759
+ payload['path'] = xpath;
760
+ }
761
+
762
+ if (typeof method !== 'undefined') {
763
+ payload['method'] = method;
764
+ }
765
+
766
+ if (typeof headers !== 'undefined') {
767
+ payload['headers'] = headers;
768
+ }
769
+
770
+ return await this.client.call('post', apiPath, {
618
771
  'content-type': 'application/json',
619
772
  }, payload);
620
773
  }
@@ -630,7 +783,7 @@ class Functions extends Service {
630
783
  * @returns {Promise}
631
784
  */
632
785
  async getExecution(functionId, executionId) {
633
- let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
786
+ const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
634
787
  let payload = {};
635
788
  if (typeof functionId === 'undefined') {
636
789
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -641,7 +794,7 @@ class Functions extends Service {
641
794
  }
642
795
 
643
796
 
644
- return await this.client.call('get', path, {
797
+ return await this.client.call('get', apiPath, {
645
798
  'content-type': 'application/json',
646
799
  }, payload);
647
800
  }
@@ -656,14 +809,14 @@ class Functions extends Service {
656
809
  * @returns {Promise}
657
810
  */
658
811
  async listVariables(functionId) {
659
- let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
812
+ const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
660
813
  let payload = {};
661
814
  if (typeof functionId === 'undefined') {
662
815
  throw new AppwriteException('Missing required parameter: "functionId"');
663
816
  }
664
817
 
665
818
 
666
- return await this.client.call('get', path, {
819
+ return await this.client.call('get', apiPath, {
667
820
  'content-type': 'application/json',
668
821
  }, payload);
669
822
  }
@@ -671,8 +824,8 @@ class Functions extends Service {
671
824
  /**
672
825
  * Create Variable
673
826
  *
674
- * Create a new function variable. These variables can be accessed within
675
- * function in the `env` object under the request variable.
827
+ * Create a new function environment variable. These variables can be accessed
828
+ * in the function at runtime as environment variables.
676
829
  *
677
830
  * @param {string} functionId
678
831
  * @param {string} key
@@ -681,7 +834,7 @@ class Functions extends Service {
681
834
  * @returns {Promise}
682
835
  */
683
836
  async createVariable(functionId, key, value) {
684
- let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
837
+ const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
685
838
  let payload = {};
686
839
  if (typeof functionId === 'undefined') {
687
840
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -704,7 +857,7 @@ class Functions extends Service {
704
857
  payload['value'] = value;
705
858
  }
706
859
 
707
- return await this.client.call('post', path, {
860
+ return await this.client.call('post', apiPath, {
708
861
  'content-type': 'application/json',
709
862
  }, payload);
710
863
  }
@@ -720,7 +873,7 @@ class Functions extends Service {
720
873
  * @returns {Promise}
721
874
  */
722
875
  async getVariable(functionId, variableId) {
723
- let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
876
+ const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
724
877
  let payload = {};
725
878
  if (typeof functionId === 'undefined') {
726
879
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -731,7 +884,7 @@ class Functions extends Service {
731
884
  }
732
885
 
733
886
 
734
- return await this.client.call('get', path, {
887
+ return await this.client.call('get', apiPath, {
735
888
  'content-type': 'application/json',
736
889
  }, payload);
737
890
  }
@@ -749,7 +902,7 @@ class Functions extends Service {
749
902
  * @returns {Promise}
750
903
  */
751
904
  async updateVariable(functionId, variableId, key, value) {
752
- let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
905
+ const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
753
906
  let payload = {};
754
907
  if (typeof functionId === 'undefined') {
755
908
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -772,7 +925,7 @@ class Functions extends Service {
772
925
  payload['value'] = value;
773
926
  }
774
927
 
775
- return await this.client.call('put', path, {
928
+ return await this.client.call('put', apiPath, {
776
929
  'content-type': 'application/json',
777
930
  }, payload);
778
931
  }
@@ -788,7 +941,7 @@ class Functions extends Service {
788
941
  * @returns {Promise}
789
942
  */
790
943
  async deleteVariable(functionId, variableId) {
791
- let path = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
944
+ const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
792
945
  let payload = {};
793
946
  if (typeof functionId === 'undefined') {
794
947
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -799,7 +952,7 @@ class Functions extends Service {
799
952
  }
800
953
 
801
954
 
802
- return await this.client.call('delete', path, {
955
+ return await this.client.call('delete', apiPath, {
803
956
  'content-type': 'application/json',
804
957
  }, payload);
805
958
  }
@@ -24,7 +24,7 @@ class Graphql extends Service {
24
24
  * @returns {Promise}
25
25
  */
26
26
  async query(query) {
27
- let path = '/graphql';
27
+ const apiPath = '/graphql';
28
28
  let payload = {};
29
29
  if (typeof query === 'undefined') {
30
30
  throw new AppwriteException('Missing required parameter: "query"');
@@ -35,7 +35,7 @@ class Graphql extends Service {
35
35
  payload['query'] = query;
36
36
  }
37
37
 
38
- return await this.client.call('post', path, {
38
+ return await this.client.call('post', apiPath, {
39
39
  'x-sdk-graphql': 'true',
40
40
  'content-type': 'application/json',
41
41
  }, payload);
@@ -51,7 +51,7 @@ class Graphql extends Service {
51
51
  * @returns {Promise}
52
52
  */
53
53
  async mutation(query) {
54
- let path = '/graphql/mutation';
54
+ const apiPath = '/graphql/mutation';
55
55
  let payload = {};
56
56
  if (typeof query === 'undefined') {
57
57
  throw new AppwriteException('Missing required parameter: "query"');
@@ -62,7 +62,7 @@ class Graphql extends Service {
62
62
  payload['query'] = query;
63
63
  }
64
64
 
65
- return await this.client.call('post', path, {
65
+ return await this.client.call('post', apiPath, {
66
66
  'x-sdk-graphql': 'true',
67
67
  'content-type': 'application/json',
68
68
  }, payload);