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
package/lib/client.js CHANGED
@@ -1,3 +1,4 @@
1
+ const os = require('os');
1
2
  const URL = require('url').URL;
2
3
  const axios = require('axios');
3
4
  const FormData = require('form-data');
@@ -11,11 +12,12 @@ class Client {
11
12
  this.headers = {
12
13
  'accept-encoding': '*',
13
14
  'content-type': '',
15
+ 'user-agent' : `AppwriteNodeJSSDK/10.0.0 (${os.type()}; ${os.version()}; ${os.arch()})`,
14
16
  'x-sdk-name': 'Node.js',
15
17
  'x-sdk-platform': 'server',
16
18
  'x-sdk-language': 'nodejs',
17
- 'x-sdk-version': '9.0.0',
18
- 'X-Appwrite-Response-Format' : '1.0.0',
19
+ 'x-sdk-version': '10.0.0',
20
+ 'X-Appwrite-Response-Format' : '1.4.0',
19
21
  };
20
22
  this.selfSigned = false;
21
23
  }
@@ -17,16 +17,16 @@ class Account extends Service {
17
17
  /**
18
18
  * Get Account
19
19
  *
20
- * Get currently logged in user data as JSON object.
20
+ * Get the currently logged in user.
21
21
  *
22
22
  * @throws {AppwriteException}
23
23
  * @returns {Promise}
24
24
  */
25
25
  async get() {
26
- let path = '/account';
26
+ const apiPath = '/account';
27
27
  let payload = {};
28
28
 
29
- return await this.client.call('get', path, {
29
+ return await this.client.call('get', apiPath, {
30
30
  'content-type': 'application/json',
31
31
  }, payload);
32
32
  }
@@ -49,7 +49,7 @@ class Account extends Service {
49
49
  * @returns {Promise}
50
50
  */
51
51
  async updateEmail(email, password) {
52
- let path = '/account/email';
52
+ const apiPath = '/account/email';
53
53
  let payload = {};
54
54
  if (typeof email === 'undefined') {
55
55
  throw new AppwriteException('Missing required parameter: "email"');
@@ -68,7 +68,51 @@ class Account extends Service {
68
68
  payload['password'] = password;
69
69
  }
70
70
 
71
- return await this.client.call('patch', path, {
71
+ return await this.client.call('patch', apiPath, {
72
+ 'content-type': 'application/json',
73
+ }, payload);
74
+ }
75
+
76
+ /**
77
+ * List Identities
78
+ *
79
+ * Get the list of identities for the currently logged in user.
80
+ *
81
+ * @param {string} queries
82
+ * @throws {AppwriteException}
83
+ * @returns {Promise}
84
+ */
85
+ async listIdentities(queries) {
86
+ const apiPath = '/account/identities';
87
+ let payload = {};
88
+
89
+ if (typeof queries !== 'undefined') {
90
+ payload['queries'] = queries;
91
+ }
92
+
93
+ return await this.client.call('get', apiPath, {
94
+ 'content-type': 'application/json',
95
+ }, payload);
96
+ }
97
+
98
+ /**
99
+ * Delete Identity
100
+ *
101
+ * Delete an identity by its unique ID.
102
+ *
103
+ * @param {string} identityId
104
+ * @throws {AppwriteException}
105
+ * @returns {Promise}
106
+ */
107
+ async deleteIdentity(identityId) {
108
+ const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
109
+ let payload = {};
110
+ if (typeof identityId === 'undefined') {
111
+ throw new AppwriteException('Missing required parameter: "identityId"');
112
+ }
113
+
114
+
115
+ return await this.client.call('delete', apiPath, {
72
116
  'content-type': 'application/json',
73
117
  }, payload);
74
118
  }
@@ -76,22 +120,22 @@ class Account extends Service {
76
120
  /**
77
121
  * List Logs
78
122
  *
79
- * Get currently logged in user list of latest security activity logs. Each
80
- * log returns user IP address, location and date and time of log.
123
+ * Get the list of latest security activity logs for the currently logged in
124
+ * user. Each log returns user IP address, location and date and time of log.
81
125
  *
82
126
  * @param {string[]} queries
83
127
  * @throws {AppwriteException}
84
128
  * @returns {Promise}
85
129
  */
86
130
  async listLogs(queries) {
87
- let path = '/account/logs';
131
+ const apiPath = '/account/logs';
88
132
  let payload = {};
89
133
 
90
134
  if (typeof queries !== 'undefined') {
91
135
  payload['queries'] = queries;
92
136
  }
93
137
 
94
- return await this.client.call('get', path, {
138
+ return await this.client.call('get', apiPath, {
95
139
  'content-type': 'application/json',
96
140
  }, payload);
97
141
  }
@@ -106,7 +150,7 @@ class Account extends Service {
106
150
  * @returns {Promise}
107
151
  */
108
152
  async updateName(name) {
109
- let path = '/account/name';
153
+ const apiPath = '/account/name';
110
154
  let payload = {};
111
155
  if (typeof name === 'undefined') {
112
156
  throw new AppwriteException('Missing required parameter: "name"');
@@ -117,7 +161,7 @@ class Account extends Service {
117
161
  payload['name'] = name;
118
162
  }
119
163
 
120
- return await this.client.call('patch', path, {
164
+ return await this.client.call('patch', apiPath, {
121
165
  'content-type': 'application/json',
122
166
  }, payload);
123
167
  }
@@ -135,7 +179,7 @@ class Account extends Service {
135
179
  * @returns {Promise}
136
180
  */
137
181
  async updatePassword(password, oldPassword) {
138
- let path = '/account/password';
182
+ const apiPath = '/account/password';
139
183
  let payload = {};
140
184
  if (typeof password === 'undefined') {
141
185
  throw new AppwriteException('Missing required parameter: "password"');
@@ -150,7 +194,7 @@ class Account extends Service {
150
194
  payload['oldPassword'] = oldPassword;
151
195
  }
152
196
 
153
- return await this.client.call('patch', path, {
197
+ return await this.client.call('patch', apiPath, {
154
198
  'content-type': 'application/json',
155
199
  }, payload);
156
200
  }
@@ -170,7 +214,7 @@ class Account extends Service {
170
214
  * @returns {Promise}
171
215
  */
172
216
  async updatePhone(phone, password) {
173
- let path = '/account/phone';
217
+ const apiPath = '/account/phone';
174
218
  let payload = {};
175
219
  if (typeof phone === 'undefined') {
176
220
  throw new AppwriteException('Missing required parameter: "phone"');
@@ -189,7 +233,7 @@ class Account extends Service {
189
233
  payload['password'] = password;
190
234
  }
191
235
 
192
- return await this.client.call('patch', path, {
236
+ return await this.client.call('patch', apiPath, {
193
237
  'content-type': 'application/json',
194
238
  }, payload);
195
239
  }
@@ -197,16 +241,16 @@ class Account extends Service {
197
241
  /**
198
242
  * Get Account Preferences
199
243
  *
200
- * Get currently logged in user preferences as a key-value object.
244
+ * Get the preferences as a key-value object for the currently logged in user.
201
245
  *
202
246
  * @throws {AppwriteException}
203
247
  * @returns {Promise}
204
248
  */
205
249
  async getPrefs() {
206
- let path = '/account/prefs';
250
+ const apiPath = '/account/prefs';
207
251
  let payload = {};
208
252
 
209
- return await this.client.call('get', path, {
253
+ return await this.client.call('get', apiPath, {
210
254
  'content-type': 'application/json',
211
255
  }, payload);
212
256
  }
@@ -223,7 +267,7 @@ class Account extends Service {
223
267
  * @returns {Promise}
224
268
  */
225
269
  async updatePrefs(prefs) {
226
- let path = '/account/prefs';
270
+ const apiPath = '/account/prefs';
227
271
  let payload = {};
228
272
  if (typeof prefs === 'undefined') {
229
273
  throw new AppwriteException('Missing required parameter: "prefs"');
@@ -234,7 +278,7 @@ class Account extends Service {
234
278
  payload['prefs'] = prefs;
235
279
  }
236
280
 
237
- return await this.client.call('patch', path, {
281
+ return await this.client.call('patch', apiPath, {
238
282
  'content-type': 'application/json',
239
283
  }, payload);
240
284
  }
@@ -257,7 +301,7 @@ class Account extends Service {
257
301
  * @returns {Promise}
258
302
  */
259
303
  async createRecovery(email, url) {
260
- let path = '/account/recovery';
304
+ const apiPath = '/account/recovery';
261
305
  let payload = {};
262
306
  if (typeof email === 'undefined') {
263
307
  throw new AppwriteException('Missing required parameter: "email"');
@@ -276,7 +320,7 @@ class Account extends Service {
276
320
  payload['url'] = url;
277
321
  }
278
322
 
279
- return await this.client.call('post', path, {
323
+ return await this.client.call('post', apiPath, {
280
324
  'content-type': 'application/json',
281
325
  }, payload);
282
326
  }
@@ -302,7 +346,7 @@ class Account extends Service {
302
346
  * @returns {Promise}
303
347
  */
304
348
  async updateRecovery(userId, secret, password, passwordAgain) {
305
- let path = '/account/recovery';
349
+ const apiPath = '/account/recovery';
306
350
  let payload = {};
307
351
  if (typeof userId === 'undefined') {
308
352
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -337,7 +381,7 @@ class Account extends Service {
337
381
  payload['passwordAgain'] = passwordAgain;
338
382
  }
339
383
 
340
- return await this.client.call('put', path, {
384
+ return await this.client.call('put', apiPath, {
341
385
  'content-type': 'application/json',
342
386
  }, payload);
343
387
  }
@@ -345,17 +389,17 @@ class Account extends Service {
345
389
  /**
346
390
  * List Sessions
347
391
  *
348
- * Get currently logged in user list of active sessions across different
349
- * devices.
392
+ * Get the list of active sessions across different devices for the currently
393
+ * logged in user.
350
394
  *
351
395
  * @throws {AppwriteException}
352
396
  * @returns {Promise}
353
397
  */
354
398
  async listSessions() {
355
- let path = '/account/sessions';
399
+ const apiPath = '/account/sessions';
356
400
  let payload = {};
357
401
 
358
- return await this.client.call('get', path, {
402
+ return await this.client.call('get', apiPath, {
359
403
  'content-type': 'application/json',
360
404
  }, payload);
361
405
  }
@@ -370,10 +414,10 @@ class Account extends Service {
370
414
  * @returns {Promise}
371
415
  */
372
416
  async deleteSessions() {
373
- let path = '/account/sessions';
417
+ const apiPath = '/account/sessions';
374
418
  let payload = {};
375
419
 
376
- return await this.client.call('delete', path, {
420
+ return await this.client.call('delete', apiPath, {
377
421
  'content-type': 'application/json',
378
422
  }, payload);
379
423
  }
@@ -389,14 +433,14 @@ class Account extends Service {
389
433
  * @returns {Promise}
390
434
  */
391
435
  async getSession(sessionId) {
392
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
436
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
393
437
  let payload = {};
394
438
  if (typeof sessionId === 'undefined') {
395
439
  throw new AppwriteException('Missing required parameter: "sessionId"');
396
440
  }
397
441
 
398
442
 
399
- return await this.client.call('get', path, {
443
+ return await this.client.call('get', apiPath, {
400
444
  'content-type': 'application/json',
401
445
  }, payload);
402
446
  }
@@ -413,14 +457,14 @@ class Account extends Service {
413
457
  * @returns {Promise}
414
458
  */
415
459
  async updateSession(sessionId) {
416
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
460
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
417
461
  let payload = {};
418
462
  if (typeof sessionId === 'undefined') {
419
463
  throw new AppwriteException('Missing required parameter: "sessionId"');
420
464
  }
421
465
 
422
466
 
423
- return await this.client.call('patch', path, {
467
+ return await this.client.call('patch', apiPath, {
424
468
  'content-type': 'application/json',
425
469
  }, payload);
426
470
  }
@@ -428,24 +472,24 @@ class Account extends Service {
428
472
  /**
429
473
  * Delete Session
430
474
  *
431
- * Use this endpoint to log out the currently logged in user from all their
432
- * account sessions across all of their different devices. When using the
433
- * Session ID argument, only the unique session ID provided is deleted.
434
- *
475
+ * Logout the user. Use 'current' as the session ID to logout on this device,
476
+ * use a session ID to logout on another device. If you're looking to logout
477
+ * the user on all devices, use [Delete
478
+ * Sessions](/docs/client/account#accountDeleteSessions) instead.
435
479
  *
436
480
  * @param {string} sessionId
437
481
  * @throws {AppwriteException}
438
482
  * @returns {Promise}
439
483
  */
440
484
  async deleteSession(sessionId) {
441
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
485
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
442
486
  let payload = {};
443
487
  if (typeof sessionId === 'undefined') {
444
488
  throw new AppwriteException('Missing required parameter: "sessionId"');
445
489
  }
446
490
 
447
491
 
448
- return await this.client.call('delete', path, {
492
+ return await this.client.call('delete', apiPath, {
449
493
  'content-type': 'application/json',
450
494
  }, payload);
451
495
  }
@@ -461,10 +505,10 @@ class Account extends Service {
461
505
  * @returns {Promise}
462
506
  */
463
507
  async updateStatus() {
464
- let path = '/account/status';
508
+ const apiPath = '/account/status';
465
509
  let payload = {};
466
510
 
467
- return await this.client.call('patch', path, {
511
+ return await this.client.call('patch', apiPath, {
468
512
  'content-type': 'application/json',
469
513
  }, payload);
470
514
  }
@@ -493,7 +537,7 @@ class Account extends Service {
493
537
  * @returns {Promise}
494
538
  */
495
539
  async createVerification(url) {
496
- let path = '/account/verification';
540
+ const apiPath = '/account/verification';
497
541
  let payload = {};
498
542
  if (typeof url === 'undefined') {
499
543
  throw new AppwriteException('Missing required parameter: "url"');
@@ -504,7 +548,7 @@ class Account extends Service {
504
548
  payload['url'] = url;
505
549
  }
506
550
 
507
- return await this.client.call('post', path, {
551
+ return await this.client.call('post', apiPath, {
508
552
  'content-type': 'application/json',
509
553
  }, payload);
510
554
  }
@@ -523,7 +567,7 @@ class Account extends Service {
523
567
  * @returns {Promise}
524
568
  */
525
569
  async updateVerification(userId, secret) {
526
- let path = '/account/verification';
570
+ const apiPath = '/account/verification';
527
571
  let payload = {};
528
572
  if (typeof userId === 'undefined') {
529
573
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -542,7 +586,7 @@ class Account extends Service {
542
586
  payload['secret'] = secret;
543
587
  }
544
588
 
545
- return await this.client.call('put', path, {
589
+ return await this.client.call('put', apiPath, {
546
590
  'content-type': 'application/json',
547
591
  }, payload);
548
592
  }
@@ -561,10 +605,10 @@ class Account extends Service {
561
605
  * @returns {Promise}
562
606
  */
563
607
  async createPhoneVerification() {
564
- let path = '/account/verification/phone';
608
+ const apiPath = '/account/verification/phone';
565
609
  let payload = {};
566
610
 
567
- return await this.client.call('post', path, {
611
+ return await this.client.call('post', apiPath, {
568
612
  'content-type': 'application/json',
569
613
  }, payload);
570
614
  }
@@ -583,7 +627,7 @@ class Account extends Service {
583
627
  * @returns {Promise}
584
628
  */
585
629
  async updatePhoneVerification(userId, secret) {
586
- let path = '/account/verification/phone';
630
+ const apiPath = '/account/verification/phone';
587
631
  let payload = {};
588
632
  if (typeof userId === 'undefined') {
589
633
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -602,7 +646,7 @@ class Account extends Service {
602
646
  payload['secret'] = secret;
603
647
  }
604
648
 
605
- return await this.client.call('put', path, {
649
+ return await this.client.call('put', apiPath, {
606
650
  'content-type': 'application/json',
607
651
  }, payload);
608
652
  }
@@ -35,7 +35,7 @@ class Avatars extends Service {
35
35
  * @returns {Promise}
36
36
  */
37
37
  async getBrowser(code, width, height, quality) {
38
- let path = '/avatars/browsers/{code}'.replace('{code}', code);
38
+ const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
39
39
  let payload = {};
40
40
  if (typeof code === 'undefined') {
41
41
  throw new AppwriteException('Missing required parameter: "code"');
@@ -54,7 +54,7 @@ class Avatars extends Service {
54
54
  payload['quality'] = quality;
55
55
  }
56
56
 
57
- return await this.client.call('get', path, {
57
+ return await this.client.call('get', apiPath, {
58
58
  'content-type': 'application/json',
59
59
  }, payload, 'arraybuffer');
60
60
  }
@@ -80,7 +80,7 @@ class Avatars extends Service {
80
80
  * @returns {Promise}
81
81
  */
82
82
  async getCreditCard(code, width, height, quality) {
83
- let path = '/avatars/credit-cards/{code}'.replace('{code}', code);
83
+ const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
84
84
  let payload = {};
85
85
  if (typeof code === 'undefined') {
86
86
  throw new AppwriteException('Missing required parameter: "code"');
@@ -99,7 +99,7 @@ class Avatars extends Service {
99
99
  payload['quality'] = quality;
100
100
  }
101
101
 
102
- return await this.client.call('get', path, {
102
+ return await this.client.call('get', apiPath, {
103
103
  'content-type': 'application/json',
104
104
  }, payload, 'arraybuffer');
105
105
  }
@@ -116,7 +116,7 @@ class Avatars extends Service {
116
116
  * @returns {Promise}
117
117
  */
118
118
  async getFavicon(url) {
119
- let path = '/avatars/favicon';
119
+ const apiPath = '/avatars/favicon';
120
120
  let payload = {};
121
121
  if (typeof url === 'undefined') {
122
122
  throw new AppwriteException('Missing required parameter: "url"');
@@ -127,7 +127,7 @@ class Avatars extends Service {
127
127
  payload['url'] = url;
128
128
  }
129
129
 
130
- return await this.client.call('get', path, {
130
+ return await this.client.call('get', apiPath, {
131
131
  'content-type': 'application/json',
132
132
  }, payload, 'arraybuffer');
133
133
  }
@@ -154,7 +154,7 @@ class Avatars extends Service {
154
154
  * @returns {Promise}
155
155
  */
156
156
  async getFlag(code, width, height, quality) {
157
- let path = '/avatars/flags/{code}'.replace('{code}', code);
157
+ const apiPath = '/avatars/flags/{code}'.replace('{code}', code);
158
158
  let payload = {};
159
159
  if (typeof code === 'undefined') {
160
160
  throw new AppwriteException('Missing required parameter: "code"');
@@ -173,7 +173,7 @@ class Avatars extends Service {
173
173
  payload['quality'] = quality;
174
174
  }
175
175
 
176
- return await this.client.call('get', path, {
176
+ return await this.client.call('get', apiPath, {
177
177
  'content-type': 'application/json',
178
178
  }, payload, 'arraybuffer');
179
179
  }
@@ -199,7 +199,7 @@ class Avatars extends Service {
199
199
  * @returns {Promise}
200
200
  */
201
201
  async getImage(url, width, height) {
202
- let path = '/avatars/image';
202
+ const apiPath = '/avatars/image';
203
203
  let payload = {};
204
204
  if (typeof url === 'undefined') {
205
205
  throw new AppwriteException('Missing required parameter: "url"');
@@ -218,7 +218,7 @@ class Avatars extends Service {
218
218
  payload['height'] = height;
219
219
  }
220
220
 
221
- return await this.client.call('get', path, {
221
+ return await this.client.call('get', apiPath, {
222
222
  'content-type': 'application/json',
223
223
  }, payload, 'arraybuffer');
224
224
  }
@@ -251,7 +251,7 @@ class Avatars extends Service {
251
251
  * @returns {Promise}
252
252
  */
253
253
  async getInitials(name, width, height, background) {
254
- let path = '/avatars/initials';
254
+ const apiPath = '/avatars/initials';
255
255
  let payload = {};
256
256
 
257
257
  if (typeof name !== 'undefined') {
@@ -270,7 +270,7 @@ class Avatars extends Service {
270
270
  payload['background'] = background;
271
271
  }
272
272
 
273
- return await this.client.call('get', path, {
273
+ return await this.client.call('get', apiPath, {
274
274
  'content-type': 'application/json',
275
275
  }, payload, 'arraybuffer');
276
276
  }
@@ -290,7 +290,7 @@ class Avatars extends Service {
290
290
  * @returns {Promise}
291
291
  */
292
292
  async getQR(text, size, margin, download) {
293
- let path = '/avatars/qr';
293
+ const apiPath = '/avatars/qr';
294
294
  let payload = {};
295
295
  if (typeof text === 'undefined') {
296
296
  throw new AppwriteException('Missing required parameter: "text"');
@@ -313,7 +313,7 @@ class Avatars extends Service {
313
313
  payload['download'] = download;
314
314
  }
315
315
 
316
- return await this.client.call('get', path, {
316
+ return await this.client.call('get', apiPath, {
317
317
  'content-type': 'application/json',
318
318
  }, payload, 'arraybuffer');
319
319
  }