@appwrite.io/console 0.6.0-rc.13 → 0.6.0-rc.15

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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/sdk.js +333 -126
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +334 -127
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +333 -126
  7. package/docs/examples/account/{add-authenticator.md → create-mfa-authenticator.md} +3 -3
  8. package/docs/examples/account/{create-challenge.md → create-mfa-challenge.md} +3 -3
  9. package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
  10. package/docs/examples/account/{verify-authenticator.md → delete-mfa-authenticator.md} +3 -3
  11. package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
  12. package/docs/examples/account/{list-factors.md → list-mfa-factors.md} +1 -1
  13. package/docs/examples/account/{delete-authenticator.md → update-mfa-authenticator.md} +3 -3
  14. package/docs/examples/account/{update-challenge.md → update-mfa-challenge.md} +1 -1
  15. package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
  16. package/docs/examples/account/update-phone-session.md +14 -0
  17. package/docs/examples/messaging/create-email.md +2 -2
  18. package/docs/examples/messaging/create-push.md +2 -2
  19. package/docs/examples/messaging/create-sms.md +2 -2
  20. package/docs/examples/messaging/update-email.md +2 -2
  21. package/docs/examples/messaging/update-push.md +2 -2
  22. package/docs/examples/messaging/update-sms.md +2 -2
  23. package/docs/examples/users/create-mfa-recovery-codes.md +13 -0
  24. package/docs/examples/users/{delete-authenticator.md → delete-mfa-authenticator.md} +3 -4
  25. package/docs/examples/users/get-mfa-recovery-codes.md +13 -0
  26. package/docs/examples/users/{list-factors.md → list-mfa-factors.md} +1 -1
  27. package/docs/examples/users/update-mfa-recovery-codes.md +13 -0
  28. package/package.json +1 -1
  29. package/src/client.ts +1 -1
  30. package/src/enums/{authentication-factor.ts → factor.ts} +4 -3
  31. package/src/enums/index-type.ts +0 -1
  32. package/src/enums/type.ts +3 -0
  33. package/src/index.ts +2 -3
  34. package/src/models.ts +13 -8
  35. package/src/services/account.ts +176 -56
  36. package/src/services/databases.ts +20 -3
  37. package/src/services/health.ts +2 -0
  38. package/src/services/messaging.ts +42 -40
  39. package/src/services/project.ts +1 -1
  40. package/src/services/storage.ts +2 -2
  41. package/src/services/users.ts +93 -16
  42. package/types/enums/factor.d.ts +6 -0
  43. package/types/enums/index-type.d.ts +1 -2
  44. package/types/enums/type.d.ts +3 -0
  45. package/types/index.d.ts +2 -3
  46. package/types/models.d.ts +13 -8
  47. package/types/services/account.d.ts +90 -22
  48. package/types/services/databases.d.ts +20 -3
  49. package/types/services/health.d.ts +2 -0
  50. package/types/services/messaging.d.ts +30 -28
  51. package/types/services/project.d.ts +1 -1
  52. package/types/services/storage.d.ts +2 -2
  53. package/types/services/users.d.ts +53 -7
  54. package/src/enums/authenticator-type.ts +0 -3
  55. package/src/enums/message-status.ts +0 -5
  56. package/types/enums/authentication-factor.d.ts +0 -5
  57. package/types/enums/authenticator-type.d.ts +0 -3
  58. package/types/enums/message-status.d.ts +0 -5
package/dist/iife/sdk.js CHANGED
@@ -115,7 +115,7 @@
115
115
  'x-sdk-name': 'Console',
116
116
  'x-sdk-platform': 'console',
117
117
  'x-sdk-language': 'web',
118
- 'x-sdk-version': '0.6.0-rc.13',
118
+ 'x-sdk-version': '0.6.0-rc.15',
119
119
  'X-Appwrite-Response-Format': '1.5.0',
120
120
  };
