node-appwrite 12.0.0-rc.4 → 12.0.1

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 (279) hide show
  1. package/.travis.yml +2 -2
  2. package/README.md +5 -5
  3. package/docs/examples/account/create-anonymous-session.md +1 -1
  4. package/docs/examples/account/create-email-password-session.md +1 -1
  5. package/docs/examples/account/create-email-token.md +2 -2
  6. package/docs/examples/account/create-j-w-t.md +1 -1
  7. package/docs/examples/account/create-magic-u-r-l-token.md +2 -2
  8. package/docs/examples/account/{add-authenticator.md → create-mfa-authenticator.md} +1 -1
  9. package/docs/examples/account/{create2f-a-challenge.md → create-mfa-challenge.md} +2 -2
  10. package/docs/examples/account/create-mfa-recovery-codes.md +10 -0
  11. package/docs/examples/account/{create-o-auth2session.md → create-o-auth2token.md} +1 -2
  12. package/docs/examples/account/create-phone-token.md +2 -2
  13. package/docs/examples/account/create-phone-verification.md +1 -1
  14. package/docs/examples/account/create-recovery.md +1 -1
  15. package/docs/examples/account/create-session.md +3 -3
  16. package/docs/examples/account/create-verification.md +1 -1
  17. package/docs/examples/account/create.md +3 -3
  18. package/docs/examples/account/delete-identity.md +2 -2
  19. package/docs/examples/account/{verify-authenticator.md → delete-mfa-authenticator.md} +2 -2
  20. package/docs/examples/account/delete-session.md +2 -2
  21. package/docs/examples/account/delete-sessions.md +1 -1
  22. package/docs/examples/account/get-mfa-recovery-codes.md +10 -0
  23. package/docs/examples/account/get-prefs.md +1 -1
  24. package/docs/examples/account/get-session.md +2 -2
  25. package/docs/examples/account/get.md +1 -1
  26. package/docs/examples/account/list-identities.md +1 -1
  27. package/docs/examples/account/list-logs.md +1 -1
  28. package/docs/examples/account/{list-factors.md → list-mfa-factors.md} +1 -1
  29. package/docs/examples/account/list-sessions.md +1 -1
  30. package/docs/examples/account/update-email.md +1 -1
  31. package/docs/examples/account/update-m-f-a.md +1 -1
  32. package/docs/examples/account/update-magic-u-r-l-session.md +3 -3
  33. package/docs/examples/account/{delete-authenticator.md → update-mfa-authenticator.md} +2 -2
  34. package/docs/examples/account/{update-challenge.md → update-mfa-challenge.md} +3 -3
  35. package/docs/examples/account/update-mfa-recovery-codes.md +10 -0
  36. package/docs/examples/account/update-name.md +2 -2
  37. package/docs/examples/account/update-password.md +1 -1
  38. package/docs/examples/account/update-phone-session.md +12 -0
  39. package/docs/examples/account/update-phone-verification.md +3 -3
  40. package/docs/examples/account/update-phone.md +1 -1
  41. package/docs/examples/account/update-prefs.md +1 -1
  42. package/docs/examples/account/update-recovery.md +3 -3
  43. package/docs/examples/account/update-session.md +2 -2
  44. package/docs/examples/account/update-status.md +1 -1
  45. package/docs/examples/account/update-verification.md +3 -3
  46. package/docs/examples/avatars/get-browser.md +1 -1
  47. package/docs/examples/avatars/get-credit-card.md +1 -1
  48. package/docs/examples/avatars/get-favicon.md +1 -1
  49. package/docs/examples/avatars/get-flag.md +1 -1
  50. package/docs/examples/avatars/get-image.md +1 -1
  51. package/docs/examples/avatars/get-initials.md +2 -2
  52. package/docs/examples/avatars/get-q-r.md +2 -2
  53. package/docs/examples/databases/create-boolean-attribute.md +3 -3
  54. package/docs/examples/databases/create-collection.md +4 -4
  55. package/docs/examples/databases/create-datetime-attribute.md +3 -3
  56. package/docs/examples/databases/create-document.md +4 -4
  57. package/docs/examples/databases/create-email-attribute.md +3 -3
  58. package/docs/examples/databases/create-enum-attribute.md +4 -4
  59. package/docs/examples/databases/create-float-attribute.md +3 -3
  60. package/docs/examples/databases/create-index.md +3 -3
  61. package/docs/examples/databases/create-integer-attribute.md +3 -3
  62. package/docs/examples/databases/create-ip-attribute.md +3 -3
  63. package/docs/examples/databases/create-relationship-attribute.md +4 -4
  64. package/docs/examples/databases/create-string-attribute.md +4 -4
  65. package/docs/examples/databases/create-url-attribute.md +3 -3
  66. package/docs/examples/databases/create.md +3 -3
  67. package/docs/examples/databases/delete-attribute.md +3 -3
  68. package/docs/examples/databases/delete-collection.md +3 -3
  69. package/docs/examples/databases/delete-document.md +4 -4
  70. package/docs/examples/databases/delete-index.md +3 -3
  71. package/docs/examples/databases/delete.md +2 -2
  72. package/docs/examples/databases/get-attribute.md +3 -3
  73. package/docs/examples/databases/get-collection.md +3 -3
  74. package/docs/examples/databases/get-document.md +4 -4
  75. package/docs/examples/databases/get-index.md +3 -3
  76. package/docs/examples/databases/get.md +2 -2
  77. package/docs/examples/databases/list-attributes.md +3 -3
  78. package/docs/examples/databases/list-collections.md +3 -3
  79. package/docs/examples/databases/list-documents.md +3 -3
  80. package/docs/examples/databases/list-indexes.md +3 -3
  81. package/docs/examples/databases/list.md +2 -2
  82. package/docs/examples/databases/update-boolean-attribute.md +3 -3
  83. package/docs/examples/databases/update-collection.md +4 -4
  84. package/docs/examples/databases/update-datetime-attribute.md +3 -3
  85. package/docs/examples/databases/update-document.md +4 -4
  86. package/docs/examples/databases/update-email-attribute.md +3 -3
  87. package/docs/examples/databases/update-enum-attribute.md +4 -4
  88. package/docs/examples/databases/update-float-attribute.md +3 -3
  89. package/docs/examples/databases/update-integer-attribute.md +3 -3
  90. package/docs/examples/databases/update-ip-attribute.md +3 -3
  91. package/docs/examples/databases/update-relationship-attribute.md +3 -3
  92. package/docs/examples/databases/update-string-attribute.md +4 -4
  93. package/docs/examples/databases/update-url-attribute.md +3 -3
  94. package/docs/examples/databases/update.md +3 -3
  95. package/docs/examples/functions/create-build.md +4 -4
  96. package/docs/examples/functions/create-deployment.md +4 -4
  97. package/docs/examples/functions/create-execution.md +4 -4
  98. package/docs/examples/functions/create-variable.md +4 -4
  99. package/docs/examples/functions/create.md +13 -13
  100. package/docs/examples/functions/delete-deployment.md +3 -3
  101. package/docs/examples/functions/delete-variable.md +3 -3
  102. package/docs/examples/functions/delete.md +2 -2
  103. package/docs/examples/functions/download-deployment.md +3 -3
  104. package/docs/examples/functions/get-deployment.md +3 -3
  105. package/docs/examples/functions/get-execution.md +3 -3
  106. package/docs/examples/functions/get-variable.md +3 -3
  107. package/docs/examples/functions/get.md +2 -2
  108. package/docs/examples/functions/list-deployments.md +3 -3
  109. package/docs/examples/functions/list-executions.md +3 -3
  110. package/docs/examples/functions/list-runtimes.md +1 -1
  111. package/docs/examples/functions/list-variables.md +2 -2
  112. package/docs/examples/functions/list.md +2 -2
  113. package/docs/examples/functions/update-deployment.md +3 -3
  114. package/docs/examples/functions/update-variable.md +5 -5
  115. package/docs/examples/functions/update.md +9 -9
  116. package/docs/examples/graphql/mutation.md +1 -1
  117. package/docs/examples/graphql/query.md +1 -1
  118. package/docs/examples/health/get-antivirus.md +1 -1
  119. package/docs/examples/health/get-cache.md +1 -1
  120. package/docs/examples/health/get-certificate.md +1 -1
  121. package/docs/examples/health/get-d-b.md +1 -1
  122. package/docs/examples/health/get-failed-jobs.md +1 -1
  123. package/docs/examples/health/get-pub-sub.md +1 -1
  124. package/docs/examples/health/get-queue-builds.md +1 -1
  125. package/docs/examples/health/get-queue-certificates.md +1 -1
  126. package/docs/examples/health/get-queue-databases.md +2 -2
  127. package/docs/examples/health/get-queue-deletes.md +1 -1
  128. package/docs/examples/health/get-queue-functions.md +1 -1
  129. package/docs/examples/health/get-queue-logs.md +1 -1
  130. package/docs/examples/health/get-queue-mails.md +1 -1
  131. package/docs/examples/health/get-queue-messaging.md +1 -1
  132. package/docs/examples/health/get-queue-migrations.md +1 -1
  133. package/docs/examples/health/get-queue-usage-dump.md +12 -0
  134. package/docs/examples/health/get-queue-usage.md +12 -0
  135. package/docs/examples/health/get-queue-webhooks.md +1 -1
  136. package/docs/examples/health/get-queue.md +1 -1
  137. package/docs/examples/health/get-storage-local.md +1 -1
  138. package/docs/examples/health/get-storage.md +10 -0
  139. package/docs/examples/health/get-time.md +1 -1
  140. package/docs/examples/health/get.md +1 -1
  141. package/docs/examples/locale/get.md +1 -1
  142. package/docs/examples/locale/list-codes.md +1 -1
  143. package/docs/examples/locale/list-continents.md +1 -1
  144. package/docs/examples/locale/list-countries-e-u.md +1 -1
  145. package/docs/examples/locale/list-countries-phones.md +1 -1
  146. package/docs/examples/locale/list-countries.md +1 -1
  147. package/docs/examples/locale/list-currencies.md +1 -1
  148. package/docs/examples/locale/list-languages.md +1 -1
  149. package/docs/examples/messaging/create-apns-provider.md +8 -7
  150. package/docs/examples/messaging/create-email.md +5 -5
  151. package/docs/examples/messaging/create-fcm-provider.md +3 -3
  152. package/docs/examples/messaging/create-mailgun-provider.md +7 -7
  153. package/docs/examples/messaging/create-msg91provider.md +6 -6
  154. package/docs/examples/messaging/create-push.md +11 -11
  155. package/docs/examples/messaging/create-sendgrid-provider.md +6 -6
  156. package/docs/examples/messaging/create-sms.md +4 -4
  157. package/docs/examples/messaging/create-smtp-provider.md +10 -10
  158. package/docs/examples/messaging/create-subscriber.md +4 -4
  159. package/docs/examples/messaging/create-telesign-provider.md +5 -5
  160. package/docs/examples/messaging/create-textmagic-provider.md +5 -5
  161. package/docs/examples/messaging/create-topic.md +3 -3
  162. package/docs/examples/messaging/create-twilio-provider.md +5 -5
  163. package/docs/examples/messaging/create-vonage-provider.md +5 -5
  164. package/docs/examples/messaging/delete-provider.md +2 -2
  165. package/docs/examples/messaging/delete-subscriber.md +3 -3
  166. package/docs/examples/messaging/delete-topic.md +2 -2
  167. package/docs/examples/messaging/delete.md +2 -2
  168. package/docs/examples/messaging/get-message.md +2 -2
  169. package/docs/examples/messaging/get-provider.md +2 -2
  170. package/docs/examples/messaging/get-subscriber.md +3 -3
  171. package/docs/examples/messaging/get-topic.md +2 -2
  172. package/docs/examples/messaging/list-message-logs.md +2 -2
  173. package/docs/examples/messaging/list-messages.md +2 -2
  174. package/docs/examples/messaging/list-provider-logs.md +2 -2
  175. package/docs/examples/messaging/list-providers.md +2 -2
  176. package/docs/examples/messaging/list-subscriber-logs.md +2 -2
  177. package/docs/examples/messaging/list-subscribers.md +3 -3
  178. package/docs/examples/messaging/list-targets.md +2 -2
  179. package/docs/examples/messaging/list-topic-logs.md +2 -2
  180. package/docs/examples/messaging/list-topics.md +2 -2
  181. package/docs/examples/messaging/{update-a-p-n-s-provider.md → update-apns-provider.md} +8 -7
  182. package/docs/examples/messaging/update-email.md +5 -5
  183. package/docs/examples/messaging/{update-f-c-m-provider.md → update-fcm-provider.md} +3 -3
  184. package/docs/examples/messaging/update-mailgun-provider.md +8 -8
  185. package/docs/examples/messaging/update-msg91provider.md +6 -6
  186. package/docs/examples/messaging/update-push.md +10 -10
  187. package/docs/examples/messaging/update-sendgrid-provider.md +7 -7
  188. package/docs/examples/messaging/update-sms.md +4 -4
  189. package/docs/examples/messaging/update-smtp-provider.md +11 -11
  190. package/docs/examples/messaging/update-telesign-provider.md +6 -6
  191. package/docs/examples/messaging/update-textmagic-provider.md +6 -6
  192. package/docs/examples/messaging/update-topic.md +4 -3
  193. package/docs/examples/messaging/update-twilio-provider.md +6 -6
  194. package/docs/examples/messaging/update-vonage-provider.md +6 -6
  195. package/docs/examples/storage/create-bucket.md +3 -3
  196. package/docs/examples/storage/create-file.md +3 -3
  197. package/docs/examples/storage/delete-bucket.md +2 -2
  198. package/docs/examples/storage/delete-file.md +3 -3
  199. package/docs/examples/storage/get-bucket.md +2 -2
  200. package/docs/examples/storage/get-file-download.md +3 -3
  201. package/docs/examples/storage/get-file-preview.md +3 -3
  202. package/docs/examples/storage/get-file-view.md +3 -3
  203. package/docs/examples/storage/get-file.md +3 -3
  204. package/docs/examples/storage/list-buckets.md +2 -2
  205. package/docs/examples/storage/list-files.md +3 -3
  206. package/docs/examples/storage/update-bucket.md +3 -3
  207. package/docs/examples/storage/update-file.md +4 -4
  208. package/docs/examples/teams/create-membership.md +4 -4
  209. package/docs/examples/teams/create.md +3 -3
  210. package/docs/examples/teams/delete-membership.md +3 -3
  211. package/docs/examples/teams/delete.md +2 -2
  212. package/docs/examples/teams/get-membership.md +3 -3
  213. package/docs/examples/teams/get-prefs.md +2 -2
  214. package/docs/examples/teams/get.md +2 -2
  215. package/docs/examples/teams/list-memberships.md +3 -3
  216. package/docs/examples/teams/list.md +2 -2
  217. package/docs/examples/teams/update-membership-status.md +5 -5
  218. package/docs/examples/teams/update-membership.md +3 -3
  219. package/docs/examples/teams/update-name.md +3 -3
  220. package/docs/examples/teams/update-prefs.md +2 -2
  221. package/docs/examples/users/create-argon2user.md +3 -3
  222. package/docs/examples/users/create-bcrypt-user.md +3 -3
  223. package/docs/examples/users/create-m-d5user.md +3 -3
  224. package/docs/examples/users/{delete-authenticator.md → create-mfa-recovery-codes.md} +2 -4
  225. package/docs/examples/users/create-p-h-pass-user.md +3 -3
  226. package/docs/examples/users/create-s-h-a-user.md +3 -3
  227. package/docs/examples/users/create-scrypt-modified-user.md +6 -6
  228. package/docs/examples/users/create-scrypt-user.md +4 -4
  229. package/docs/examples/users/create-session.md +2 -2
  230. package/docs/examples/users/create-target.md +6 -6
  231. package/docs/examples/users/create-token.md +2 -2
  232. package/docs/examples/users/create.md +3 -3
  233. package/docs/examples/users/delete-identity.md +2 -2
  234. package/docs/examples/users/delete-mfa-authenticator.md +13 -0
  235. package/docs/examples/users/delete-session.md +3 -3
  236. package/docs/examples/users/delete-sessions.md +2 -2
  237. package/docs/examples/users/delete-target.md +3 -3
  238. package/docs/examples/users/delete.md +2 -2
  239. package/docs/examples/users/get-mfa-recovery-codes.md +12 -0
  240. package/docs/examples/users/get-prefs.md +2 -2
  241. package/docs/examples/users/get-target.md +3 -3
  242. package/docs/examples/users/get.md +2 -2
  243. package/docs/examples/users/list-identities.md +2 -2
  244. package/docs/examples/users/list-logs.md +2 -2
  245. package/docs/examples/users/list-memberships.md +2 -2
  246. package/docs/examples/users/{list-factors.md → list-mfa-factors.md} +2 -2
  247. package/docs/examples/users/list-sessions.md +2 -2
  248. package/docs/examples/users/list-targets.md +2 -2
  249. package/docs/examples/users/list.md +2 -2
  250. package/docs/examples/users/update-email-verification.md +2 -2
  251. package/docs/examples/users/update-email.md +2 -2
  252. package/docs/examples/users/update-labels.md +2 -2
  253. package/docs/examples/users/update-mfa-recovery-codes.md +12 -0
  254. package/docs/examples/users/update-mfa.md +2 -2
  255. package/docs/examples/users/update-name.md +3 -3
  256. package/docs/examples/users/update-password.md +2 -2
  257. package/docs/examples/users/update-phone-verification.md +2 -2
  258. package/docs/examples/users/update-phone.md +2 -2
  259. package/docs/examples/users/update-prefs.md +2 -2
  260. package/docs/examples/users/update-status.md +2 -2
  261. package/docs/examples/users/update-target.md +6 -6
  262. package/index.d.ts +311 -116
  263. package/index.js +4 -6
  264. package/lib/client.js +7 -22
  265. package/lib/enums/authentication-factor.js +3 -2
  266. package/lib/enums/flag.js +1 -1
  267. package/lib/enums/index-type.js +1 -2
  268. package/lib/enums/name.js +1 -0
  269. package/lib/enums/runtime.js +8 -0
  270. package/lib/enums/smtp-encryption.js +7 -0
  271. package/lib/id.js +22 -2
  272. package/lib/services/account.js +206 -89
  273. package/lib/services/databases.js +28 -0
  274. package/lib/services/health.js +66 -0
  275. package/lib/services/messaging.js +75 -55
  276. package/lib/services/users.js +96 -14
  277. package/package.json +1 -1
  278. package/lib/enums/encryption.js +0 -7
  279. package/lib/enums/message-status.js +0 -7
