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 Teams extends Service {
26
26
  * @returns {Promise}
27
27
  */
28
28
  async list(queries, search) {
29
- let path = '/teams';
29
+ const apiPath = '/teams';
30
30
  let payload = {};
31
31
 
32
32
  if (typeof queries !== 'undefined') {
@@ -37,7 +37,7 @@ class Teams 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
  }
@@ -56,7 +56,7 @@ class Teams extends Service {
56
56
  * @returns {Promise}
57
57
  */
58
58
  async create(teamId, name, roles) {
59
- let path = '/teams';
59
+ const apiPath = '/teams';
60
60
  let payload = {};
61
61
  if (typeof teamId === 'undefined') {
62
62
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -79,7 +79,7 @@ class Teams extends Service {
79
79
  payload['roles'] = roles;
80
80
  }
81
81
 
82
- return await this.client.call('post', path, {
82
+ return await this.client.call('post', apiPath, {
83
83
  'content-type': 'application/json',
84
84
  }, payload);
85
85
  }
@@ -94,14 +94,14 @@ class Teams extends Service {
94
94
  * @returns {Promise}
95
95
  */
96
96
  async get(teamId) {
97
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
97
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
98
98
  let payload = {};
99
99
  if (typeof teamId === 'undefined') {
100
100
  throw new AppwriteException('Missing required parameter: "teamId"');
101
101
  }
102
102
 
103
103
 
104
- return await this.client.call('get', path, {
104
+ return await this.client.call('get', apiPath, {
105
105
  'content-type': 'application/json',
106
106
  }, payload);
107
107
  }
@@ -117,7 +117,7 @@ class Teams extends Service {
117
117
  * @returns {Promise}
118
118
  */
119
119
  async updateName(teamId, name) {
120
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
120
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
121
121
  let payload = {};
122
122
  if (typeof teamId === 'undefined') {
123
123
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -132,7 +132,7 @@ class Teams extends Service {
132
132
  payload['name'] = name;
133
133
  }
134
134
 
135
- return await this.client.call('put', path, {
135
+ return await this.client.call('put', apiPath, {
136
136
  'content-type': 'application/json',
137
137
  }, payload);
138
138
  }
@@ -148,14 +148,14 @@ class Teams extends Service {
148
148
  * @returns {Promise}
149
149
  */
150
150
  async delete(teamId) {
151
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
151
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
152
152
  let payload = {};
153
153
  if (typeof teamId === 'undefined') {
154
154
  throw new AppwriteException('Missing required parameter: "teamId"');
155
155
  }
156
156
 
157
157
 
158
- return await this.client.call('delete', path, {
158
+ return await this.client.call('delete', apiPath, {
159
159
  'content-type': 'application/json',
160
160
  }, payload);
161
161
  }
@@ -173,7 +173,7 @@ class Teams extends Service {
173
173
  * @returns {Promise}
174
174
  */
175
175
  async listMemberships(teamId, queries, search) {
176
- let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
176
+ const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
177
177
  let payload = {};
178
178
  if (typeof teamId === 'undefined') {
179
179
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -188,7 +188,7 @@ class Teams extends Service {
188
188
  payload['search'] = search;
189
189
  }
190
190
 
191
- return await this.client.call('get', path, {
191
+ return await this.client.call('get', apiPath, {
192
192
  'content-type': 'application/json',
193
193
  }, payload);
194
194
  }
@@ -229,7 +229,7 @@ class Teams extends Service {
229
229
  * @returns {Promise}
230
230
  */
231
231
  async createMembership(teamId, roles, url, email, userId, phone, name) {
232
- let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
232
+ const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
233
233
  let payload = {};
234
234
  if (typeof teamId === 'undefined') {
235
235
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -268,7 +268,7 @@ class Teams extends Service {
268
268
  payload['name'] = name;
269
269
  }
270
270
 
271
- return await this.client.call('post', path, {
271
+ return await this.client.call('post', apiPath, {
272
272
  'content-type': 'application/json',
273
273
  }, payload);
274
274
  }
@@ -285,7 +285,7 @@ class Teams extends Service {
285
285
  * @returns {Promise}
286
286
  */
287
287
  async getMembership(teamId, membershipId) {
288
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
288
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
289
289
  let payload = {};
290
290
  if (typeof teamId === 'undefined') {
291
291
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -296,17 +296,18 @@ class Teams extends Service {
296
296
  }
297
297
 
298
298
 
299
- return await this.client.call('get', path, {
299
+ return await this.client.call('get', apiPath, {
300
300
  'content-type': 'application/json',
301
301
  }, payload);
302
302
  }
303
303
 
304
304
  /**
305
- * Update Membership Roles
305
+ * Update Membership
306
306
  *
307
307
  * Modify the roles of a team member. Only team members with the owner role
308
308
  * have access to this endpoint. Learn more about [roles and
309
309
  * permissions](/docs/permissions).
310
+ *
310
311
  *
311
312
  * @param {string} teamId
312
313
  * @param {string} membershipId
@@ -314,8 +315,8 @@ class Teams extends Service {
314
315
  * @throws {AppwriteException}
315
316
  * @returns {Promise}
316
317
  */
317
- async updateMembershipRoles(teamId, membershipId, roles) {
318
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
318
+ async updateMembership(teamId, membershipId, roles) {
319
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
319
320
  let payload = {};
320
321
  if (typeof teamId === 'undefined') {
321
322
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -334,7 +335,7 @@ class Teams extends Service {
334
335
  payload['roles'] = roles;
335
336
  }
336
337
 
337
- return await this.client.call('patch', path, {
338
+ return await this.client.call('patch', apiPath, {
338
339
  'content-type': 'application/json',
339
340
  }, payload);
340
341
  }
@@ -352,7 +353,7 @@ class Teams extends Service {
352
353
  * @returns {Promise}
353
354
  */
354
355
  async deleteMembership(teamId, membershipId) {
355
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
356
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
356
357
  let payload = {};
357
358
  if (typeof teamId === 'undefined') {
358
359
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -363,7 +364,7 @@ class Teams extends Service {
363
364
  }
364
365
 
365
366
 
366
- return await this.client.call('delete', path, {
367
+ return await this.client.call('delete', apiPath, {
367
368
  'content-type': 'application/json',
368
369
  }, payload);
369
370
  }
@@ -387,7 +388,7 @@ class Teams extends Service {
387
388
  * @returns {Promise}
388
389
  */
389
390
  async updateMembershipStatus(teamId, membershipId, userId, secret) {
390
- let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
391
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
391
392
  let payload = {};
392
393
  if (typeof teamId === 'undefined') {
393
394
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -414,7 +415,7 @@ class Teams extends Service {
414
415
  payload['secret'] = secret;
415
416
  }
416
417
 
417
- return await this.client.call('patch', path, {
418
+ return await this.client.call('patch', apiPath, {
418
419
  'content-type': 'application/json',
419
420
  }, payload);
420
421
  }
@@ -431,14 +432,14 @@ class Teams extends Service {
431
432
  * @returns {Promise}
432
433
  */
433
434
  async getPrefs(teamId) {
434
- let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
435
+ const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
435
436
  let payload = {};
436
437
  if (typeof teamId === 'undefined') {
437
438
  throw new AppwriteException('Missing required parameter: "teamId"');
438
439
  }
439
440
 
440
441
 
441
- return await this.client.call('get', path, {
442
+ return await this.client.call('get', apiPath, {
442
443
  'content-type': 'application/json',
443
444
  }, payload);
444
445
  }
@@ -456,7 +457,7 @@ class Teams extends Service {
456
457
  * @returns {Promise}
457
458
  */
458
459
  async updatePrefs(teamId, prefs) {
459
- let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
460
+ const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
460
461
  let payload = {};
461
462
  if (typeof teamId === 'undefined') {
462
463
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -471,7 +472,7 @@ class Teams extends Service {
471
472
  payload['prefs'] = prefs;
472
473
  }
473
474
 
474
- return await this.client.call('put', path, {
475
+ return await this.client.call('put', apiPath, {
475
476
  'content-type': 'application/json',
476
477
  }, payload);
477
478
  }