121
121
  this.realtime = {
@@ -668,6 +668,7 @@
668
668
  /**
669
669
  * Update MFA
670
670
  *
671
+ * Enable or disable MFA on an account.
671
672
  *
672
673
  * @param {boolean} mfa
673
674
  * @throws {AppwriteException}
@@ -689,15 +690,103 @@
689
690
  }, payload);
690
691
  });
691
692
  }
693
+ /**
694
+ * Add Authenticator
695
+ *
696
+ * Add an authenticator app to be used as an MFA factor. Verify the
697
+ * authenticator using the [verify
698
+ * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
699
+ * method.
700
+ *
701
+ * @param {Type} type
702
+ * @throws {AppwriteException}
703
+ * @returns {Promise}
704
+ */
705
+ createMfaAuthenticator(type) {
706
+ return __awaiter(this, void 0, void 0, function* () {
707
+ if (typeof type === 'undefined') {
708
+ throw new AppwriteException('Missing required parameter: "type"');
709
+ }
710
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
711
+ const payload = {};
712
+ const uri = new URL(this.client.config.endpoint + apiPath);
713
+ return yield this.client.call('post', uri, {
714
+ 'content-type': 'application/json',
715
+ }, payload);
716
+ });
717
+ }
718
+ /**
719
+ * Verify Authenticator
720
+ *
721
+ * Verify an authenticator app after adding it using the [add
722
+ * authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
723
+ * method.
724
+ *
725
+ * @param {Type} type
726
+ * @param {string} otp
727
+ * @throws {AppwriteException}
728
+ * @returns {Promise}
729
+ */
730
+ updateMfaAuthenticator(type, otp) {
731
+ return __awaiter(this, void 0, void 0, function* () {
732
+ if (typeof type === 'undefined') {
733
+ throw new AppwriteException('Missing required parameter: "type"');
734
+ }
735
+ if (typeof otp === 'undefined') {
736
+ throw new AppwriteException('Missing required parameter: "otp"');
737
+ }
738
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
739
+ const payload = {};
740
+ if (typeof otp !== 'undefined') {
741
+ payload['otp'] = otp;
742
+ }
743
+ const uri = new URL(this.client.config.endpoint + apiPath);
744
+ return yield this.client.call('put', uri, {
745
+ 'content-type': 'application/json',
746
+ }, payload);
747
+ });
748
+ }
749
+ /**
750
+ * Delete Authenticator
751
+ *
752
+ * Delete an authenticator for a user by ID.
753
+ *
754
+ * @param {Type} type
755
+ * @param {string} otp
756
+ * @throws {AppwriteException}
757
+ * @returns {Promise}
758
+ */
759
+ deleteMfaAuthenticator(type, otp) {
760
+ return __awaiter(this, void 0, void 0, function* () {
761
+ if (typeof type === 'undefined') {
762
+ throw new AppwriteException('Missing required parameter: "type"');
763
+ }
764
+ if (typeof otp === 'undefined') {
765
+ throw new AppwriteException('Missing required parameter: "otp"');
766
+ }
767
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
768
+ const payload = {};
769
+ if (typeof otp !== 'undefined') {
770
+ payload['otp'] = otp;
771
+ }
772
+ const uri = new URL(this.client.config.endpoint + apiPath);
773
+ return yield this.client.call('delete', uri, {
774
+ 'content-type': 'application/json',
775
+ }, payload);
776
+ });
777
+ }
692
778
  /**
693
779
  * Create 2FA Challenge
694
780
  *
781
+ * Begin the process of MFA verification after sign-in. Finish the flow with
782
+ * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
783
+ * method.
695
784
  *
696
- * @param {AuthenticationFactor} factor
785
+ * @param {Factor} factor
697
786
  * @throws {AppwriteException}
698
787
  * @returns {Promise}
699
788
  */
700
- createChallenge(factor) {
789
+ createMfaChallenge(factor) {
701
790
  return __awaiter(this, void 0, void 0, function* () {
702
791
  if (typeof factor === 'undefined') {
703
792
  throw new AppwriteException('Missing required parameter: "factor"');
@@ -716,13 +805,18 @@
716
805
  /**
717
806
  * Create MFA Challenge (confirmation)
718
807
  *
808
+ * Complete the MFA challenge by providing the one-time password. Finish the
809
+ * process of MFA verification by providing the one-time password. To begin
810
+ * the flow, use
811
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
812
+ * method.
719
813
  *
720
814
  * @param {string} challengeId
721
815
  * @param {string} otp
722
816
  * @throws {AppwriteException}
723
817
  * @returns {Promise}
724
818
  */
725
- updateChallenge(challengeId, otp) {
819
+ updateMfaChallenge(challengeId, otp) {
726
820
  return __awaiter(this, void 0, void 0, function* () {
727
821
  if (typeof challengeId === 'undefined') {
728
822
  throw new AppwriteException('Missing required parameter: "challengeId"');
@@ -747,11 +841,12 @@
747
841
  /**
748
842
  * List Factors
749
843
  *
844
+ * List the factors available on the account to be used as a MFA challange.
750
845
  *
751
846
  * @throws {AppwriteException}
752
847
  * @returns {Promise}
753
848
  */
754
- listFactors() {
849
+ listMfaFactors() {
755
850
  return __awaiter(this, void 0, void 0, function* () {
756
851
  const apiPath = '/account/mfa/factors';
757
852
  const payload = {};
@@ -762,78 +857,65 @@
762
857
  });
763
858
  }
764
859
  /**
765
- * Add Authenticator
860
+ * Get MFA Recovery Codes
766
861
  *
862
+ * Get recovery codes that can be used as backup for MFA flow. Before getting
863
+ * codes, they must be generated using
864
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
865
+ * method. An OTP challenge is required to read recovery codes.
767
866
  *
768
- * @param {AuthenticatorType} type
769
867
  * @throws {AppwriteException}
770
868
  * @returns {Promise}
771
869
  */
772
- addAuthenticator(type) {
870
+ getMfaRecoveryCodes() {
773
871
  return __awaiter(this, void 0, void 0, function* () {
774
- if (typeof type === 'undefined') {
775
- throw new AppwriteException('Missing required parameter: "type"');
776
- }
777
- const apiPath = '/account/mfa/{type}'.replace('{type}', type);
872
+ const apiPath = '/account/mfa/recovery-codes';
778
873
  const payload = {};
779
874
  const uri = new URL(this.client.config.endpoint + apiPath);
780
- return yield this.client.call('post', uri, {
875
+ return yield this.client.call('get', uri, {
781
876
  'content-type': 'application/json',
782
877
  }, payload);
783
878
  });
784
879
  }
785
880
  /**
786
- * Verify Authenticator
881
+ * Create MFA Recovery Codes
787
882
  *
883
+ * Generate recovery codes as backup for MFA flow. It's recommended to
884
+ * generate and show then immediately after user successfully adds their
885
+ * authehticator. Recovery codes can be used as a MFA verification type in
886
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
887
+ * method.
788
888
  *
789
- * @param {AuthenticatorType} type
790
- * @param {string} otp
791
889
  * @throws {AppwriteException}
792
890
  * @returns {Promise}
793
891
  */
794
- verifyAuthenticator(type, otp) {
892
+ createMfaRecoveryCodes() {
795
893
  return __awaiter(this, void 0, void 0, function* () {
796
- if (typeof type === 'undefined') {
797
- throw new AppwriteException('Missing required parameter: "type"');
798
- }
799
- if (typeof otp === 'undefined') {
800
- throw new AppwriteException('Missing required parameter: "otp"');
801
- }
802
- const apiPath = '/account/mfa/{type}'.replace('{type}', type);
894
+ const apiPath = '/account/mfa/recovery-codes';
803
895
  const payload = {};
804
- if (typeof otp !== 'undefined') {
805
- payload['otp'] = otp;
806
- }
807
896
  const uri = new URL(this.client.config.endpoint + apiPath);
808
- return yield this.client.call('put', uri, {
897
+ return yield this.client.call('post', uri, {
809
898
  'content-type': 'application/json',
810
899
  }, payload);
811
900
  });
812
901
  }
813
902
  /**
814
- * Delete Authenticator
903
+ * Regenerate MFA Recovery Codes
815
904
  *
905
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before
906
+ * regenerating codes, they must be first generated using
907
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
908
+ * method. An OTP challenge is required to regenreate recovery codes.
816
909
  *
817
- * @param {AuthenticatorType} type
818
- * @param {string} otp
819
910
  * @throws {AppwriteException}
820
911
  * @returns {Promise}
821
912
  */
822
- deleteAuthenticator(type, otp) {
913
+ updateMfaRecoveryCodes() {
823
914
  return __awaiter(this, void 0, void 0, function* () {
824
- if (typeof type === 'undefined') {
825
- throw new AppwriteException('Missing required parameter: "type"');
826
- }
827
- if (typeof otp === 'undefined') {
828
- throw new AppwriteException('Missing required parameter: "otp"');
829
- }
830
- const apiPath = '/account/mfa/{type}'.replace('{type}', type);
915
+ const apiPath = '/account/mfa/recovery-codes';
831
916
  const payload = {};
832
- if (typeof otp !== 'undefined') {
833
- payload['otp'] = otp;
834
- }
835
917
  const uri = new URL(this.client.config.endpoint + apiPath);
836
- return yield this.client.call('delete', uri, {
918
+ return yield this.client.call('patch', uri, {
837
919
  'content-type': 'application/json',
838
920
  }, payload);
839
921
  });
@@ -1162,7 +1244,7 @@
1162
1244
  });
1163
1245
  }
1164
1246
  /**
1165
- * Create session (deprecated)
1247
+ * Update magic URL session
1166
1248
  *
1167
1249
  * Use this endpoint to create a session from token. Provide the **userId**
1168
1250
  * and **secret** parameters from the successful response of authentication
@@ -1249,6 +1331,40 @@
1249
1331
  return uri;
1250
1332
  }
1251
1333
  }
1334
+ /**
1335
+ * Update phone session
1336
+ *
1337
+ * Use this endpoint to create a session from token. Provide the **userId**
1338
+ * and **secret** parameters from the successful response of authentication
1339
+ * flows initiated by token creation. For example, magic URL and phone login.
1340
+ *
1341
+ * @param {string} userId
1342
+ * @param {string} secret
1343
+ * @throws {AppwriteException}
1344
+ * @returns {Promise}
1345
+ */
1346
+ updatePhoneSession(userId, secret) {
1347
+ return __awaiter(this, void 0, void 0, function* () {
1348
+ if (typeof userId === 'undefined') {
1349
+ throw new AppwriteException('Missing required parameter: "userId"');
1350
+ }
1351
+ if (typeof secret === 'undefined') {
1352
+ throw new AppwriteException('Missing required parameter: "secret"');
1353
+ }
1354
+ const apiPath = '/account/sessions/phone';
1355
+ const payload = {};
1356
+ if (typeof userId !== 'undefined') {
1357
+ payload['userId'] = userId;
1358
+ }
1359
+ if (typeof secret !== 'undefined') {
1360
+ payload['secret'] = secret;
1361
+ }
1362
+ const uri = new URL(this.client.config.endpoint + apiPath);
1363
+ return yield this.client.call('put', uri, {
1364
+ 'content-type': 'application/json',
1365
+ }, payload);
1366
+ });
1367
+ }
1252
1368
  /**
1253
1369
  * Create session
1254
1370
  *
@@ -1307,7 +1423,7 @@
1307
1423
  });
1308
1424
  }
1309
1425
  /**
1310
- * Update (or renew) a session
1426
+ * Update (or renew) session
1311
1427
  *
1312
1428
  * Extend session's expiry to increase it's lifespan. Extending a session is
1313
1429
  * useful when session length is short such as 5 minutes.
@@ -1376,7 +1492,7 @@
1376
1492
  });
1377
1493
  }
1378
1494
  /**
1379
- * Create a push target
1495
+ * Create push target
1380
1496
  *
1381
1497
  *
1382
1498
  * @param {string} targetId
@@ -1411,7 +1527,7 @@
1411
1527
  });
1412
1528
  }
1413
1529
  /**
1414
- * Update a push target
1530
+ * Update push target
1415
1531
  *
1416
1532
  *
1417
1533
  * @param {string} targetId
@@ -1439,7 +1555,7 @@
1439
1555
  });
1440
1556
  }
1441
1557
  /**
1442
- * Delete a push target
1558
+ * Delete push target
1443
1559
  *
1444
1560
  *
1445
1561
  * @param {string} targetId
@@ -2202,7 +2318,7 @@
2202
2318
  });
2203
2319
  }
2204
2320
  /**
2205
- * Get usage stats for the database
2321
+ * Get databases usage stats
2206
2322
  *
2207
2323
  *
2208
2324
  * @param {DatabaseUsageRange} range
@@ -2485,6 +2601,7 @@
2485
2601
  /**
2486
2602
  * List attributes
2487
2603
  *
2604
+ * List attributes in the collection.
2488
2605
  *
2489
2606
  * @param {string} databaseId
2490
2607
  * @param {string} collectionId
@@ -2563,6 +2680,8 @@
2563
2680
  /**
2564
2681
  * Update boolean attribute
2565
2682
  *
2683
+ * Update a boolean attribute. Changing the `default` value will not update
2684
+ * already existing documents.
2566
2685
  *
2567
2686
  * @param {string} databaseId
2568
2687
  * @param {string} collectionId
@@ -2606,6 +2725,7 @@
2606
2725
  /**
2607
2726
  * Create datetime attribute
2608
2727
  *
2728
+ * Create a date time attribute according to the ISO 8601 standard.
2609
2729
  *
2610
2730
  * @param {string} databaseId
2611
2731
  * @param {string} collectionId
@@ -2653,6 +2773,8 @@
2653
2773
  /**
2654
2774
  * Update dateTime attribute
2655
2775
  *
2776
+ * Update a date time attribute. Changing the `default` value will not update
2777
+ * already existing documents.
2656
2778
  *
2657
2779
  * @param {string} databaseId
2658
2780
  * @param {string} collectionId
@@ -2791,6 +2913,9 @@
2791
2913
  /**
2792
2914
  * Create enum attribute
2793
2915
  *
2916
+ * Create an enumeration attribute. The `elements` param acts as a white-list
2917
+ * of accepted values for this attribute.
2918
+ *
2794
2919
  *
2795
2920
  * @param {string} databaseId
2796
2921
  * @param {string} collectionId
@@ -3488,6 +3613,7 @@
3488
3613
  /**
3489
3614
  * Get attribute
3490
3615
  *
3616
+ * Get attribute by ID.
3491
3617
  *
3492
3618
  * @param {string} databaseId
3493
3619
  * @param {string} collectionId
@@ -3517,6 +3643,7 @@
3517
3643
  /**
3518
3644
  * Delete attribute
3519
3645
  *
3646
+ * Deletes an attribute.
3520
3647
  *
3521
3648
  * @param {string} databaseId
3522
3649
  * @param {string} collectionId
@@ -3798,6 +3925,7 @@
3798
3925
  /**
3799
3926
  * List indexes
3800
3927
  *
3928
+ * List indexes in the collection.
3801
3929
  *
3802
3930
  * @param {string} databaseId
3803
3931
  * @param {string} collectionId
@@ -3827,6 +3955,9 @@
3827
3955
  /**
3828
3956
  * Create index
3829
3957
  *
3958
+ * Creates an index on the attributes listed. Your index should include all
3959
+ * the attributes you will query in a single request.
3960
+ * Attributes can be `key`, `fulltext`, and `unique`.
3830
3961
  *
3831
3962
  * @param {string} databaseId
3832
3963
  * @param {string} collectionId
@@ -3877,6 +4008,7 @@
3877
4008
  /**
3878
4009
  * Get index
3879
4010
  *
4011
+ * Get index by ID.
3880
4012
  *
3881
4013
  * @param {string} databaseId
3882
4014
  * @param {string} collectionId
@@ -3906,6 +4038,7 @@
3906
4038
  /**
3907
4039
  * Delete index
3908
4040
  *
4041
+ * Delete an index.
3909
4042
  *
3910
4043
  * @param {string} databaseId
3911
4044
  * @param {string} collectionId
@@ -3963,7 +4096,7 @@
3963
4096
  });
3964
4097
  }
3965
4098
  /**
3966
- * Get usage stats for a collection
4099
+ * Get collection usage stats
3967
4100
  *
3968
4101
  *
3969
4102
  * @param {string} databaseId
@@ -4018,7 +4151,7 @@
4018
4151
  });
4019
4152
  }
4020
4153
  /**
4021
- * Get usage stats for the database
4154
+ * Get database usage stats
4022
4155
  *
4023
4156
  *
4024
4157
  * @param {string} databaseId
@@ -5205,6 +5338,8 @@
5205
5338
  /**
5206
5339
  * Get functions queue
5207
5340
  *
5341
+ * Get the number of function executions that are waiting to be processed in
5342
+ * the Appwrite internal queue server.
5208
5343
  *
5209
5344
  * @param {number} threshold
5210
5345
  * @throws {AppwriteException}
@@ -5576,7 +5711,7 @@
5576
5711
  });
5577
5712
  }
5578
5713
  /**
5579
- * Create an email
5714
+ * Create email
5580
5715
  *
5581
5716
  * Create a new email message.
5582
5717
  *
@@ -5589,13 +5724,13 @@
5589
5724
  * @param {string[]} cc
5590
5725
  * @param {string[]} bcc
5591
5726
  * @param {string[]} attachments
5592
- * @param {MessageStatus} status
5727
+ * @param {boolean} draft
5593
5728
  * @param {boolean} html
5594
5729
  * @param {string} scheduledAt
5595
5730
  * @throws {AppwriteException}
5596
5731
  * @returns {Promise}
5597
5732
  */
5598
- createEmail(messageId, subject, content, topics, users, targets, cc, bcc, attachments, status, html, scheduledAt) {
5733
+ createEmail(messageId, subject, content, topics, users, targets, cc, bcc, attachments, draft, html, scheduledAt) {
5599
5734
  return __awaiter(this, void 0, void 0, function* () {
5600
5735
  if (typeof messageId === 'undefined') {
5601
5736
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5635,8 +5770,8 @@
5635
5770
  if (typeof attachments !== 'undefined') {
5636
5771
  payload['attachments'] = attachments;
5637
5772
  }
5638
- if (typeof status !== 'undefined') {
5639
- payload['status'] = status;
5773
+ if (typeof draft !== 'undefined') {
5774
+ payload['draft'] = draft;
5640
5775
  }
5641
5776
  if (typeof html !== 'undefined') {
5642
5777
  payload['html'] = html;
@@ -5651,7 +5786,7 @@
5651
5786
  });
5652
5787
  }
5653
5788
  /**
5654
- * Update an email
5789
+ * Update email
5655
5790
  *
5656
5791
  * Update an email message by its unique ID.
5657
5792
  *
@@ -5662,7 +5797,7 @@
5662
5797
  * @param {string[]} targets
5663
5798
  * @param {string} subject
5664
5799
  * @param {string} content
5665
- * @param {MessageStatus} status
5800
+ * @param {boolean} draft
5666
5801
  * @param {boolean} html
5667
5802
  * @param {string[]} cc
5668
5803
  * @param {string[]} bcc
@@ -5670,7 +5805,7 @@
5670
5805
  * @throws {AppwriteException}
5671
5806
  * @returns {Promise}
5672
5807
  */
5673
- updateEmail(messageId, topics, users, targets, subject, content, status, html, cc, bcc, scheduledAt) {
5808
+ updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt) {
5674
5809
  return __awaiter(this, void 0, void 0, function* () {
5675
5810
  if (typeof messageId === 'undefined') {
5676
5811
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5692,8 +5827,8 @@
5692
5827
  if (typeof content !== 'undefined') {
5693
5828
  payload['content'] = content;
5694
5829
  }
5695
- if (typeof status !== 'undefined') {
5696
- payload['status'] = status;
5830
+ if (typeof draft !== 'undefined') {
5831
+ payload['draft'] = draft;
5697
5832
  }
5698
5833
  if (typeof html !== 'undefined') {
5699
5834
  payload['html'] = html;
@@ -5714,7 +5849,7 @@
5714
5849
  });
5715
5850
  }
5716
5851
  /**
5717
- * Create a push notification
5852
+ * Create push notification
5718
5853
  *
5719
5854
  * Create a new push notification.
5720
5855
  *
@@ -5732,12 +5867,12 @@
5732
5867
  * @param {string} color
5733
5868
  * @param {string} tag
5734
5869
  * @param {string} badge
5735
- * @param {MessageStatus} status
5870
+ * @param {boolean} draft
5736
5871
  * @param {string} scheduledAt
5737
5872
  * @throws {AppwriteException}
5738
5873
  * @returns {Promise}
5739
5874
  */
5740
- createPush(messageId, title, body, topics, users, targets, data, action, image, icon, sound, color, tag, badge, status, scheduledAt) {
5875
+ createPush(messageId, title, body, topics, users, targets, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt) {
5741
5876
  return __awaiter(this, void 0, void 0, function* () {
5742
5877
  if (typeof messageId === 'undefined') {
5743
5878
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5792,8 +5927,8 @@
5792
5927
  if (typeof badge !== 'undefined') {
5793
5928
  payload['badge'] = badge;
5794
5929
  }
5795
- if (typeof status !== 'undefined') {
5796
- payload['status'] = status;
5930
+ if (typeof draft !== 'undefined') {
5931
+ payload['draft'] = draft;
5797
5932
  }
5798
5933
  if (typeof scheduledAt !== 'undefined') {
5799
5934
  payload['scheduledAt'] = scheduledAt;
@@ -5805,7 +5940,7 @@
5805
5940
  });
5806
5941
  }
5807
5942
  /**
5808
- * Update a push notification
5943
+ * Update push notification
5809
5944
  *
5810
5945
  * Update a push notification by its unique ID.
5811
5946
  *
@@ -5824,12 +5959,12 @@
5824
5959
  * @param {string} color
5825
5960
  * @param {string} tag
5826
5961
  * @param {number} badge
5827
- * @param {MessageStatus} status
5962
+ * @param {boolean} draft
5828
5963
  * @param {string} scheduledAt
5829
5964
  * @throws {AppwriteException}
5830
5965
  * @returns {Promise}
5831
5966
  */
5832
- updatePush(messageId, topics, users, targets, title, body, data, action, image, icon, sound, color, tag, badge, status, scheduledAt) {
5967
+ updatePush(messageId, topics, users, targets, title, body, data, action, image, icon, sound, color, tag, badge, draft, scheduledAt) {
5833
5968
  return __awaiter(this, void 0, void 0, function* () {
5834
5969
  if (typeof messageId === 'undefined') {
5835
5970
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5875,8 +6010,8 @@
5875
6010
  if (typeof badge !== 'undefined') {
5876
6011
  payload['badge'] = badge;
5877
6012
  }
5878
- if (typeof status !== 'undefined') {
5879
- payload['status'] = status;
6013
+ if (typeof draft !== 'undefined') {
6014
+ payload['draft'] = draft;
5880
6015
  }
5881
6016
  if (typeof scheduledAt !== 'undefined') {
5882
6017
  payload['scheduledAt'] = scheduledAt;
@@ -5888,7 +6023,7 @@
5888
6023
  });
5889
6024
  }
5890
6025
  /**
5891
- * Create an SMS
6026
+ * Create SMS
5892
6027
  *
5893
6028
  * Create a new SMS message.
5894
6029
  *
@@ -5897,12 +6032,12 @@
5897
6032
  * @param {string[]} topics
5898
6033
  * @param {string[]} users
5899
6034
  * @param {string[]} targets
5900
- * @param {MessageStatus} status
6035
+ * @param {boolean} draft
5901
6036
  * @param {string} scheduledAt
5902
6037
  * @throws {AppwriteException}
5903
6038
  * @returns {Promise}
5904
6039
  */
5905
- createSms(messageId, content, topics, users, targets, status, scheduledAt) {
6040
+ createSms(messageId, content, topics, users, targets, draft, scheduledAt) {
5906
6041
  return __awaiter(this, void 0, void 0, function* () {
5907
6042
  if (typeof messageId === 'undefined') {
5908
6043
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5927,8 +6062,8 @@
5927
6062
  if (typeof targets !== 'undefined') {
5928
6063
  payload['targets'] = targets;
5929
6064
  }
5930
- if (typeof status !== 'undefined') {
5931
- payload['status'] = status;
6065
+ if (typeof draft !== 'undefined') {
6066
+ payload['draft'] = draft;
5932
6067
  }
5933
6068
  if (typeof scheduledAt !== 'undefined') {
5934
6069
  payload['scheduledAt'] = scheduledAt;
@@ -5940,7 +6075,7 @@
5940
6075
  });
5941
6076
  }
5942
6077
  /**
5943
- * Update an SMS
6078
+ * Update SMS
5944
6079
  *
5945
6080
  * Update an email message by its unique ID.
5946
6081
  *
@@ -5950,12 +6085,12 @@
5950
6085
  * @param {string[]} users
5951
6086
  * @param {string[]} targets
5952
6087
  * @param {string} content
5953
- * @param {MessageStatus} status
6088
+ * @param {boolean} draft
5954
6089
  * @param {string} scheduledAt
5955
6090
  * @throws {AppwriteException}
5956
6091
  * @returns {Promise}
5957
6092
  */
5958
- updateSms(messageId, topics, users, targets, content, status, scheduledAt) {
6093
+ updateSms(messageId, topics, users, targets, content, draft, scheduledAt) {
5959
6094
  return __awaiter(this, void 0, void 0, function* () {
5960
6095
  if (typeof messageId === 'undefined') {
5961
6096
  throw new AppwriteException('Missing required parameter: "messageId"');
@@ -5974,8 +6109,8 @@
5974
6109
  if (typeof content !== 'undefined') {
5975
6110
  payload['content'] = content;
5976
6111
  }
5977
- if (typeof status !== 'undefined') {
5978
- payload['status'] = status;
6112
+ if (typeof draft !== 'undefined') {
6113
+ payload['draft'] = draft;
5979
6114
  }
5980
6115
  if (typeof scheduledAt !== 'undefined') {
5981
6116
  payload['scheduledAt'] = scheduledAt;
@@ -5987,7 +6122,7 @@
5987
6122
  });
5988
6123
  }
5989
6124
  /**
5990
- * Get a message
6125
+ * Get message
5991
6126
  *
5992
6127
  * Get a message by its unique ID.
5993
6128
  *
@@ -6010,8 +6145,10 @@
6010
6145
  });
6011
6146
  }
6012
6147
  /**
6013
- * Delete a message
6148
+ * Delete message
6014
6149
  *
6150
+ * Delete a message. If the message is not a draft or scheduled, but has been
6151
+ * sent, this will not recall the message.
6015
6152
  *
6016
6153
  * @param {string} messageId
6017
6154
  * @throws {AppwriteException}
@@ -6503,6 +6640,7 @@
6503
6640
  /**
6504
6641
  * Create Sendgrid provider
6505
6642
  *
6643
+ * Create a new Sendgrid provider.
6506
6644
  *
6507
6645
  * @param {string} providerId
6508
6646
  * @param {string} name
@@ -7246,7 +7384,7 @@
7246
7384
  });
7247
7385
  }
7248
7386
  /**
7249
- * Create a topic
7387
+ * Create topic
7250
7388
  *
7251
7389
  * Create a new topic.
7252
7390
  *
@@ -7282,7 +7420,7 @@
7282
7420
  });
7283
7421
  }
7284
7422
  /**
7285
- * Get a topic
7423
+ * Get topic
7286
7424
  *
7287
7425
  * Get a topic by its unique ID.
7288
7426
  *
@@ -7305,7 +7443,7 @@
7305
7443
  });
7306
7444
  }
7307
7445
  /**
7308
- * Update a topic
7446
+ * Update topic
7309
7447
  *
7310
7448
  * Update a topic by its unique ID.
7311
7449
  *
@@ -7336,7 +7474,7 @@
7336
7474
  });
7337
7475
  }
7338
7476
  /**
7339
- * Delete a topic
7477
+ * Delete topic
7340
7478
  *
7341
7479
  * Delete a topic by its unique ID.
7342
7480
  *
@@ -7414,7 +7552,7 @@
7414
7552
  });
7415
7553
  }
7416
7554
  /**
7417
- * Create a subscriber
7555
+ * Create subscriber
7418
7556
  *
7419
7557
  * Create a new subscriber.
7420
7558
  *
@@ -7450,7 +7588,7 @@
7450
7588
  });
7451
7589
  }
7452
7590
  /**
7453
- * Get a subscriber
7591
+ * Get subscriber
7454
7592
  *
7455
7593
  * Get a subscriber by its unique ID.
7456
7594
  *
@@ -7477,7 +7615,7 @@
7477
7615
  });
7478
7616
  }
7479
7617
  /**
7480
- * Delete a subscriber
7618
+ * Delete subscriber
7481
7619
  *
7482
7620
  * Delete a subscriber by its unique ID.
7483
7621
  *
@@ -8117,7 +8255,7 @@
8117
8255
  super(client);
8118
8256
  }
8119
8257
  /**
8120
- * Get usage stats for a project
8258
+ * Get project usage stats
8121
8259
  *
8122
8260
  *
8123
8261
  * @param {string} startDate
@@ -10385,7 +10523,7 @@
10385
10523
  return uri;
10386
10524
  }
10387
10525
  /**
10388
- * Get usage stats for storage
10526
+ * Get storage usage stats
10389
10527
  *
10390
10528
  *
10391
10529
  * @param {StorageUsageRange} range
@@ -10406,7 +10544,7 @@
10406
10544
  });
10407
10545
  }
10408
10546
  /**
10409
- * Get usage stats for storage bucket
10547
+ * Get bucket usage stats
10410
10548
  *
10411
10549
  *
10412
10550
  * @param {string} bucketId
@@ -11399,7 +11537,7 @@
11399
11537
  });
11400
11538
  }
11401
11539
  /**
11402
- * Get usage stats for the users API
11540
+ * Get users usage stats
11403
11541
  *
11404
11542
  *
11405
11543
  * @param {UserUsageRange} range
@@ -11582,6 +11720,7 @@
11582
11720
  /**
11583
11721
  * Update MFA
11584
11722
  *
11723
+ * Enable or disable MFA on a user account.
11585
11724
  *
11586
11725
  * @param {string} userId
11587
11726
  * @param {boolean} mfa
@@ -11607,15 +11746,42 @@
11607
11746
  }, payload);
11608
11747
  });
11609
11748
  }
11749
+ /**
11750
+ * Delete Authenticator
11751
+ *
11752
+ * Delete an authenticator app.
11753
+ *
11754
+ * @param {string} userId
11755
+ * @param {Type} type
11756
+ * @throws {AppwriteException}
11757
+ * @returns {Promise}
11758
+ */
11759
+ deleteMfaAuthenticator(userId, type) {
11760
+ return __awaiter(this, void 0, void 0, function* () {
11761
+ if (typeof userId === 'undefined') {
11762
+ throw new AppwriteException('Missing required parameter: "userId"');
11763
+ }
11764
+ if (typeof type === 'undefined') {
11765
+ throw new AppwriteException('Missing required parameter: "type"');
11766
+ }
11767
+ const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type);
11768
+ const payload = {};
11769
+ const uri = new URL(this.client.config.endpoint + apiPath);
11770
+ return yield this.client.call('delete', uri, {
11771
+ 'content-type': 'application/json',
11772
+ }, payload);
11773
+ });
11774
+ }
11610
11775
  /**
11611
11776
  * List Factors
11612
11777
  *
11778
+ * List the factors available on the account to be used as a MFA challange.
11613
11779
  *
11614
11780
  * @param {string} userId
11615
11781
  * @throws {AppwriteException}
11616
11782
  * @returns {Promise}
11617
11783
  */
11618
- listFactors(userId) {
11784
+ listMfaFactors(userId) {
11619
11785
  return __awaiter(this, void 0, void 0, function* () {
11620
11786
  if (typeof userId === 'undefined') {
11621
11787
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -11629,33 +11795,76 @@
11629
11795
  });
11630
11796
  }
11631
11797
  /**
11632
- * Delete Authenticator
11798
+ * Get MFA Recovery Codes
11633
11799
  *
11800
+ * Get recovery codes that can be used as backup for MFA flow by User ID.
11801
+ * Before getting codes, they must be generated using
11802
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
11803
+ * method.
11634
11804
  *
11635
11805
  * @param {string} userId
11636
- * @param {AuthenticatorType} type
11637
- * @param {string} otp
11638
11806
  * @throws {AppwriteException}
11639
11807
  * @returns {Promise}
11640
11808
  */
11641
- deleteAuthenticator(userId, type, otp) {
11809
+ getMfaRecoveryCodes(userId) {
11642
11810
  return __awaiter(this, void 0, void 0, function* () {
11643
11811
  if (typeof userId === 'undefined') {
11644
11812
  throw new AppwriteException('Missing required parameter: "userId"');
11645
11813
  }
11646
- if (typeof type === 'undefined') {
11647
- throw new AppwriteException('Missing required parameter: "type"');
11648
- }
11649
- if (typeof otp === 'undefined') {
11650
- throw new AppwriteException('Missing required parameter: "otp"');
11814
+ const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
11815
+ const payload = {};
11816
+ const uri = new URL(this.client.config.endpoint + apiPath);
11817
+ return yield this.client.call('get', uri, {
11818
+ 'content-type': 'application/json',
11819
+ }, payload);
11820
+ });
11821
+ }
11822
+ /**
11823
+ * Regenerate MFA Recovery Codes
11824
+ *
11825
+ * Regenerate recovery codes that can be used as backup for MFA flow by User
11826
+ * ID. Before regenerating codes, they must be first generated using
11827
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
11828
+ * method.
11829
+ *
11830
+ * @param {string} userId
11831
+ * @throws {AppwriteException}
11832
+ * @returns {Promise}
11833
+ */
11834
+ updateMfaRecoveryCodes(userId) {
11835
+ return __awaiter(this, void 0, void 0, function* () {
11836
+ if (typeof userId === 'undefined') {
11837
+ throw new AppwriteException('Missing required parameter: "userId"');
11651
11838
  }
11652
- const apiPath = '/users/{userId}/mfa/{type}'.replace('{userId}', userId).replace('{type}', type);
11839
+ const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
11653
11840
  const payload = {};
11654
- if (typeof otp !== 'undefined') {
11655
- payload['otp'] = otp;
11841
+ const uri = new URL(this.client.config.endpoint + apiPath);
11842
+ return yield this.client.call('put', uri, {
11843
+ 'content-type': 'application/json',
11844
+ }, payload);
11845
+ });
11846
+ }
11847
+ /**
11848
+ * Create MFA Recovery Codes
11849
+ *
11850
+ * Generate recovery codes used as backup for MFA flow for User ID. Recovery
11851
+ * codes can be used as a MFA verification type in
11852
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
11853
+ * method by client SDK.
11854
+ *
11855
+ * @param {string} userId
11856
+ * @throws {AppwriteException}
11857
+ * @returns {Promise}
11858
+ */
11859
+ createMfaRecoveryCodes(userId) {
11860
+ return __awaiter(this, void 0, void 0, function* () {
11861
+ if (typeof userId === 'undefined') {
11862
+ throw new AppwriteException('Missing required parameter: "userId"');
11656
11863
  }
11864
+ const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
11865
+ const payload = {};
11657
11866
  const uri = new URL(this.client.config.endpoint + apiPath);
11658
- return yield this.client.call('delete', uri, {
11867
+ return yield this.client.call('patch', uri, {
11659
11868
  'content-type': 'application/json',
11660
11869
  }, payload);
11661
11870
  });
@@ -11930,6 +12139,7 @@
11930
12139
  /**
11931
12140
  * List User Targets
11932
12141
  *
12142
+ * List the messaging targets that are associated with a user.
11933
12143
  *
11934
12144
  * @param {string} userId
11935
12145
  * @param {string[]} queries
@@ -11955,6 +12165,7 @@
11955
12165
  /**
11956
12166
  * Create User Target
11957
12167
  *
12168
+ * Create a messaging target.
11958
12169
  *
11959
12170
  * @param {string} userId
11960
12171
  * @param {string} targetId
@@ -12005,6 +12216,7 @@
12005
12216
  /**
12006
12217
  * Get User Target
12007
12218
  *
12219
+ * Get a user's push notification target by ID.
12008
12220
  *
12009
12221
  * @param {string} userId
12010
12222
  * @param {string} targetId
@@ -12030,6 +12242,7 @@
12030
12242
  /**
12031
12243
  * Update User target
12032
12244
  *
12245
+ * Update a messaging target.
12033
12246
  *
12034
12247
  * @param {string} userId
12035
12248
  * @param {string} targetId
@@ -12067,6 +12280,7 @@
12067
12280
  /**
12068
12281
  * Delete user target
12069
12282
  *
12283
+ * Delete a messaging target.
12070
12284
  *
12071
12285
  * @param {string} userId
12072
12286
  * @param {string} targetId
@@ -12548,17 +12762,18 @@
12548
12762
  }
12549
12763
  }
12550
12764
 
12551
- exports.AuthenticationFactor = void 0;
12552
- (function (AuthenticationFactor) {
12553
- AuthenticationFactor["Totp"] = "totp";
12554
- AuthenticationFactor["Phone"] = "phone";
12555
- AuthenticationFactor["Email"] = "email";
12556
- })(exports.AuthenticationFactor || (exports.AuthenticationFactor = {}));
12765
+ exports.Type = void 0;
12766
+ (function (Type) {
12767
+ Type["Totp"] = "totp";
12768
+ })(exports.Type || (exports.Type = {}));
12557
12769
 
12558
- exports.AuthenticatorType = void 0;
12559
- (function (AuthenticatorType) {
12560
- AuthenticatorType["Totp"] = "totp";
12561
- })(exports.AuthenticatorType || (exports.AuthenticatorType = {}));
12770
+ exports.Factor = void 0;
12771
+ (function (Factor) {
12772
+ Factor["Email"] = "email";
12773
+ Factor["Phone"] = "phone";
12774
+ Factor["Totp"] = "totp";
12775
+ Factor["Recoverycode"] = "recoverycode";
12776
+ })(exports.Factor || (exports.Factor = {}));
12562
12777
 
12563
12778
  exports.OAuthProvider = void 0;
12564
12779
  (function (OAuthProvider) {
@@ -12866,7 +13081,6 @@
12866
13081
  IndexType["Key"] = "key";
12867
13082
  IndexType["Fulltext"] = "fulltext";
12868
13083
  IndexType["Unique"] = "unique";
12869
- IndexType["Spatial"] = "spatial";
12870
13084
  })(exports.IndexType || (exports.IndexType = {}));
12871
13085
 
12872
13086
  exports.Runtime = void 0;
@@ -12942,13 +13156,6 @@
12942
13156
  Name["Hamsterv1"] = "hamsterv1";
12943
13157
  })(exports.Name || (exports.Name = {}));
12944
13158
 
12945
- exports.MessageStatus = void 0;
12946
- (function (MessageStatus) {
12947
- MessageStatus["Draft"] = "draft";
12948
- MessageStatus["Scheduled"] = "scheduled";
12949
- MessageStatus["Processing"] = "processing";
12950
- })(exports.MessageStatus || (exports.MessageStatus = {}));
12951
-
12952
13159
  exports.SmtpEncryption = void 0;
12953
13160
  (function (SmtpEncryption) {
12954
13161
  SmtpEncryption["None"] = "none";