@@ -368,6 +368,8 @@ class Databases extends Service {
368
368
  /**
369
369
  * List attributes
370
370
  *
371
+ * List attributes in the collection.
372
+ *
371
373
  * @param {string} databaseId
372
374
  * @param {string} collectionId
373
375
  * @param {string[]} queries
@@ -454,6 +456,9 @@ class Databases extends Service {
454
456
  /**
455
457
  * Update boolean attribute
456
458
  *
459
+ * Update a boolean attribute. Changing the `default` value will not update
460
+ * already existing documents.
461
+ *
457
462
  * @param {string} databaseId
458
463
  * @param {string} collectionId
459
464
  * @param {string} key
@@ -502,6 +507,8 @@ class Databases extends Service {
502
507
  /**
503
508
  * Create datetime attribute
504
509
  *
510
+ * Create a date time attribute according to the ISO 8601 standard.
511
+ *
505
512
  * @param {string} databaseId
506
513
  * @param {string} collectionId
507
514
  * @param {string} key
@@ -555,6 +562,9 @@ class Databases extends Service {
555
562
  /**
556
563
  * Update dateTime attribute
557
564
  *
565
+ * Update a date time attribute. Changing the `default` value will not update
566
+ * already existing documents.
567
+ *
558
568
  * @param {string} databaseId
559
569
  * @param {string} collectionId
560
570
  * @param {string} key
@@ -711,6 +721,10 @@ class Databases extends Service {
711
721
  /**
712
722
  * Create enum attribute
713
723
  *
724
+ * Create an enumeration attribute. The `elements` param acts as a white-list
725
+ * of accepted values for this attribute.
726
+ *
727
+ *
714
728
  * @param {string} databaseId
715
729
  * @param {string} collectionId
716
730
  * @param {string} key
@@ -1513,6 +1527,8 @@ class Databases extends Service {
1513
1527
  /**
1514
1528
  * Get attribute
1515
1529
  *
1530
+ * Get attribute by ID.
1531
+ *
1516
1532
  * @param {string} databaseId
1517
1533
  * @param {string} collectionId
1518
1534
  * @param {string} key
@@ -1543,6 +1559,8 @@ class Databases extends Service {
1543
1559
  /**
1544
1560
  * Delete attribute
1545
1561
  *
1562
+ * Deletes an attribute.
1563
+ *
1546
1564
  * @param {string} databaseId
1547
1565
  * @param {string} collectionId
1548
1566
  * @param {string} key
@@ -1811,6 +1829,8 @@ class Databases extends Service {
1811
1829
  /**
1812
1830
  * List indexes
1813
1831
  *
1832
+ * List indexes in the collection.
1833
+ *
1814
1834
  * @param {string} databaseId
1815
1835
  * @param {string} collectionId
1816
1836
  * @param {string[]} queries
@@ -1841,6 +1861,10 @@ class Databases extends Service {
1841
1861
  /**
1842
1862
  * Create index
1843
1863
  *
1864
+ * Creates an index on the attributes listed. Your index should include all
1865
+ * the attributes you will query in a single request.
1866
+ * Attributes can be `key`, `fulltext`, and `unique`.
1867
+ *
1844
1868
  * @param {string} databaseId
1845
1869
  * @param {string} collectionId
1846
1870
  * @param {string} key
@@ -1898,6 +1922,8 @@ class Databases extends Service {
1898
1922
  /**
1899
1923
  * Get index
1900
1924
  *
1925
+ * Get index by ID.
1926
+ *
1901
1927
  * @param {string} databaseId
1902
1928
  * @param {string} collectionId
1903
1929
  * @param {string} key
@@ -1928,6 +1954,8 @@ class Databases extends Service {
1928
1954
  /**
1929
1955
  * Delete index
1930
1956
  *
1957
+ * Delete an index.
1958
+ *
1931
1959
  * @param {string} databaseId
1932
1960
  * @param {string} collectionId
1933
1961
  * @param {string} key
@@ -271,6 +271,9 @@ class Health extends Service {
271
271
  /**
272
272
  * Get functions queue
273
273
  *
274
+ * Get the number of function executions that are waiting to be processed in
275
+ * the Appwrite internal queue server.
276
+ *
274
277
  * @param {number} threshold
275
278
  * @throws {AppwriteException}
276
279
  * @returns {Promise}
@@ -380,6 +383,52 @@ class Health extends Service {
380
383
  }, payload);
381
384
  }
382
385
 
386
+ /**
387
+ * Get usage queue
388
+ *
389
+ * Get the number of metrics that are waiting to be processed in the Appwrite
390
+ * internal queue server.
391
+ *
392
+ * @param {number} threshold
393
+ * @throws {AppwriteException}
394
+ * @returns {Promise}
395
+ */
396
+ async getQueueUsage(threshold) {
397
+ const apiPath = '/health/queue/usage';
398
+ let payload = {};
399
+
400
+ if (typeof threshold !== 'undefined') {
401
+ payload['threshold'] = threshold;
402
+ }
403
+
404
+ return await this.client.call('get', apiPath, {
405
+ 'content-type': 'application/json',
406
+ }, payload);
407
+ }
408
+
409
+ /**
410
+ * Get usage dump queue
411
+ *
412
+ * Get the number of projects containing metrics that are waiting to be
413
+ * processed in the Appwrite internal queue server.
414
+ *
415
+ * @param {number} threshold
416
+ * @throws {AppwriteException}
417
+ * @returns {Promise}
418
+ */
419
+ async getQueueUsageDump(threshold) {
420
+ const apiPath = '/health/queue/usage-dump';
421
+ let payload = {};
422
+
423
+ if (typeof threshold !== 'undefined') {
424
+ payload['threshold'] = threshold;
425
+ }
426
+
427
+ return await this.client.call('get', apiPath, {
428
+ 'content-type': 'application/json',
429
+ }, payload);
430
+ }
431
+
383
432
  /**
384
433
  * Get webhooks queue
385
434
  *
@@ -403,6 +452,23 @@ class Health extends Service {
403
452
  }, payload);
404
453
  }
405
454
 
455
+ /**
456
+ * Get storage
457
+ *
458
+ * Check the Appwrite storage device is up and connection is successful.
459
+ *
460
+ * @throws {AppwriteException}
461
+ * @returns {Promise}
462
+ */
463
+ async getStorage() {
464
+ const apiPath = '/health/storage';
465
+ let payload = {};
466
+
467
+ return await this.client.call('get', apiPath, {
468
+ 'content-type': 'application/json',
469
+ }, payload);
470
+ }
471
+
406
472
  /**
407
473
  * Get local storage
408
474
  *
@@ -44,7 +44,7 @@ class Messaging extends Service {
44
44
  }
45
45
 
46
46
  /**
47
- * Create an email
47
+ * Create email
48
48
  *
49
49
  * Create a new email message.
50
50
  *
@@ -57,13 +57,13 @@ class Messaging extends Service {
57
57
  * @param {string[]} cc
58
58
  * @param {string[]} bcc
59
59
  * @param {string[]} attachments
60
- * @param {MessageStatus} status
60
+ * @param {boolean} draft
61
61
  * @param {boolean} html
62
62
  * @param {string} scheduledAt
63
63
  * @throws {AppwriteException}
64
64
  * @returns {Promise}
65
65
  */
66
- async createEmail(messageId, subject, content, topics, users, targets, cc, bcc, attachments, status, html, scheduledAt) {
66
+ async createEmail(messageId, subject, content, topics, users, targets, cc, bcc, attachments, draft, html, scheduledAt) {
67
67
  const apiPath = '/messaging/messages/email';
68
68
  let payload = {};
69
69
  if (typeof messageId === 'undefined') {
@@ -115,8 +115,8 @@ class Messaging extends Service {
115
115
  payload['attachments'] = attachments;
116
116
  }
117
117
 
118
- if (typeof status !== 'undefined') {
119
- payload['status'] = status;
118
+ if (typeof draft !== 'undefined') {
119
+ payload['draft'] = draft;
120
120
  }
121
121
 
122
122
  if (typeof html !== 'undefined') {
@@ -133,7 +133,7 @@ class Messaging extends Service {
133
133
  }
134
134
 
135
135
  /**
136
- * Update an email
136
+ * Update email
137
137
  *
138
138
  * Update an email message by its unique ID.
139
139
  *
@@ -144,7 +144,7 @@ class Messaging extends Service {
144
144
  * @param {string[]} targets
145
145
  * @param {string} subject
146
146
  * @param {string} content
147
- * @param {MessageStatus} status
147
+ * @param {boolean} draft
148
148
  * @param {boolean} html
149
149
  * @param {string[]} cc
150
150
  * @param {string[]} bcc
@@ -152,7 +152,7 @@ class Messaging extends Service {
152
152
  * @throws {AppwriteException}
153
153
  * @returns {Promise}
154
154
  */
155
- async updateEmail(messageId, topics, users, targets, subject, content, status, html, cc, bcc, scheduledAt) {
155
+ async updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt) {
156
156
  const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', messageId);
157
157
  let payload = {};
158
158
  if (typeof messageId === 'undefined') {
@@ -180,8 +180,8 @@ class Messaging extends Service {
180
180
  payload['content'] = content;
181
181
  }
182
182
 
183
- if (typeof status !== 'undefined') {
184
- payload['status'] = status;
183
+ if (typeof draft !== 'undefined') {
184
+ payload['draft'] = draft;
185
185
  }
186
186
 
187
187
  if (typeof html !== 'undefined') {
@@ -206,7 +206,7 @@ class Messaging extends Service {
206
206
  }
207
207
 
208
208
  /**
209
- * Create a push notification
209
+ * Create push notification
210
210
  *
211
211
  * Create a new push notification.
212
212
  *
@@ -224,12 +224,12 @@ class Messaging extends Service {
224
224
  * @param {string} color
225
225
  * @param {string} tag
226
226
  * @param {string} badge
227
- * @param {MessageStatus} status
227
+ * @param {boolean} draft
228
228
  * @param {string} scheduledAt
229
229
  * @throws {AppwriteException}
230
230
  * @returns {Promise}
231
231
  */
232
- async createPush(messageId, title, body, topics, users, targets, data, action, image, icon, sound, color, tag, badge, status, scheduledAt) {
232
+ async createPush(messageId, title, body, topics, users, targets, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt) {
233
233
  const apiPath = '/messaging/messages/push';
234
234
  let payload = {};
235
235
  if (typeof messageId === 'undefined') {
@@ -301,8 +301,8 @@ class Messaging extends Service {
301
301
  payload['badge'] = badge;
302
302
  }
303
303
 
304
- if (typeof status !== 'undefined') {
305
- payload['status'] = status;
304
+ if (typeof draft !== 'undefined') {
305
+ payload['draft'] = draft;
306
306
  }
307
307
 
308
308
  if (typeof scheduledAt !== 'undefined') {
@@ -315,7 +315,7 @@ class Messaging extends Service {
315
315
  }
316
316
 
317
317
  /**
318
- * Update a push notification
318
+ * Update push notification
319
319
  *
320
320
  * Update a push notification by its unique ID.
321
321
  *
@@ -334,12 +334,12 @@ class Messaging extends Service {
334
334
  * @param {string} color
335
335
  * @param {string} tag
336
336
  * @param {number} badge
337
- * @param {MessageStatus} status
337
+ * @param {boolean} draft
338
338
  * @param {string} scheduledAt
339
339
  * @throws {AppwriteException}
340
340
  * @returns {Promise}
341
341
  */
342
- async updatePush(messageId, topics, users, targets, title, body, data, action, image, icon, sound, color, tag, badge, status, scheduledAt) {
342
+ async updatePush(messageId, topics, users, targets, title, body, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt) {
343
343
  const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', messageId);
344
344
  let payload = {};
345
345
  if (typeof messageId === 'undefined') {
@@ -399,8 +399,8 @@ class Messaging extends Service {
399
399
  payload['badge'] = badge;
400
400
  }
401
401
 
402
- if (typeof status !== 'undefined') {
403
- payload['status'] = status;
402
+ if (typeof draft !== 'undefined') {
403
+ payload['draft'] = draft;
404
404
  }
405
405
 
406
406
  if (typeof scheduledAt !== 'undefined') {
@@ -413,7 +413,7 @@ class Messaging extends Service {
413
413
  }
414
414
 
415
415
  /**
416
- * Create an SMS
416
+ * Create SMS
417
417
  *
418
418
  * Create a new SMS message.
419
419
  *
@@ -422,12 +422,12 @@ class Messaging extends Service {
422
422
  * @param {string[]} topics
423
423
  * @param {string[]} users
424
424
  * @param {string[]} targets
425
- * @param {MessageStatus} status
425
+ * @param {boolean} draft
426
426
  * @param {string} scheduledAt
427
427
  * @throws {AppwriteException}
428
428
  * @returns {Promise}
429
429
  */
430
- async createSms(messageId, content, topics, users, targets, status, scheduledAt) {
430
+ async createSms(messageId, content, topics, users, targets, draft, scheduledAt) {
431
431
  const apiPath = '/messaging/messages/sms';
432
432
  let payload = {};
433
433
  if (typeof messageId === 'undefined') {
@@ -459,8 +459,8 @@ class Messaging extends Service {
459
459
  payload['targets'] = targets;
460
460
  }
461
461
 
462
- if (typeof status !== 'undefined') {
463
- payload['status'] = status;
462
+ if (typeof draft !== 'undefined') {
463
+ payload['draft'] = draft;
464
464
  }
465
465
 
466
466
  if (typeof scheduledAt !== 'undefined') {
@@ -473,7 +473,7 @@ class Messaging extends Service {
473
473
  }
474
474
 
475
475
  /**
476
- * Update an SMS
476
+ * Update SMS
477
477
  *
478
478
  * Update an email message by its unique ID.
479
479
  *
@@ -483,12 +483,12 @@ class Messaging extends Service {
483
483
  * @param {string[]} users
484
484
  * @param {string[]} targets
485
485
  * @param {string} content
486
- * @param {MessageStatus} status
486
+ * @param {boolean} draft
487
487
  * @param {string} scheduledAt
488
488
  * @throws {AppwriteException}
489
489
  * @returns {Promise}
490
490
  */
491
- async updateSms(messageId, topics, users, targets, content, status, scheduledAt) {
491
+ async updateSms(messageId, topics, users, targets, content, draft, scheduledAt) {
492
492
  const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId);
493
493
  let payload = {};
494
494
  if (typeof messageId === 'undefined') {
@@ -512,8 +512,8 @@ class Messaging extends Service {
512
512
  payload['content'] = content;
513
513
  }
514
514
 
515
- if (typeof status !== 'undefined') {
516
- payload['status'] = status;
515
+ if (typeof draft !== 'undefined') {
516
+ payload['draft'] = draft;
517
517
  }
518
518
 
519
519
  if (typeof scheduledAt !== 'undefined') {
@@ -526,7 +526,7 @@ class Messaging extends Service {
526
526
  }
527
527
 
528
528
  /**
529
- * Get a message
529
+ * Get message
530
530
  *
531
531
  * Get a message by its unique ID.
532
532
  *
@@ -549,7 +549,10 @@ class Messaging extends Service {
549
549
  }
550
550
 
551
551
  /**
552
- * Delete a message
552
+ * Delete message
553
+ *
554
+ * Delete a message. If the message is not a draft or scheduled, but has been
555
+ * sent, this will not recall the message.
553
556
  *
554
557
  * @param {string} messageId
555
558
  * @throws {AppwriteException}
@@ -660,11 +663,12 @@ class Messaging extends Service {
660
663
  * @param {string} authKeyId
661
664
  * @param {string} teamId
662
665
  * @param {string} bundleId
666
+ * @param {boolean} sandbox
663
667
  * @param {boolean} enabled
664
668
  * @throws {AppwriteException}
665
669
  * @returns {Promise}
666
670
  */
667
- async createApnsProvider(providerId, name, authKey, authKeyId, teamId, bundleId, enabled) {
671
+ async createApnsProvider(providerId, name, authKey, authKeyId, teamId, bundleId, sandbox, enabled) {
668
672
  const apiPath = '/messaging/providers/apns';
669
673
  let payload = {};
670
674
  if (typeof providerId === 'undefined') {
@@ -700,6 +704,10 @@ class Messaging extends Service {
700
704
  payload['bundleId'] = bundleId;
701
705
  }
702
706
 
707
+ if (typeof sandbox !== 'undefined') {
708
+ payload['sandbox'] = sandbox;
709
+ }
710
+
703
711
  if (typeof enabled !== 'undefined') {
704
712
  payload['enabled'] = enabled;
705
713
  }
@@ -721,10 +729,11 @@ class Messaging extends Service {
721
729
  * @param {string} authKeyId
722
730
  * @param {string} teamId
723
731
  * @param {string} bundleId
732
+ * @param {boolean} sandbox
724
733
  * @throws {AppwriteException}
725
734
  * @returns {Promise}
726
735
  */
727
- async updateAPNSProvider(providerId, name, enabled, authKey, authKeyId, teamId, bundleId) {
736
+ async updateApnsProvider(providerId, name, enabled, authKey, authKeyId, teamId, bundleId, sandbox) {
728
737
  const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId);
729
738
  let payload = {};
730
739
  if (typeof providerId === 'undefined') {
@@ -756,6 +765,10 @@ class Messaging extends Service {
756
765
  payload['bundleId'] = bundleId;
757
766
  }
758
767
 
768
+ if (typeof sandbox !== 'undefined') {
769
+ payload['sandbox'] = sandbox;
770
+ }
771
+
759
772
  return await this.client.call('patch', apiPath, {
760
773
  'content-type': 'application/json',
761
774
  }, payload);
@@ -818,7 +831,7 @@ class Messaging extends Service {
818
831
  * @throws {AppwriteException}
819
832
  * @returns {Promise}
820
833
  */
821
- async updateFCMProvider(providerId, name, enabled, serviceAccountJSON) {
834
+ async updateFcmProvider(providerId, name, enabled, serviceAccountJSON) {
822
835
  const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId);
823
836
  let payload = {};
824
837
  if (typeof providerId === 'undefined') {
@@ -992,14 +1005,14 @@ class Messaging extends Service {
992
1005
  *
993
1006
  * @param {string} providerId
994
1007
  * @param {string} name
995
- * @param {string} from
1008
+ * @param {string} templateId
996
1009
  * @param {string} senderId
997
1010
  * @param {string} authKey
998
1011
  * @param {boolean} enabled
999
1012
  * @throws {AppwriteException}
1000
1013
  * @returns {Promise}
1001
1014
  */
1002
- async createMsg91Provider(providerId, name, from, senderId, authKey, enabled) {
1015
+ async createMsg91Provider(providerId, name, templateId, senderId, authKey, enabled) {
1003
1016
  const apiPath = '/messaging/providers/msg91';
1004
1017
  let payload = {};
1005
1018
  if (typeof providerId === 'undefined') {
@@ -1019,8 +1032,8 @@ class Messaging extends Service {
1019
1032
  payload['name'] = name;
1020
1033
  }
1021
1034
 
1022
- if (typeof from !== 'undefined') {
1023
- payload['from'] = from;
1035
+ if (typeof templateId !== 'undefined') {
1036
+ payload['templateId'] = templateId;
1024
1037
  }
1025
1038
 
1026
1039
  if (typeof senderId !== 'undefined') {
@@ -1048,13 +1061,13 @@ class Messaging extends Service {
1048
1061
  * @param {string} providerId
1049
1062
  * @param {string} name
1050
1063
  * @param {boolean} enabled
1064
+ * @param {string} templateId
1051
1065
  * @param {string} senderId
1052
1066
  * @param {string} authKey
1053
- * @param {string} from
1054
1067
  * @throws {AppwriteException}
1055
1068
  * @returns {Promise}
1056
1069
  */
1057
- async updateMsg91Provider(providerId, name, enabled, senderId, authKey, from) {
1070
+ async updateMsg91Provider(providerId, name, enabled, templateId, senderId, authKey) {
1058
1071
  const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', providerId);
1059
1072
  let payload = {};
1060
1073
  if (typeof providerId === 'undefined') {
@@ -1070,6 +1083,10 @@ class Messaging extends Service {
1070
1083
  payload['enabled'] = enabled;
1071
1084
  }
1072
1085
 
1086
+ if (typeof templateId !== 'undefined') {
1087
+ payload['templateId'] = templateId;
1088
+ }
1089
+
1073
1090
  if (typeof senderId !== 'undefined') {
1074
1091
  payload['senderId'] = senderId;
1075
1092
  }
@@ -1078,10 +1095,6 @@ class Messaging extends Service {
1078
1095
  payload['authKey'] = authKey;
1079
1096
  }
1080
1097
 
1081
- if (typeof from !== 'undefined') {
1082
- payload['from'] = from;
1083
- }
1084
-
1085
1098
  return await this.client.call('patch', apiPath, {
1086
1099
  'content-type': 'application/json',
1087
1100
  }, payload);
@@ -1090,6 +1103,8 @@ class Messaging extends Service {
1090
1103
  /**
1091
1104
  * Create Sendgrid provider
1092
1105
  *
1106
+ * Create a new Sendgrid provider.
1107
+ *
1093
1108
  * @param {string} providerId
1094
1109
  * @param {string} name
1095
1110
  * @param {string} apiKey
@@ -1218,7 +1233,7 @@ class Messaging extends Service {
1218
1233
  * @param {number} port
1219
1234
  * @param {string} username
1220
1235
  * @param {string} password
1221
- * @param {Encryption} encryption
1236
+ * @param {SmtpEncryption} encryption
1222
1237
  * @param {boolean} autoTLS
1223
1238
  * @param {string} mailer
1224
1239
  * @param {string} fromName
@@ -1317,7 +1332,7 @@ class Messaging extends Service {
1317
1332
  * @param {number} port
1318
1333
  * @param {string} username
1319
1334
  * @param {string} password
1320
- * @param {Encryption} encryption
1335
+ * @param {SmtpEncryption} encryption
1321
1336
  * @param {boolean} autoTLS
1322
1337
  * @param {string} mailer
1323
1338
  * @param {string} fromName
@@ -1928,7 +1943,7 @@ class Messaging extends Service {
1928
1943
  }
1929
1944
 
1930
1945
  /**
1931
- * Create a topic
1946
+ * Create topic
1932
1947
  *
1933
1948
  * Create a new topic.
1934
1949
  *
@@ -1968,7 +1983,7 @@ class Messaging extends Service {
1968
1983
  }
1969
1984
 
1970
1985
  /**
1971
- * Get a topic
1986
+ * Get topic
1972
1987
  *
1973
1988
  * Get a topic by its unique ID.
1974
1989
  *
@@ -1991,17 +2006,18 @@ class Messaging extends Service {
1991
2006
  }
1992
2007
 
1993
2008
  /**
1994
- * Update a topic
2009
+ * Update topic
1995
2010
  *
1996
2011
  * Update a topic by its unique ID.
1997
2012
  *
1998
2013
  *
1999
2014
  * @param {string} topicId
2000
2015
  * @param {string} name
2016
+ * @param {string[]} subscribe
2001
2017
  * @throws {AppwriteException}
2002
2018
  * @returns {Promise}
2003
2019
  */
2004
- async updateTopic(topicId, name) {
2020
+ async updateTopic(topicId, name, subscribe) {
2005
2021
  const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId);
2006
2022
  let payload = {};
2007
2023
  if (typeof topicId === 'undefined') {
@@ -2013,13 +2029,17 @@ class Messaging extends Service {
2013
2029
  payload['name'] = name;
2014
2030
  }
2015
2031
 
2032
+ if (typeof subscribe !== 'undefined') {
2033
+ payload['subscribe'] = subscribe;
2034
+ }
2035
+
2016
2036
  return await this.client.call('patch', apiPath, {
2017
2037
  'content-type': 'application/json',
2018
2038
  }, payload);
2019
2039
  }
2020
2040
 
2021
2041
  /**
2022
- * Delete a topic
2042
+ * Delete topic
2023
2043
  *
2024
2044
  * Delete a topic by its unique ID.
2025
2045
  *
@@ -2100,7 +2120,7 @@ class Messaging extends Service {
2100
2120
  }
2101
2121
 
2102
2122
  /**
2103
- * Create a subscriber
2123
+ * Create subscriber
2104
2124
  *
2105
2125
  * Create a new subscriber.
2106
2126
  *
@@ -2140,7 +2160,7 @@ class Messaging extends Service {
2140
2160
  }
2141
2161
 
2142
2162
  /**
2143
- * Get a subscriber
2163
+ * Get subscriber
2144
2164
  *
2145
2165
  * Get a subscriber by its unique ID.
2146
2166
  *
@@ -2168,7 +2188,7 @@ class Messaging extends Service {
2168
2188
  }
2169
2189
 
2170
2190
  /**
2171
- * Delete a subscriber
2191
+ * Delete subscriber
2172
2192
  *
2173
2193
  * Delete a subscriber by its unique ID.
2174
2194
  *