react-native-appwrite 0.11.0 → 0.13.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 (129) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1854 -1121
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1854 -1122
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-password-session.md +4 -4
  7. package/docs/examples/account/create-email-token.md +5 -5
  8. package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
  9. package/docs/examples/account/create-mfa-authenticator.md +3 -3
  10. package/docs/examples/account/create-mfa-challenge.md +3 -3
  11. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  12. package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
  13. package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
  14. package/docs/examples/account/create-phone-token.md +4 -4
  15. package/docs/examples/account/create-push-target.md +5 -5
  16. package/docs/examples/account/create-recovery.md +4 -4
  17. package/docs/examples/account/create-session.md +4 -4
  18. package/docs/examples/account/create-verification.md +3 -3
  19. package/docs/examples/account/create.md +6 -6
  20. package/docs/examples/account/delete-identity.md +3 -3
  21. package/docs/examples/account/delete-mfa-authenticator.md +3 -3
  22. package/docs/examples/account/delete-push-target.md +3 -3
  23. package/docs/examples/account/delete-session.md +3 -3
  24. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  25. package/docs/examples/account/get-session.md +3 -3
  26. package/docs/examples/account/list-identities.md +3 -3
  27. package/docs/examples/account/list-logs.md +3 -3
  28. package/docs/examples/account/list-mfa-factors.md +1 -1
  29. package/docs/examples/account/update-email.md +4 -4
  30. package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
  31. package/docs/examples/account/update-mfa-authenticator.md +4 -4
  32. package/docs/examples/account/update-mfa-challenge.md +4 -4
  33. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  34. package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
  35. package/docs/examples/account/update-name.md +3 -3
  36. package/docs/examples/account/update-password.md +4 -4
  37. package/docs/examples/account/update-phone-session.md +4 -4
  38. package/docs/examples/account/update-phone-verification.md +4 -4
  39. package/docs/examples/account/update-phone.md +4 -4
  40. package/docs/examples/account/update-prefs.md +7 -3
  41. package/docs/examples/account/update-push-target.md +4 -4
  42. package/docs/examples/account/update-recovery.md +5 -5
  43. package/docs/examples/account/update-session.md +3 -3
  44. package/docs/examples/account/update-verification.md +4 -4
  45. package/docs/examples/avatars/get-browser.md +6 -6
  46. package/docs/examples/avatars/get-credit-card.md +6 -6
  47. package/docs/examples/avatars/get-favicon.md +3 -3
  48. package/docs/examples/avatars/get-flag.md +6 -6
  49. package/docs/examples/avatars/get-image.md +5 -5
  50. package/docs/examples/avatars/get-initials.md +6 -6
  51. package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
  52. package/docs/examples/databases/create-document.md +13 -7
  53. package/docs/examples/databases/decrement-document-attribute.md +8 -8
  54. package/docs/examples/databases/delete-document.md +5 -5
  55. package/docs/examples/databases/get-document.md +6 -6
  56. package/docs/examples/databases/increment-document-attribute.md +8 -8
  57. package/docs/examples/databases/list-documents.md +5 -5
  58. package/docs/examples/databases/update-document.md +7 -7
  59. package/docs/examples/databases/upsert-document.md +7 -7
  60. package/docs/examples/functions/create-execution.md +9 -9
  61. package/docs/examples/functions/get-execution.md +4 -4
  62. package/docs/examples/functions/list-executions.md +4 -4
  63. package/docs/examples/graphql/mutation.md +3 -3
  64. package/docs/examples/graphql/query.md +3 -3
  65. package/docs/examples/messaging/create-subscriber.md +5 -5
  66. package/docs/examples/messaging/delete-subscriber.md +4 -4
  67. package/docs/examples/storage/create-file.md +6 -6
  68. package/docs/examples/storage/delete-file.md +4 -4
  69. package/docs/examples/storage/get-file-download.md +5 -5
  70. package/docs/examples/storage/get-file-preview.md +16 -16
  71. package/docs/examples/storage/get-file-view.md +5 -5
  72. package/docs/examples/storage/get-file.md +4 -4
  73. package/docs/examples/storage/list-files.md +5 -5
  74. package/docs/examples/storage/update-file.md +6 -6
  75. package/docs/examples/tablesdb/create-row.md +23 -0
  76. package/docs/examples/tablesdb/decrement-row-column.md +18 -0
  77. package/docs/examples/tablesdb/delete-row.md +15 -0
  78. package/docs/examples/tablesdb/get-row.md +16 -0
  79. package/docs/examples/tablesdb/increment-row-column.md +18 -0
  80. package/docs/examples/tablesdb/list-rows.md +15 -0
  81. package/docs/examples/tablesdb/update-row.md +17 -0
  82. package/docs/examples/tablesdb/upsert-row.md +17 -0
  83. package/docs/examples/teams/create-membership.md +9 -9
  84. package/docs/examples/teams/create.md +5 -5
  85. package/docs/examples/teams/delete-membership.md +4 -4
  86. package/docs/examples/teams/delete.md +3 -3
  87. package/docs/examples/teams/get-membership.md +4 -4
  88. package/docs/examples/teams/get-prefs.md +3 -3
  89. package/docs/examples/teams/get.md +3 -3
  90. package/docs/examples/teams/list-memberships.md +5 -5
  91. package/docs/examples/teams/list.md +4 -4
  92. package/docs/examples/teams/update-membership-status.md +6 -6
  93. package/docs/examples/teams/update-membership.md +5 -5
  94. package/docs/examples/teams/update-name.md +4 -4
  95. package/docs/examples/teams/update-prefs.md +4 -4
  96. package/package.json +1 -1
  97. package/src/client.ts +2 -2
  98. package/src/enums/credit-card.ts +1 -1
  99. package/src/enums/execution-method.ts +1 -0
  100. package/src/index.ts +1 -0
  101. package/src/models.ts +72 -27
  102. package/src/query.ts +247 -4
  103. package/src/services/account.ts +1469 -315
  104. package/src/services/avatars.ts +289 -80
  105. package/src/services/databases.ts +345 -63
  106. package/src/services/functions.ts +115 -20
  107. package/src/services/graphql.ts +52 -4
  108. package/src/services/locale.ts +8 -19
  109. package/src/services/messaging.ts +66 -7
  110. package/src/services/storage.ts +345 -76
  111. package/src/services/tables-db.ts +621 -0
  112. package/src/services/teams.ts +454 -93
  113. package/types/enums/credit-card.d.ts +1 -1
  114. package/types/enums/execution-method.d.ts +2 -1
  115. package/types/index.d.ts +1 -0
  116. package/types/models.d.ts +69 -25
  117. package/types/query.d.ts +201 -4
  118. package/types/services/account.d.ts +734 -280
  119. package/types/services/avatars.d.ts +168 -73
  120. package/types/services/databases.d.ts +199 -58
  121. package/types/services/functions.d.ts +62 -17
  122. package/types/services/graphql.d.ts +24 -2
  123. package/types/services/locale.d.ts +8 -19
  124. package/types/services/messaging.d.ts +33 -5
  125. package/types/services/storage.d.ts +201 -68
  126. package/types/services/tables-db.d.ts +245 -0
  127. package/types/services/teams.d.ts +242 -80
  128. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  129. /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
package/dist/cjs/sdk.js CHANGED
@@ -100,8 +100,8 @@ class Client {
100
100
  'x-sdk-name': 'React Native',
101
101
  'x-sdk-platform': 'client',
102
102
  'x-sdk-language': 'reactnative',
103
- 'x-sdk-version': '0.11.0',
104
- 'X-Appwrite-Response-Format': '1.7.0',
103
+ 'x-sdk-version': '0.13.0',
104
+ 'X-Appwrite-Response-Format': '1.8.0',
105
105
  };
106
106
  this.realtime = {
107
107
  socket: undefined,
@@ -492,23 +492,23 @@ class Account extends Service {
492
492
  const uri = new URL(this.client.config.endpoint + apiPath);
493
493
  return this.client.call('get', uri, {}, payload);
494
494
  }
495
- /**
496
- * Use this endpoint to allow a new user to register a new account in your
497
- * project. After the user registration completes successfully, you can use
498
- * the
499
- * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
500
- * route to start verifying the user email address. To allow the new user to
501
- * login to their new account, you need to create a new [account
502
- * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
503
- *
504
- * @param {string} userId
505
- * @param {string} email
506
- * @param {string} password
507
- * @param {string} name
508
- * @throws {AppwriteException}
509
- * @returns {Promise}
510
- */
511
- create(userId, email, password, name) {
495
+ create(paramsOrFirst, ...rest) {
496
+ let params;
497
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
498
+ params = (paramsOrFirst || {});
499
+ }
500
+ else {
501
+ params = {
502
+ userId: paramsOrFirst,
503
+ email: rest[0],
504
+ password: rest[1],
505
+ name: rest[2]
506
+ };
507
+ }
508
+ const userId = params.userId;
509
+ const email = params.email;
510
+ const password = params.password;
511
+ const name = params.name;
512
512
  if (typeof userId === 'undefined') {
513
513
  throw new AppwriteException('Missing required parameter: "userId"');
514
514
  }
@@ -537,22 +537,19 @@ class Account extends Service {
537
537
  'content-type': 'application/json',
538
538
  }, payload);
539
539
  }
540
- /**
541
- * Update currently logged in user account email address. After changing user
542
- * address, the user confirmation status will get reset. A new confirmation
543
- * email is not sent automatically however you can use the send confirmation
544
- * email endpoint again to send the confirmation email. For security measures,
545
- * user password is required to complete this request.
546
- * This endpoint can also be used to convert an anonymous account to a normal
547
- * one, by passing an email address and a new password.
548
- *
549
- *
550
- * @param {string} email
551
- * @param {string} password
552
- * @throws {AppwriteException}
553
- * @returns {Promise}
554
- */
555
- updateEmail(email, password) {
540
+ updateEmail(paramsOrFirst, ...rest) {
541
+ let params;
542
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
543
+ params = (paramsOrFirst || {});
544
+ }
545
+ else {
546
+ params = {
547
+ email: paramsOrFirst,
548
+ password: rest[0]
549
+ };
550
+ }
551
+ const email = params.email;
552
+ const password = params.password;
556
553
  if (typeof email === 'undefined') {
557
554
  throw new AppwriteException('Missing required parameter: "email"');
558
555
  }
@@ -572,14 +569,17 @@ class Account extends Service {
572
569
  'content-type': 'application/json',
573
570
  }, payload);
574
571
  }
575
- /**
576
- * Get the list of identities for the currently logged in user.
577
- *
578
- * @param {string[]} queries
579
- * @throws {AppwriteException}
580
- * @returns {Promise}
581
- */
582
- listIdentities(queries) {
572
+ listIdentities(paramsOrFirst) {
573
+ let params;
574
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
575
+ params = (paramsOrFirst || {});
576
+ }
577
+ else {
578
+ params = {
579
+ queries: paramsOrFirst
580
+ };
581
+ }
582
+ const queries = params.queries;
583
583
  const apiPath = '/account/identities';
584
584
  const payload = {};
585
585
  if (typeof queries !== 'undefined') {
@@ -588,14 +588,17 @@ class Account extends Service {
588
588
  const uri = new URL(this.client.config.endpoint + apiPath);
589
589
  return this.client.call('get', uri, {}, payload);
590
590
  }
591
- /**
592
- * Delete an identity by its unique ID.
593
- *
594
- * @param {string} identityId
595
- * @throws {AppwriteException}
596
- * @returns {Promise}
597
- */
598
- deleteIdentity(identityId) {
591
+ deleteIdentity(paramsOrFirst) {
592
+ let params;
593
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
594
+ params = (paramsOrFirst || {});
595
+ }
596
+ else {
597
+ params = {
598
+ identityId: paramsOrFirst
599
+ };
600
+ }
601
+ const identityId = params.identityId;
599
602
  if (typeof identityId === 'undefined') {
600
603
  throw new AppwriteException('Missing required parameter: "identityId"');
601
604
  }
@@ -607,11 +610,7 @@ class Account extends Service {
607
610
  }, payload);
608
611
  }
609
612
  /**
610
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
611
- * to authenticate on behalf of the current user when working with the
612
- * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
613
- * from its creation and will be invalid if the user will logout in that time
614
- * frame.
613
+ * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
615
614
  *
616
615
  * @throws {AppwriteException}
617
616
  * @returns {Promise}
@@ -624,15 +623,17 @@ class Account extends Service {
624
623
  'content-type': 'application/json',
625
624
  }, payload);
626
625
  }
627
- /**
628
- * Get the list of latest security activity logs for the currently logged in
629
- * user. Each log returns user IP address, location and date and time of log.
630
- *
631
- * @param {string[]} queries
632
- * @throws {AppwriteException}
633
- * @returns {Promise}
634
- */
635
- listLogs(queries) {
626
+ listLogs(paramsOrFirst) {
627
+ let params;
628
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
629
+ params = (paramsOrFirst || {});
630
+ }
631
+ else {
632
+ params = {
633
+ queries: paramsOrFirst
634
+ };
635
+ }
636
+ const queries = params.queries;
636
637
  const apiPath = '/account/logs';
637
638
  const payload = {};
638
639
  if (typeof queries !== 'undefined') {
@@ -641,14 +642,17 @@ class Account extends Service {
641
642
  const uri = new URL(this.client.config.endpoint + apiPath);
642
643
  return this.client.call('get', uri, {}, payload);
643
644
  }
644
- /**
645
- * Enable or disable MFA on an account.
646
- *
647
- * @param {boolean} mfa
648
- * @throws {AppwriteException}
649
- * @returns {Promise}
650
- */
651
- updateMFA(mfa) {
645
+ updateMFA(paramsOrFirst) {
646
+ let params;
647
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
648
+ params = (paramsOrFirst || {});
649
+ }
650
+ else {
651
+ params = {
652
+ mfa: paramsOrFirst
653
+ };
654
+ }
655
+ const mfa = params.mfa;
652
656
  if (typeof mfa === 'undefined') {
653
657
  throw new AppwriteException('Missing required parameter: "mfa"');
654
658
  }
@@ -662,17 +666,17 @@ class Account extends Service {
662
666
  'content-type': 'application/json',
663
667
  }, payload);
664
668
  }
665
- /**
666
- * Add an authenticator app to be used as an MFA factor. Verify the
667
- * authenticator using the [verify
668
- * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
669
- * method.
670
- *
671
- * @param {AuthenticatorType} type
672
- * @throws {AppwriteException}
673
- * @returns {Promise}
674
- */
675
- createMfaAuthenticator(type) {
669
+ createMfaAuthenticator(paramsOrFirst) {
670
+ let params;
671
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
672
+ params = (paramsOrFirst || {});
673
+ }
674
+ else {
675
+ params = {
676
+ type: paramsOrFirst
677
+ };
678
+ }
679
+ const type = params.type;
676
680
  if (typeof type === 'undefined') {
677
681
  throw new AppwriteException('Missing required parameter: "type"');
678
682
  }
@@ -683,17 +687,40 @@ class Account extends Service {
683
687
  'content-type': 'application/json',
684
688
  }, payload);
685
689
  }
686
- /**
687
- * Verify an authenticator app after adding it using the [add
688
- * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
689
- * method.
690
- *
691
- * @param {AuthenticatorType} type
692
- * @param {string} otp
693
- * @throws {AppwriteException}
694
- * @returns {Promise}
695
- */
696
- updateMfaAuthenticator(type, otp) {
690
+ createMFAAuthenticator(paramsOrFirst) {
691
+ let params;
692
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
693
+ params = (paramsOrFirst || {});
694
+ }
695
+ else {
696
+ params = {
697
+ type: paramsOrFirst
698
+ };
699
+ }
700
+ const type = params.type;
701
+ if (typeof type === 'undefined') {
702
+ throw new AppwriteException('Missing required parameter: "type"');
703
+ }
704
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
705
+ const payload = {};
706
+ const uri = new URL(this.client.config.endpoint + apiPath);
707
+ return this.client.call('post', uri, {
708
+ 'content-type': 'application/json',
709
+ }, payload);
710
+ }
711
+ updateMfaAuthenticator(paramsOrFirst, ...rest) {
712
+ let params;
713
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
714
+ params = (paramsOrFirst || {});
715
+ }
716
+ else {
717
+ params = {
718
+ type: paramsOrFirst,
719
+ otp: rest[0]
720
+ };
721
+ }
722
+ const type = params.type;
723
+ const otp = params.otp;
697
724
  if (typeof type === 'undefined') {
698
725
  throw new AppwriteException('Missing required parameter: "type"');
699
726
  }
@@ -710,14 +737,46 @@ class Account extends Service {
710
737
  'content-type': 'application/json',
711
738
  }, payload);
712
739
  }
713
- /**
714
- * Delete an authenticator for a user by ID.
715
- *
716
- * @param {AuthenticatorType} type
717
- * @throws {AppwriteException}
718
- * @returns {Promise}
719
- */
720
- deleteMfaAuthenticator(type) {
740
+ updateMFAAuthenticator(paramsOrFirst, ...rest) {
741
+ let params;
742
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
743
+ params = (paramsOrFirst || {});
744
+ }
745
+ else {
746
+ params = {
747
+ type: paramsOrFirst,
748
+ otp: rest[0]
749
+ };
750
+ }
751
+ const type = params.type;
752
+ const otp = params.otp;
753
+ if (typeof type === 'undefined') {
754
+ throw new AppwriteException('Missing required parameter: "type"');
755
+ }
756
+ if (typeof otp === 'undefined') {
757
+ throw new AppwriteException('Missing required parameter: "otp"');
758
+ }
759
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
760
+ const payload = {};
761
+ if (typeof otp !== 'undefined') {
762
+ payload['otp'] = otp;
763
+ }
764
+ const uri = new URL(this.client.config.endpoint + apiPath);
765
+ return this.client.call('put', uri, {
766
+ 'content-type': 'application/json',
767
+ }, payload);
768
+ }
769
+ deleteMfaAuthenticator(paramsOrFirst) {
770
+ let params;
771
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
772
+ params = (paramsOrFirst || {});
773
+ }
774
+ else {
775
+ params = {
776
+ type: paramsOrFirst
777
+ };
778
+ }
779
+ const type = params.type;
721
780
  if (typeof type === 'undefined') {
722
781
  throw new AppwriteException('Missing required parameter: "type"');
723
782
  }
@@ -728,16 +787,38 @@ class Account extends Service {
728
787
  'content-type': 'application/json',
729
788
  }, payload);
730
789
  }
731
- /**
732
- * Begin the process of MFA verification after sign-in. Finish the flow with
733
- * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
734
- * method.
735
- *
736
- * @param {AuthenticationFactor} factor
737
- * @throws {AppwriteException}
738
- * @returns {Promise}
739
- */
740
- createMfaChallenge(factor) {
790
+ deleteMFAAuthenticator(paramsOrFirst) {
791
+ let params;
792
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
793
+ params = (paramsOrFirst || {});
794
+ }
795
+ else {
796
+ params = {
797
+ type: paramsOrFirst
798
+ };
799
+ }
800
+ const type = params.type;
801
+ if (typeof type === 'undefined') {
802
+ throw new AppwriteException('Missing required parameter: "type"');
803
+ }
804
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
805
+ const payload = {};
806
+ const uri = new URL(this.client.config.endpoint + apiPath);
807
+ return this.client.call('delete', uri, {
808
+ 'content-type': 'application/json',
809
+ }, payload);
810
+ }
811
+ createMfaChallenge(paramsOrFirst) {
812
+ let params;
813
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
814
+ params = (paramsOrFirst || {});
815
+ }
816
+ else {
817
+ params = {
818
+ factor: paramsOrFirst
819
+ };
820
+ }
821
+ const factor = params.factor;
741
822
  if (typeof factor === 'undefined') {
742
823
  throw new AppwriteException('Missing required parameter: "factor"');
743
824
  }
@@ -751,19 +832,75 @@ class Account extends Service {
751
832
  'content-type': 'application/json',
752
833
  }, payload);
753
834
  }
754
- /**
755
- * Complete the MFA challenge by providing the one-time password. Finish the
756
- * process of MFA verification by providing the one-time password. To begin
757
- * the flow, use
758
- * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
759
- * method.
760
- *
761
- * @param {string} challengeId
762
- * @param {string} otp
763
- * @throws {AppwriteException}
764
- * @returns {Promise}
765
- */
766
- updateMfaChallenge(challengeId, otp) {
835
+ createMFAChallenge(paramsOrFirst) {
836
+ let params;
837
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
838
+ params = (paramsOrFirst || {});
839
+ }
840
+ else {
841
+ params = {
842
+ factor: paramsOrFirst
843
+ };
844
+ }
845
+ const factor = params.factor;
846
+ if (typeof factor === 'undefined') {
847
+ throw new AppwriteException('Missing required parameter: "factor"');
848
+ }
849
+ const apiPath = '/account/mfa/challenge';
850
+ const payload = {};
851
+ if (typeof factor !== 'undefined') {
852
+ payload['factor'] = factor;
853
+ }
854
+ const uri = new URL(this.client.config.endpoint + apiPath);
855
+ return this.client.call('post', uri, {
856
+ 'content-type': 'application/json',
857
+ }, payload);
858
+ }
859
+ updateMfaChallenge(paramsOrFirst, ...rest) {
860
+ let params;
861
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
862
+ params = (paramsOrFirst || {});
863
+ }
864
+ else {
865
+ params = {
866
+ challengeId: paramsOrFirst,
867
+ otp: rest[0]
868
+ };
869
+ }
870
+ const challengeId = params.challengeId;
871
+ const otp = params.otp;
872
+ if (typeof challengeId === 'undefined') {
873
+ throw new AppwriteException('Missing required parameter: "challengeId"');
874
+ }
875
+ if (typeof otp === 'undefined') {
876
+ throw new AppwriteException('Missing required parameter: "otp"');
877
+ }
878
+ const apiPath = '/account/mfa/challenge';
879
+ const payload = {};
880
+ if (typeof challengeId !== 'undefined') {
881
+ payload['challengeId'] = challengeId;
882
+ }
883
+ if (typeof otp !== 'undefined') {
884
+ payload['otp'] = otp;
885
+ }
886
+ const uri = new URL(this.client.config.endpoint + apiPath);
887
+ return this.client.call('put', uri, {
888
+ 'content-type': 'application/json',
889
+ }, payload);
890
+ }
891
+ updateMFAChallenge(paramsOrFirst, ...rest) {
892
+ let params;
893
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
894
+ params = (paramsOrFirst || {});
895
+ }
896
+ else {
897
+ params = {
898
+ challengeId: paramsOrFirst,
899
+ otp: rest[0]
900
+ };
901
+ }
902
+ const challengeId = params.challengeId;
903
+ const otp = params.otp;
767
904
  if (typeof challengeId === 'undefined') {
768
905
  throw new AppwriteException('Missing required parameter: "challengeId"');
769
906
  }
@@ -788,6 +925,7 @@ class Account extends Service {
788
925
  *
789
926
  * @throws {AppwriteException}
790
927
  * @returns {Promise}
928
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
791
929
  */
792
930
  listMfaFactors() {
793
931
  const apiPath = '/account/mfa/factors';
@@ -796,13 +934,23 @@ class Account extends Service {
796
934
  return this.client.call('get', uri, {}, payload);
797
935
  }
798
936
  /**
799
- * Get recovery codes that can be used as backup for MFA flow. Before getting
800
- * codes, they must be generated using
801
- * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
802
- * method. An OTP challenge is required to read recovery codes.
937
+ * List the factors available on the account to be used as a MFA challange.
938
+ *
939
+ * @throws {AppwriteException}
940
+ * @returns {Promise}
941
+ */
942
+ listMFAFactors() {
943
+ const apiPath = '/account/mfa/factors';
944
+ const payload = {};
945
+ const uri = new URL(this.client.config.endpoint + apiPath);
946
+ return this.client.call('get', uri, {}, payload);
947
+ }
948
+ /**
949
+ * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
803
950
  *
804
951
  * @throws {AppwriteException}
805
952
  * @returns {Promise}
953
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
806
954
  */
807
955
  getMfaRecoveryCodes() {
808
956
  const apiPath = '/account/mfa/recovery-codes';
@@ -811,14 +959,23 @@ class Account extends Service {
811
959
  return this.client.call('get', uri, {}, payload);
812
960
  }
813
961
  /**
814
- * Generate recovery codes as backup for MFA flow. It's recommended to
815
- * generate and show then immediately after user successfully adds their
816
- * authehticator. Recovery codes can be used as a MFA verification type in
817
- * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
818
- * method.
962
+ * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
963
+ *
964
+ * @throws {AppwriteException}
965
+ * @returns {Promise}
966
+ */
967
+ getMFARecoveryCodes() {
968
+ const apiPath = '/account/mfa/recovery-codes';
969
+ const payload = {};
970
+ const uri = new URL(this.client.config.endpoint + apiPath);
971
+ return this.client.call('get', uri, {}, payload);
972
+ }
973
+ /**
974
+ * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
819
975
  *
820
976
  * @throws {AppwriteException}
821
977
  * @returns {Promise}
978
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
822
979
  */
823
980
  createMfaRecoveryCodes() {
824
981
  const apiPath = '/account/mfa/recovery-codes';
@@ -829,13 +986,25 @@ class Account extends Service {
829
986
  }, payload);
830
987
  }
831
988
  /**
832
- * Regenerate recovery codes that can be used as backup for MFA flow. Before
833
- * regenerating codes, they must be first generated using
834
- * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
835
- * method. An OTP challenge is required to regenreate recovery codes.
989
+ * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
990
+ *
991
+ * @throws {AppwriteException}
992
+ * @returns {Promise}
993
+ */
994
+ createMFARecoveryCodes() {
995
+ const apiPath = '/account/mfa/recovery-codes';
996
+ const payload = {};
997
+ const uri = new URL(this.client.config.endpoint + apiPath);
998
+ return this.client.call('post', uri, {
999
+ 'content-type': 'application/json',
1000
+ }, payload);
1001
+ }
1002
+ /**
1003
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
836
1004
  *
837
1005
  * @throws {AppwriteException}
838
1006
  * @returns {Promise}
1007
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
839
1008
  */
840
1009
  updateMfaRecoveryCodes() {
841
1010
  const apiPath = '/account/mfa/recovery-codes';
@@ -846,13 +1015,30 @@ class Account extends Service {
846
1015
  }, payload);
847
1016
  }
848
1017
  /**
849
- * Update currently logged in user account name.
1018
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
850
1019
  *
851
- * @param {string} name
852
1020
  * @throws {AppwriteException}
853
1021
  * @returns {Promise}
854
1022
  */
855
- updateName(name) {
1023
+ updateMFARecoveryCodes() {
1024
+ const apiPath = '/account/mfa/recovery-codes';
1025
+ const payload = {};
1026
+ const uri = new URL(this.client.config.endpoint + apiPath);
1027
+ return this.client.call('patch', uri, {
1028
+ 'content-type': 'application/json',
1029
+ }, payload);
1030
+ }
1031
+ updateName(paramsOrFirst) {
1032
+ let params;
1033
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1034
+ params = (paramsOrFirst || {});
1035
+ }
1036
+ else {
1037
+ params = {
1038
+ name: paramsOrFirst
1039
+ };
1040
+ }
1041
+ const name = params.name;
856
1042
  if (typeof name === 'undefined') {
857
1043
  throw new AppwriteException('Missing required parameter: "name"');
858
1044
  }
@@ -866,17 +1052,19 @@ class Account extends Service {
866
1052
  'content-type': 'application/json',
867
1053
  }, payload);
868
1054
  }
869
- /**
870
- * Update currently logged in user password. For validation, user is required
871
- * to pass in the new password, and the old password. For users created with
872
- * OAuth, Team Invites and Magic URL, oldPassword is optional.
873
- *
874
- * @param {string} password
875
- * @param {string} oldPassword
876
- * @throws {AppwriteException}
877
- * @returns {Promise}
878
- */
879
- updatePassword(password, oldPassword) {
1055
+ updatePassword(paramsOrFirst, ...rest) {
1056
+ let params;
1057
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1058
+ params = (paramsOrFirst || {});
1059
+ }
1060
+ else {
1061
+ params = {
1062
+ password: paramsOrFirst,
1063
+ oldPassword: rest[0]
1064
+ };
1065
+ }
1066
+ const password = params.password;
1067
+ const oldPassword = params.oldPassword;
880
1068
  if (typeof password === 'undefined') {
881
1069
  throw new AppwriteException('Missing required parameter: "password"');
882
1070
  }
@@ -893,19 +1081,19 @@ class Account extends Service {
893
1081
  'content-type': 'application/json',
894
1082
  }, payload);
895
1083
  }
896
- /**
897
- * Update the currently logged in user's phone number. After updating the
898
- * phone number, the phone verification status will be reset. A confirmation
899
- * SMS is not sent automatically, however you can use the [POST
900
- * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
901
- * endpoint to send a confirmation SMS.
902
- *
903
- * @param {string} phone
904
- * @param {string} password
905
- * @throws {AppwriteException}
906
- * @returns {Promise}
907
- */
908
- updatePhone(phone, password) {
1084
+ updatePhone(paramsOrFirst, ...rest) {
1085
+ let params;
1086
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1087
+ params = (paramsOrFirst || {});
1088
+ }
1089
+ else {
1090
+ params = {
1091
+ phone: paramsOrFirst,
1092
+ password: rest[0]
1093
+ };
1094
+ }
1095
+ const phone = params.phone;
1096
+ const password = params.password;
909
1097
  if (typeof phone === 'undefined') {
910
1098
  throw new AppwriteException('Missing required parameter: "phone"');
911
1099
  }
@@ -937,16 +1125,17 @@ class Account extends Service {
937
1125
  const uri = new URL(this.client.config.endpoint + apiPath);
938
1126
  return this.client.call('get', uri, {}, payload);
939
1127
  }
940
- /**
941
- * Update currently logged in user account preferences. The object you pass is
942
- * stored as is, and replaces any previous value. The maximum allowed prefs
943
- * size is 64kB and throws error if exceeded.
944
- *
945
- * @param {object} prefs
946
- * @throws {AppwriteException}
947
- * @returns {Promise}
948
- */
949
- updatePrefs(prefs) {
1128
+ updatePrefs(paramsOrFirst) {
1129
+ let params;
1130
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst)) {
1131
+ params = (paramsOrFirst || {});
1132
+ }
1133
+ else {
1134
+ params = {
1135
+ prefs: paramsOrFirst
1136
+ };
1137
+ }
1138
+ const prefs = params.prefs;
950
1139
  if (typeof prefs === 'undefined') {
951
1140
  throw new AppwriteException('Missing required parameter: "prefs"');
952
1141
  }
@@ -960,22 +1149,19 @@ class Account extends Service {
960
1149
  'content-type': 'application/json',
961
1150
  }, payload);
962
1151
  }
963
- /**
964
- * Sends the user an email with a temporary secret key for password reset.
965
- * When the user clicks the confirmation link he is redirected back to your
966
- * app password reset URL with the secret key and email address values
967
- * attached to the URL query string. Use the query string params to submit a
968
- * request to the [PUT
969
- * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
970
- * endpoint to complete the process. The verification link sent to the user's
971
- * email address is valid for 1 hour.
972
- *
973
- * @param {string} email
974
- * @param {string} url
975
- * @throws {AppwriteException}
976
- * @returns {Promise}
977
- */
978
- createRecovery(email, url) {
1152
+ createRecovery(paramsOrFirst, ...rest) {
1153
+ let params;
1154
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1155
+ params = (paramsOrFirst || {});
1156
+ }
1157
+ else {
1158
+ params = {
1159
+ email: paramsOrFirst,
1160
+ url: rest[0]
1161
+ };
1162
+ }
1163
+ const email = params.email;
1164
+ const url = params.url;
979
1165
  if (typeof email === 'undefined') {
980
1166
  throw new AppwriteException('Missing required parameter: "email"');
981
1167
  }
@@ -995,26 +1181,22 @@ class Account extends Service {
995
1181
  'content-type': 'application/json',
996
1182
  }, payload);
997
1183
  }
998
- /**
999
- * Use this endpoint to complete the user account password reset. Both the
1000
- * **userId** and **secret** arguments will be passed as query parameters to
1001
- * the redirect URL you have provided when sending your request to the [POST
1002
- * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
1003
- * endpoint.
1004
- *
1005
- * Please note that in order to avoid a [Redirect
1006
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
1007
- * the only valid redirect URLs are the ones from domains you have set when
1008
- * adding your platforms in the console interface.
1009
- *
1010
- * @param {string} userId
1011
- * @param {string} secret
1012
- * @param {string} password
1013
- * @throws {AppwriteException}
1014
- * @returns {Promise}
1015
- */
1016
- updateRecovery(userId, secret, password) {
1017
- if (typeof userId === 'undefined') {
1184
+ updateRecovery(paramsOrFirst, ...rest) {
1185
+ let params;
1186
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1187
+ params = (paramsOrFirst || {});
1188
+ }
1189
+ else {
1190
+ params = {
1191
+ userId: paramsOrFirst,
1192
+ secret: rest[0],
1193
+ password: rest[1]
1194
+ };
1195
+ }
1196
+ const userId = params.userId;
1197
+ const secret = params.secret;
1198
+ const password = params.password;
1199
+ if (typeof userId === 'undefined') {
1018
1200
  throw new AppwriteException('Missing required parameter: "userId"');
1019
1201
  }
1020
1202
  if (typeof secret === 'undefined') {
@@ -1040,8 +1222,7 @@ class Account extends Service {
1040
1222
  }, payload);
1041
1223
  }
1042
1224
  /**
1043
- * Get the list of active sessions across different devices for the currently
1044
- * logged in user.
1225
+ * Get the list of active sessions across different devices for the currently logged in user.
1045
1226
  *
1046
1227
  * @throws {AppwriteException}
1047
1228
  * @returns {Promise}
@@ -1053,8 +1234,7 @@ class Account extends Service {
1053
1234
  return this.client.call('get', uri, {}, payload);
1054
1235
  }
1055
1236
  /**
1056
- * Delete all sessions from the user account and remove any sessions cookies
1057
- * from the end client.
1237
+ * Delete all sessions from the user account and remove any sessions cookies from the end client.
1058
1238
  *
1059
1239
  * @throws {AppwriteException}
1060
1240
  * @returns {Promise}
@@ -1068,13 +1248,7 @@ class Account extends Service {
1068
1248
  }, payload);
1069
1249
  }
1070
1250
  /**
1071
- * Use this endpoint to allow a new user to register an anonymous account in
1072
- * your project. This route will also create a new session for the user. To
1073
- * allow the new user to convert an anonymous account to a normal account, you
1074
- * need to update its [email and
1075
- * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
1076
- * or create an [OAuth2
1077
- * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
1251
+ * Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
1078
1252
  *
1079
1253
  * @throws {AppwriteException}
1080
1254
  * @returns {Promise}
@@ -1087,20 +1261,19 @@ class Account extends Service {
1087
1261
  'content-type': 'application/json',
1088
1262
  }, payload);
1089
1263
  }
1090
- /**
1091
- * Allow the user to login into their account by providing a valid email and
1092
- * password combination. This route will create a new session for the user.
1093
- *
1094
- * A user is limited to 10 active sessions at a time by default. [Learn more
1095
- * about session
1096
- * limits](https://appwrite.io/docs/authentication-security#limits).
1097
- *
1098
- * @param {string} email
1099
- * @param {string} password
1100
- * @throws {AppwriteException}
1101
- * @returns {Promise}
1102
- */
1103
- createEmailPasswordSession(email, password) {
1264
+ createEmailPasswordSession(paramsOrFirst, ...rest) {
1265
+ let params;
1266
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1267
+ params = (paramsOrFirst || {});
1268
+ }
1269
+ else {
1270
+ params = {
1271
+ email: paramsOrFirst,
1272
+ password: rest[0]
1273
+ };
1274
+ }
1275
+ const email = params.email;
1276
+ const password = params.password;
1104
1277
  if (typeof email === 'undefined') {
1105
1278
  throw new AppwriteException('Missing required parameter: "email"');
1106
1279
  }
@@ -1120,17 +1293,19 @@ class Account extends Service {
1120
1293
  'content-type': 'application/json',
1121
1294
  }, payload);
1122
1295
  }
1123
- /**
1124
- * Use this endpoint to create a session from token. Provide the **userId**
1125
- * and **secret** parameters from the successful response of authentication
1126
- * flows initiated by token creation. For example, magic URL and phone login.
1127
- *
1128
- * @param {string} userId
1129
- * @param {string} secret
1130
- * @throws {AppwriteException}
1131
- * @returns {Promise}
1132
- */
1133
- updateMagicURLSession(userId, secret) {
1296
+ updateMagicURLSession(paramsOrFirst, ...rest) {
1297
+ let params;
1298
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1299
+ params = (paramsOrFirst || {});
1300
+ }
1301
+ else {
1302
+ params = {
1303
+ userId: paramsOrFirst,
1304
+ secret: rest[0]
1305
+ };
1306
+ }
1307
+ const userId = params.userId;
1308
+ const secret = params.secret;
1134
1309
  if (typeof userId === 'undefined') {
1135
1310
  throw new AppwriteException('Missing required parameter: "userId"');
1136
1311
  }
@@ -1150,32 +1325,23 @@ class Account extends Service {
1150
1325
  'content-type': 'application/json',
1151
1326
  }, payload);
1152
1327
  }
1153
- /**
1154
- * Allow the user to login to their account using the OAuth2 provider of their
1155
- * choice. Each OAuth2 provider should be enabled from the Appwrite console
1156
- * first. Use the success and failure arguments to provide a redirect URL's
1157
- * back to your app when login is completed.
1158
- *
1159
- * If there is already an active session, the new session will be attached to
1160
- * the logged-in account. If there are no active sessions, the server will
1161
- * attempt to look for a user with the same email address as the email
1162
- * received from the OAuth2 provider and attach the new session to the
1163
- * existing user. If no matching user is found - the server will create a new
1164
- * user.
1165
- *
1166
- * A user is limited to 10 active sessions at a time by default. [Learn more
1167
- * about session
1168
- * limits](https://appwrite.io/docs/authentication-security#limits).
1169
- *
1170
- *
1171
- * @param {OAuthProvider} provider
1172
- * @param {string} success
1173
- * @param {string} failure
1174
- * @param {string[]} scopes
1175
- * @throws {AppwriteException}
1176
- * @returns {void|string}
1177
- */
1178
- createOAuth2Session(provider, success, failure, scopes) {
1328
+ createOAuth2Session(paramsOrFirst, ...rest) {
1329
+ let params;
1330
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
1331
+ params = (paramsOrFirst || {});
1332
+ }
1333
+ else {
1334
+ params = {
1335
+ provider: paramsOrFirst,
1336
+ success: rest[0],
1337
+ failure: rest[1],
1338
+ scopes: rest[2]
1339
+ };
1340
+ }
1341
+ const provider = params.provider;
1342
+ const success = params.success;
1343
+ const failure = params.failure;
1344
+ const scopes = params.scopes;
1179
1345
  if (typeof provider === 'undefined') {
1180
1346
  throw new AppwriteException('Missing required parameter: "provider"');
1181
1347
  }
@@ -1197,17 +1363,19 @@ class Account extends Service {
1197
1363
  }
1198
1364
  return uri;
1199
1365
  }
1200
- /**
1201
- * Use this endpoint to create a session from token. Provide the **userId**
1202
- * and **secret** parameters from the successful response of authentication
1203
- * flows initiated by token creation. For example, magic URL and phone login.
1204
- *
1205
- * @param {string} userId
1206
- * @param {string} secret
1207
- * @throws {AppwriteException}
1208
- * @returns {Promise}
1209
- */
1210
- updatePhoneSession(userId, secret) {
1366
+ updatePhoneSession(paramsOrFirst, ...rest) {
1367
+ let params;
1368
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1369
+ params = (paramsOrFirst || {});
1370
+ }
1371
+ else {
1372
+ params = {
1373
+ userId: paramsOrFirst,
1374
+ secret: rest[0]
1375
+ };
1376
+ }
1377
+ const userId = params.userId;
1378
+ const secret = params.secret;
1211
1379
  if (typeof userId === 'undefined') {
1212
1380
  throw new AppwriteException('Missing required parameter: "userId"');
1213
1381
  }
@@ -1227,17 +1395,19 @@ class Account extends Service {
1227
1395
  'content-type': 'application/json',
1228
1396
  }, payload);
1229
1397
  }
1230
- /**
1231
- * Use this endpoint to create a session from token. Provide the **userId**
1232
- * and **secret** parameters from the successful response of authentication
1233
- * flows initiated by token creation. For example, magic URL and phone login.
1234
- *
1235
- * @param {string} userId
1236
- * @param {string} secret
1237
- * @throws {AppwriteException}
1238
- * @returns {Promise}
1239
- */
1240
- createSession(userId, secret) {
1398
+ createSession(paramsOrFirst, ...rest) {
1399
+ let params;
1400
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1401
+ params = (paramsOrFirst || {});
1402
+ }
1403
+ else {
1404
+ params = {
1405
+ userId: paramsOrFirst,
1406
+ secret: rest[0]
1407
+ };
1408
+ }
1409
+ const userId = params.userId;
1410
+ const secret = params.secret;
1241
1411
  if (typeof userId === 'undefined') {
1242
1412
  throw new AppwriteException('Missing required parameter: "userId"');
1243
1413
  }
@@ -1257,15 +1427,17 @@ class Account extends Service {
1257
1427
  'content-type': 'application/json',
1258
1428
  }, payload);
1259
1429
  }
1260
- /**
1261
- * Use this endpoint to get a logged in user's session using a Session ID.
1262
- * Inputting 'current' will return the current session being used.
1263
- *
1264
- * @param {string} sessionId
1265
- * @throws {AppwriteException}
1266
- * @returns {Promise}
1267
- */
1268
- getSession(sessionId) {
1430
+ getSession(paramsOrFirst) {
1431
+ let params;
1432
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1433
+ params = (paramsOrFirst || {});
1434
+ }
1435
+ else {
1436
+ params = {
1437
+ sessionId: paramsOrFirst
1438
+ };
1439
+ }
1440
+ const sessionId = params.sessionId;
1269
1441
  if (typeof sessionId === 'undefined') {
1270
1442
  throw new AppwriteException('Missing required parameter: "sessionId"');
1271
1443
  }
@@ -1274,16 +1446,17 @@ class Account extends Service {
1274
1446
  const uri = new URL(this.client.config.endpoint + apiPath);
1275
1447
  return this.client.call('get', uri, {}, payload);
1276
1448
  }
1277
- /**
1278
- * Use this endpoint to extend a session's length. Extending a session is
1279
- * useful when session expiry is short. If the session was created using an
1280
- * OAuth provider, this endpoint refreshes the access token from the provider.
1281
- *
1282
- * @param {string} sessionId
1283
- * @throws {AppwriteException}
1284
- * @returns {Promise}
1285
- */
1286
- updateSession(sessionId) {
1449
+ updateSession(paramsOrFirst) {
1450
+ let params;
1451
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1452
+ params = (paramsOrFirst || {});
1453
+ }
1454
+ else {
1455
+ params = {
1456
+ sessionId: paramsOrFirst
1457
+ };
1458
+ }
1459
+ const sessionId = params.sessionId;
1287
1460
  if (typeof sessionId === 'undefined') {
1288
1461
  throw new AppwriteException('Missing required parameter: "sessionId"');
1289
1462
  }
@@ -1294,18 +1467,17 @@ class Account extends Service {
1294
1467
  'content-type': 'application/json',
1295
1468
  }, payload);
1296
1469
  }
1297
- /**
1298
- * Logout the user. Use 'current' as the session ID to logout on this device,
1299
- * use a session ID to logout on another device. If you're looking to logout
1300
- * the user on all devices, use [Delete
1301
- * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
1302
- * instead.
1303
- *
1304
- * @param {string} sessionId
1305
- * @throws {AppwriteException}
1306
- * @returns {Promise}
1307
- */
1308
- deleteSession(sessionId) {
1470
+ deleteSession(paramsOrFirst) {
1471
+ let params;
1472
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1473
+ params = (paramsOrFirst || {});
1474
+ }
1475
+ else {
1476
+ params = {
1477
+ sessionId: paramsOrFirst
1478
+ };
1479
+ }
1480
+ const sessionId = params.sessionId;
1309
1481
  if (typeof sessionId === 'undefined') {
1310
1482
  throw new AppwriteException('Missing required parameter: "sessionId"');
1311
1483
  }
@@ -1317,9 +1489,7 @@ class Account extends Service {
1317
1489
  }, payload);
1318
1490
  }
1319
1491
  /**
1320
- * Block the currently logged in user account. Behind the scene, the user
1321
- * record is not deleted but permanently blocked from any access. To
1322
- * completely delete a user, use the Users API instead.
1492
+ * Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
1323
1493
  *
1324
1494
  * @throws {AppwriteException}
1325
1495
  * @returns {Promise}
@@ -1332,20 +1502,21 @@ class Account extends Service {
1332
1502
  'content-type': 'application/json',
1333
1503
  }, payload);
1334
1504
  }
1335
- /**
1336
- * Use this endpoint to register a device for push notifications. Provide a
1337
- * target ID (custom or generated using ID.unique()), a device identifier
1338
- * (usually a device token), and optionally specify which provider should send
1339
- * notifications to this target. The target is automatically linked to the
1340
- * current session and includes device information like brand and model.
1341
- *
1342
- * @param {string} targetId
1343
- * @param {string} identifier
1344
- * @param {string} providerId
1345
- * @throws {AppwriteException}
1346
- * @returns {Promise}
1347
- */
1348
- createPushTarget(targetId, identifier, providerId) {
1505
+ createPushTarget(paramsOrFirst, ...rest) {
1506
+ let params;
1507
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1508
+ params = (paramsOrFirst || {});
1509
+ }
1510
+ else {
1511
+ params = {
1512
+ targetId: paramsOrFirst,
1513
+ identifier: rest[0],
1514
+ providerId: rest[1]
1515
+ };
1516
+ }
1517
+ const targetId = params.targetId;
1518
+ const identifier = params.identifier;
1519
+ const providerId = params.providerId;
1349
1520
  if (typeof targetId === 'undefined') {
1350
1521
  throw new AppwriteException('Missing required parameter: "targetId"');
1351
1522
  }
@@ -1368,19 +1539,19 @@ class Account extends Service {
1368
1539
  'content-type': 'application/json',
1369
1540
  }, payload);
1370
1541
  }
1371
- /**
1372
- * Update the currently logged in user's push notification target. You can
1373
- * modify the target's identifier (device token) and provider ID (token,
1374
- * email, phone etc.). The target must exist and belong to the current user.
1375
- * If you change the provider ID, notifications will be sent through the new
1376
- * messaging provider instead.
1377
- *
1378
- * @param {string} targetId
1379
- * @param {string} identifier
1380
- * @throws {AppwriteException}
1381
- * @returns {Promise}
1382
- */
1383
- updatePushTarget(targetId, identifier) {
1542
+ updatePushTarget(paramsOrFirst, ...rest) {
1543
+ let params;
1544
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1545
+ params = (paramsOrFirst || {});
1546
+ }
1547
+ else {
1548
+ params = {
1549
+ targetId: paramsOrFirst,
1550
+ identifier: rest[0]
1551
+ };
1552
+ }
1553
+ const targetId = params.targetId;
1554
+ const identifier = params.identifier;
1384
1555
  if (typeof targetId === 'undefined') {
1385
1556
  throw new AppwriteException('Missing required parameter: "targetId"');
1386
1557
  }
@@ -1397,16 +1568,17 @@ class Account extends Service {
1397
1568
  'content-type': 'application/json',
1398
1569
  }, payload);
1399
1570
  }
1400
- /**
1401
- * Delete a push notification target for the currently logged in user. After
1402
- * deletion, the device will no longer receive push notifications. The target
1403
- * must exist and belong to the current user.
1404
- *
1405
- * @param {string} targetId
1406
- * @throws {AppwriteException}
1407
- * @returns {Promise}
1408
- */
1409
- deletePushTarget(targetId) {
1571
+ deletePushTarget(paramsOrFirst) {
1572
+ let params;
1573
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1574
+ params = (paramsOrFirst || {});
1575
+ }
1576
+ else {
1577
+ params = {
1578
+ targetId: paramsOrFirst
1579
+ };
1580
+ }
1581
+ const targetId = params.targetId;
1410
1582
  if (typeof targetId === 'undefined') {
1411
1583
  throw new AppwriteException('Missing required parameter: "targetId"');
1412
1584
  }
@@ -1417,25 +1589,21 @@ class Account extends Service {
1417
1589
  'content-type': 'application/json',
1418
1590
  }, payload);
1419
1591
  }
1420
- /**
1421
- * Sends the user an email with a secret key for creating a session. If the
1422
- * provided user ID has not be registered, a new user will be created. Use the
1423
- * returned user ID and secret and submit a request to the [POST
1424
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1425
- * endpoint to complete the login process. The secret sent to the user's email
1426
- * is valid for 15 minutes.
1427
- *
1428
- * A user is limited to 10 active sessions at a time by default. [Learn more
1429
- * about session
1430
- * limits](https://appwrite.io/docs/authentication-security#limits).
1431
- *
1432
- * @param {string} userId
1433
- * @param {string} email
1434
- * @param {boolean} phrase
1435
- * @throws {AppwriteException}
1436
- * @returns {Promise}
1437
- */
1438
- createEmailToken(userId, email, phrase) {
1592
+ createEmailToken(paramsOrFirst, ...rest) {
1593
+ let params;
1594
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1595
+ params = (paramsOrFirst || {});
1596
+ }
1597
+ else {
1598
+ params = {
1599
+ userId: paramsOrFirst,
1600
+ email: rest[0],
1601
+ phrase: rest[1]
1602
+ };
1603
+ }
1604
+ const userId = params.userId;
1605
+ const email = params.email;
1606
+ const phrase = params.phrase;
1439
1607
  if (typeof userId === 'undefined') {
1440
1608
  throw new AppwriteException('Missing required parameter: "userId"');
1441
1609
  }
@@ -1458,30 +1626,23 @@ class Account extends Service {
1458
1626
  'content-type': 'application/json',
1459
1627
  }, payload);
1460
1628
  }
1461
- /**
1462
- * Sends the user an email with a secret key for creating a session. If the
1463
- * provided user ID has not been registered, a new user will be created. When
1464
- * the user clicks the link in the email, the user is redirected back to the
1465
- * URL you provided with the secret key and userId values attached to the URL
1466
- * query string. Use the query string parameters to submit a request to the
1467
- * [POST
1468
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1469
- * endpoint to complete the login process. The link sent to the user's email
1470
- * address is valid for 1 hour.
1471
- *
1472
- * A user is limited to 10 active sessions at a time by default. [Learn more
1473
- * about session
1474
- * limits](https://appwrite.io/docs/authentication-security#limits).
1475
- *
1476
- *
1477
- * @param {string} userId
1478
- * @param {string} email
1479
- * @param {string} url
1480
- * @param {boolean} phrase
1481
- * @throws {AppwriteException}
1482
- * @returns {Promise}
1483
- */
1484
- createMagicURLToken(userId, email, url, phrase) {
1629
+ createMagicURLToken(paramsOrFirst, ...rest) {
1630
+ let params;
1631
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1632
+ params = (paramsOrFirst || {});
1633
+ }
1634
+ else {
1635
+ params = {
1636
+ userId: paramsOrFirst,
1637
+ email: rest[0],
1638
+ url: rest[1],
1639
+ phrase: rest[2]
1640
+ };
1641
+ }
1642
+ const userId = params.userId;
1643
+ const email = params.email;
1644
+ const url = params.url;
1645
+ const phrase = params.phrase;
1485
1646
  if (typeof userId === 'undefined') {
1486
1647
  throw new AppwriteException('Missing required parameter: "userId"');
1487
1648
  }
@@ -1507,30 +1668,23 @@ class Account extends Service {
1507
1668
  'content-type': 'application/json',
1508
1669
  }, payload);
1509
1670
  }
1510
- /**
1511
- * Allow the user to login to their account using the OAuth2 provider of their
1512
- * choice. Each OAuth2 provider should be enabled from the Appwrite console
1513
- * first. Use the success and failure arguments to provide a redirect URL's
1514
- * back to your app when login is completed.
1515
- *
1516
- * If authentication succeeds, `userId` and `secret` of a token will be
1517
- * appended to the success URL as query parameters. These can be used to
1518
- * create a new session using the [Create
1519
- * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1520
- * endpoint.
1521
- *
1522
- * A user is limited to 10 active sessions at a time by default. [Learn more
1523
- * about session
1524
- * limits](https://appwrite.io/docs/authentication-security#limits).
1525
- *
1526
- * @param {OAuthProvider} provider
1527
- * @param {string} success
1528
- * @param {string} failure
1529
- * @param {string[]} scopes
1530
- * @throws {AppwriteException}
1531
- * @returns {void|string}
1532
- */
1533
- createOAuth2Token(provider, success, failure, scopes) {
1671
+ createOAuth2Token(paramsOrFirst, ...rest) {
1672
+ let params;
1673
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
1674
+ params = (paramsOrFirst || {});
1675
+ }
1676
+ else {
1677
+ params = {
1678
+ provider: paramsOrFirst,
1679
+ success: rest[0],
1680
+ failure: rest[1],
1681
+ scopes: rest[2]
1682
+ };
1683
+ }
1684
+ const provider = params.provider;
1685
+ const success = params.success;
1686
+ const failure = params.failure;
1687
+ const scopes = params.scopes;
1534
1688
  if (typeof provider === 'undefined') {
1535
1689
  throw new AppwriteException('Missing required parameter: "provider"');
1536
1690
  }
@@ -1552,24 +1706,19 @@ class Account extends Service {
1552
1706
  }
1553
1707
  return uri;
1554
1708
  }
1555
- /**
1556
- * Sends the user an SMS with a secret key for creating a session. If the
1557
- * provided user ID has not be registered, a new user will be created. Use the
1558
- * returned user ID and secret and submit a request to the [POST
1559
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1560
- * endpoint to complete the login process. The secret sent to the user's phone
1561
- * is valid for 15 minutes.
1562
- *
1563
- * A user is limited to 10 active sessions at a time by default. [Learn more
1564
- * about session
1565
- * limits](https://appwrite.io/docs/authentication-security#limits).
1566
- *
1567
- * @param {string} userId
1568
- * @param {string} phone
1569
- * @throws {AppwriteException}
1570
- * @returns {Promise}
1571
- */
1572
- createPhoneToken(userId, phone) {
1709
+ createPhoneToken(paramsOrFirst, ...rest) {
1710
+ let params;
1711
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1712
+ params = (paramsOrFirst || {});
1713
+ }
1714
+ else {
1715
+ params = {
1716
+ userId: paramsOrFirst,
1717
+ phone: rest[0]
1718
+ };
1719
+ }
1720
+ const userId = params.userId;
1721
+ const phone = params.phone;
1573
1722
  if (typeof userId === 'undefined') {
1574
1723
  throw new AppwriteException('Missing required parameter: "userId"');
1575
1724
  }
@@ -1589,28 +1738,17 @@ class Account extends Service {
1589
1738
  'content-type': 'application/json',
1590
1739
  }, payload);
1591
1740
  }
1592
- /**
1593
- * Use this endpoint to send a verification message to your user email address
1594
- * to confirm they are the valid owners of that address. Both the **userId**
1595
- * and **secret** arguments will be passed as query parameters to the URL you
1596
- * have provided to be attached to the verification email. The provided URL
1597
- * should redirect the user back to your app and allow you to complete the
1598
- * verification process by verifying both the **userId** and **secret**
1599
- * parameters. Learn more about how to [complete the verification
1600
- * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
1601
- * The verification link sent to the user's email address is valid for 7 days.
1602
- *
1603
- * Please note that in order to avoid a [Redirect
1604
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
1605
- * the only valid redirect URLs are the ones from domains you have set when
1606
- * adding your platforms in the console interface.
1607
- *
1608
- *
1609
- * @param {string} url
1610
- * @throws {AppwriteException}
1611
- * @returns {Promise}
1612
- */
1613
- createVerification(url) {
1741
+ createVerification(paramsOrFirst) {
1742
+ let params;
1743
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1744
+ params = (paramsOrFirst || {});
1745
+ }
1746
+ else {
1747
+ params = {
1748
+ url: paramsOrFirst
1749
+ };
1750
+ }
1751
+ const url = params.url;
1614
1752
  if (typeof url === 'undefined') {
1615
1753
  throw new AppwriteException('Missing required parameter: "url"');
1616
1754
  }
@@ -1624,18 +1762,19 @@ class Account extends Service {
1624
1762
  'content-type': 'application/json',
1625
1763
  }, payload);
1626
1764
  }
1627
- /**
1628
- * Use this endpoint to complete the user email verification process. Use both
1629
- * the **userId** and **secret** parameters that were attached to your app URL
1630
- * to verify the user email ownership. If confirmed this route will return a
1631
- * 200 status code.
1632
- *
1633
- * @param {string} userId
1634
- * @param {string} secret
1635
- * @throws {AppwriteException}
1636
- * @returns {Promise}
1637
- */
1638
- updateVerification(userId, secret) {
1765
+ updateVerification(paramsOrFirst, ...rest) {
1766
+ let params;
1767
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1768
+ params = (paramsOrFirst || {});
1769
+ }
1770
+ else {
1771
+ params = {
1772
+ userId: paramsOrFirst,
1773
+ secret: rest[0]
1774
+ };
1775
+ }
1776
+ const userId = params.userId;
1777
+ const secret = params.secret;
1639
1778
  if (typeof userId === 'undefined') {
1640
1779
  throw new AppwriteException('Missing required parameter: "userId"');
1641
1780
  }
@@ -1656,14 +1795,7 @@ class Account extends Service {
1656
1795
  }, payload);
1657
1796
  }
1658
1797
  /**
1659
- * Use this endpoint to send a verification SMS to the currently logged in
1660
- * user. This endpoint is meant for use after updating a user's phone number
1661
- * using the
1662
- * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
1663
- * endpoint. Learn more about how to [complete the verification
1664
- * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
1665
- * The verification code sent to the user's phone number is valid for 15
1666
- * minutes.
1798
+ * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
1667
1799
  *
1668
1800
  * @throws {AppwriteException}
1669
1801
  * @returns {Promise}
@@ -1676,18 +1808,19 @@ class Account extends Service {
1676
1808
  'content-type': 'application/json',
1677
1809
  }, payload);
1678
1810
  }
1679
- /**
1680
- * Use this endpoint to complete the user phone verification process. Use the
1681
- * **userId** and **secret** that were sent to your user's phone number to
1682
- * verify the user email ownership. If confirmed this route will return a 200
1683
- * status code.
1684
- *
1685
- * @param {string} userId
1686
- * @param {string} secret
1687
- * @throws {AppwriteException}
1688
- * @returns {Promise}
1689
- */
1690
- updatePhoneVerification(userId, secret) {
1811
+ updatePhoneVerification(paramsOrFirst, ...rest) {
1812
+ let params;
1813
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1814
+ params = (paramsOrFirst || {});
1815
+ }
1816
+ else {
1817
+ params = {
1818
+ userId: paramsOrFirst,
1819
+ secret: rest[0]
1820
+ };
1821
+ }
1822
+ const userId = params.userId;
1823
+ const secret = params.secret;
1691
1824
  if (typeof userId === 'undefined') {
1692
1825
  throw new AppwriteException('Missing required parameter: "userId"');
1693
1826
  }
@@ -1713,26 +1846,23 @@ class Avatars extends Service {
1713
1846
  constructor(client) {
1714
1847
  super(client);
1715
1848
  }
1716
- /**
1717
- * You can use this endpoint to show different browser icons to your users.
1718
- * The code argument receives the browser code as it appears in your user [GET
1719
- * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
1720
- * endpoint. Use width, height and quality arguments to change the output
1721
- * settings.
1722
- *
1723
- * When one dimension is specified and the other is 0, the image is scaled
1724
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1725
- * image at source quality. If dimensions are not specified, the default size
1726
- * of image returned is 100x100px.
1727
- *
1728
- * @param {Browser} code
1729
- * @param {number} width
1730
- * @param {number} height
1731
- * @param {number} quality
1732
- * @throws {AppwriteException}
1733
- * @returns {ArrayBuffer}
1734
- */
1735
- getBrowser(code, width, height, quality) {
1849
+ getBrowser(paramsOrFirst, ...rest) {
1850
+ let params;
1851
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
1852
+ params = (paramsOrFirst || {});
1853
+ }
1854
+ else {
1855
+ params = {
1856
+ code: paramsOrFirst,
1857
+ width: rest[0],
1858
+ height: rest[1],
1859
+ quality: rest[2]
1860
+ };
1861
+ }
1862
+ const code = params.code;
1863
+ const width = params.width;
1864
+ const height = params.height;
1865
+ const quality = params.quality;
1736
1866
  if (typeof code === 'undefined') {
1737
1867
  throw new AppwriteException('Missing required parameter: "code"');
1738
1868
  }
@@ -1754,25 +1884,23 @@ class Avatars extends Service {
1754
1884
  }
1755
1885
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1756
1886
  }
1757
- /**
1758
- * The credit card endpoint will return you the icon of the credit card
1759
- * provider you need. Use width, height and quality arguments to change the
1760
- * output settings.
1761
- *
1762
- * When one dimension is specified and the other is 0, the image is scaled
1763
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1764
- * image at source quality. If dimensions are not specified, the default size
1765
- * of image returned is 100x100px.
1766
- *
1767
- *
1768
- * @param {CreditCard} code
1769
- * @param {number} width
1770
- * @param {number} height
1771
- * @param {number} quality
1772
- * @throws {AppwriteException}
1773
- * @returns {ArrayBuffer}
1774
- */
1775
- getCreditCard(code, width, height, quality) {
1887
+ getCreditCard(paramsOrFirst, ...rest) {
1888
+ let params;
1889
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
1890
+ params = (paramsOrFirst || {});
1891
+ }
1892
+ else {
1893
+ params = {
1894
+ code: paramsOrFirst,
1895
+ width: rest[0],
1896
+ height: rest[1],
1897
+ quality: rest[2]
1898
+ };
1899
+ }
1900
+ const code = params.code;
1901
+ const width = params.width;
1902
+ const height = params.height;
1903
+ const quality = params.quality;
1776
1904
  if (typeof code === 'undefined') {
1777
1905
  throw new AppwriteException('Missing required parameter: "code"');
1778
1906
  }
@@ -1794,17 +1922,17 @@ class Avatars extends Service {
1794
1922
  }
1795
1923
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1796
1924
  }
1797
- /**
1798
- * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
1799
- * website URL.
1800
- *
1801
- * This endpoint does not follow HTTP redirects.
1802
- *
1803
- * @param {string} url
1804
- * @throws {AppwriteException}
1805
- * @returns {ArrayBuffer}
1806
- */
1807
- getFavicon(url) {
1925
+ getFavicon(paramsOrFirst) {
1926
+ let params;
1927
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1928
+ params = (paramsOrFirst || {});
1929
+ }
1930
+ else {
1931
+ params = {
1932
+ url: paramsOrFirst
1933
+ };
1934
+ }
1935
+ const url = params.url;
1808
1936
  if (typeof url === 'undefined') {
1809
1937
  throw new AppwriteException('Missing required parameter: "url"');
1810
1938
  }
@@ -1820,26 +1948,23 @@ class Avatars extends Service {
1820
1948
  }
1821
1949
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1822
1950
  }
1823
- /**
1824
- * You can use this endpoint to show different country flags icons to your
1825
- * users. The code argument receives the 2 letter country code. Use width,
1826
- * height and quality arguments to change the output settings. Country codes
1827
- * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
1828
- *
1829
- * When one dimension is specified and the other is 0, the image is scaled
1830
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1831
- * image at source quality. If dimensions are not specified, the default size
1832
- * of image returned is 100x100px.
1833
- *
1834
- *
1835
- * @param {Flag} code
1836
- * @param {number} width
1837
- * @param {number} height
1838
- * @param {number} quality
1839
- * @throws {AppwriteException}
1840
- * @returns {ArrayBuffer}
1841
- */
1842
- getFlag(code, width, height, quality) {
1951
+ getFlag(paramsOrFirst, ...rest) {
1952
+ let params;
1953
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
1954
+ params = (paramsOrFirst || {});
1955
+ }
1956
+ else {
1957
+ params = {
1958
+ code: paramsOrFirst,
1959
+ width: rest[0],
1960
+ height: rest[1],
1961
+ quality: rest[2]
1962
+ };
1963
+ }
1964
+ const code = params.code;
1965
+ const width = params.width;
1966
+ const height = params.height;
1967
+ const quality = params.quality;
1843
1968
  if (typeof code === 'undefined') {
1844
1969
  throw new AppwriteException('Missing required parameter: "code"');
1845
1970
  }
@@ -1861,26 +1986,21 @@ class Avatars extends Service {
1861
1986
  }
1862
1987
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1863
1988
  }
1864
- /**
1865
- * Use this endpoint to fetch a remote image URL and crop it to any image size
1866
- * you want. This endpoint is very useful if you need to crop and display
1867
- * remote images in your app or in case you want to make sure a 3rd party
1868
- * image is properly served using a TLS protocol.
1869
- *
1870
- * When one dimension is specified and the other is 0, the image is scaled
1871
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1872
- * image at source quality. If dimensions are not specified, the default size
1873
- * of image returned is 400x400px.
1874
- *
1875
- * This endpoint does not follow HTTP redirects.
1876
- *
1877
- * @param {string} url
1878
- * @param {number} width
1879
- * @param {number} height
1880
- * @throws {AppwriteException}
1881
- * @returns {ArrayBuffer}
1882
- */
1883
- getImage(url, width, height) {
1989
+ getImage(paramsOrFirst, ...rest) {
1990
+ let params;
1991
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1992
+ params = (paramsOrFirst || {});
1993
+ }
1994
+ else {
1995
+ params = {
1996
+ url: paramsOrFirst,
1997
+ width: rest[0],
1998
+ height: rest[1]
1999
+ };
2000
+ }
2001
+ const url = params.url;
2002
+ const width = params.width;
2003
+ const height = params.height;
1884
2004
  if (typeof url === 'undefined') {
1885
2005
  throw new AppwriteException('Missing required parameter: "url"');
1886
2006
  }
@@ -1902,32 +2022,23 @@ class Avatars extends Service {
1902
2022
  }
1903
2023
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1904
2024
  }
1905
- /**
1906
- * Use this endpoint to show your user initials avatar icon on your website or
1907
- * app. By default, this route will try to print your logged-in user name or
1908
- * email initials. You can also overwrite the user name if you pass the 'name'
1909
- * parameter. If no name is given and no user is logged, an empty avatar will
1910
- * be returned.
1911
- *
1912
- * You can use the color and background params to change the avatar colors. By
1913
- * default, a random theme will be selected. The random theme will persist for
1914
- * the user's initials when reloading the same theme will always return for
1915
- * the same initials.
1916
- *
1917
- * When one dimension is specified and the other is 0, the image is scaled
1918
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1919
- * image at source quality. If dimensions are not specified, the default size
1920
- * of image returned is 100x100px.
1921
- *
1922
- *
1923
- * @param {string} name
1924
- * @param {number} width
1925
- * @param {number} height
1926
- * @param {string} background
1927
- * @throws {AppwriteException}
1928
- * @returns {ArrayBuffer}
1929
- */
1930
- getInitials(name, width, height, background) {
2025
+ getInitials(paramsOrFirst, ...rest) {
2026
+ let params;
2027
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2028
+ params = (paramsOrFirst || {});
2029
+ }
2030
+ else {
2031
+ params = {
2032
+ name: paramsOrFirst,
2033
+ width: rest[0],
2034
+ height: rest[1],
2035
+ background: rest[2]
2036
+ };
2037
+ }
2038
+ const name = params.name;
2039
+ const width = params.width;
2040
+ const height = params.height;
2041
+ const background = params.background;
1931
2042
  const apiPath = '/avatars/initials';
1932
2043
  const payload = {};
1933
2044
  if (typeof name !== 'undefined') {
@@ -1949,19 +2060,23 @@ class Avatars extends Service {
1949
2060
  }
1950
2061
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1951
2062
  }
1952
- /**
1953
- * Converts a given plain text to a QR code image. You can use the query
1954
- * parameters to change the size and style of the resulting image.
1955
- *
1956
- *
1957
- * @param {string} text
1958
- * @param {number} size
1959
- * @param {number} margin
1960
- * @param {boolean} download
1961
- * @throws {AppwriteException}
1962
- * @returns {ArrayBuffer}
1963
- */
1964
- getQR(text, size, margin, download) {
2063
+ getQR(paramsOrFirst, ...rest) {
2064
+ let params;
2065
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2066
+ params = (paramsOrFirst || {});
2067
+ }
2068
+ else {
2069
+ params = {
2070
+ text: paramsOrFirst,
2071
+ size: rest[0],
2072
+ margin: rest[1],
2073
+ download: rest[2]
2074
+ };
2075
+ }
2076
+ const text = params.text;
2077
+ const size = params.size;
2078
+ const margin = params.margin;
2079
+ const download = params.download;
1965
2080
  if (typeof text === 'undefined') {
1966
2081
  throw new AppwriteException('Missing required parameter: "text"');
1967
2082
  }
@@ -2247,17 +2362,21 @@ class Databases extends Service {
2247
2362
  constructor(client) {
2248
2363
  super(client);
2249
2364
  }
2250
- /**
2251
- * Get a list of all the user's documents in a given collection. You can use
2252
- * the query params to filter your results.
2253
- *
2254
- * @param {string} databaseId
2255
- * @param {string} collectionId
2256
- * @param {string[]} queries
2257
- * @throws {AppwriteException}
2258
- * @returns {Promise}
2259
- */
2260
- listDocuments(databaseId, collectionId, queries) {
2365
+ listDocuments(paramsOrFirst, ...rest) {
2366
+ let params;
2367
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2368
+ params = (paramsOrFirst || {});
2369
+ }
2370
+ else {
2371
+ params = {
2372
+ databaseId: paramsOrFirst,
2373
+ collectionId: rest[0],
2374
+ queries: rest[1]
2375
+ };
2376
+ }
2377
+ const databaseId = params.databaseId;
2378
+ const collectionId = params.collectionId;
2379
+ const queries = params.queries;
2261
2380
  if (typeof databaseId === 'undefined') {
2262
2381
  throw new AppwriteException('Missing required parameter: "databaseId"');
2263
2382
  }
@@ -2272,21 +2391,25 @@ class Databases extends Service {
2272
2391
  const uri = new URL(this.client.config.endpoint + apiPath);
2273
2392
  return this.client.call('get', uri, {}, payload);
2274
2393
  }
2275
- /**
2276
- * Create a new Document. Before using this route, you should create a new
2277
- * collection resource using either a [server
2278
- * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
2279
- * API or directly from your database console.
2280
- *
2281
- * @param {string} databaseId
2282
- * @param {string} collectionId
2283
- * @param {string} documentId
2284
- * @param {object} data
2285
- * @param {string[]} permissions
2286
- * @throws {AppwriteException}
2287
- * @returns {Promise}
2288
- */
2289
- createDocument(databaseId, collectionId, documentId, data, permissions) {
2394
+ createDocument(paramsOrFirst, ...rest) {
2395
+ let params;
2396
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2397
+ params = (paramsOrFirst || {});
2398
+ }
2399
+ else {
2400
+ params = {
2401
+ databaseId: paramsOrFirst,
2402
+ collectionId: rest[0],
2403
+ documentId: rest[1],
2404
+ data: rest[2],
2405
+ permissions: rest[3]
2406
+ };
2407
+ }
2408
+ const databaseId = params.databaseId;
2409
+ const collectionId = params.collectionId;
2410
+ const documentId = params.documentId;
2411
+ const data = params.data;
2412
+ const permissions = params.permissions;
2290
2413
  if (typeof databaseId === 'undefined') {
2291
2414
  throw new AppwriteException('Missing required parameter: "databaseId"');
2292
2415
  }
@@ -2315,18 +2438,23 @@ class Databases extends Service {
2315
2438
  'content-type': 'application/json',
2316
2439
  }, payload);
2317
2440
  }
2318
- /**
2319
- * Get a document by its unique ID. This endpoint response returns a JSON
2320
- * object with the document data.
2321
- *
2322
- * @param {string} databaseId
2323
- * @param {string} collectionId
2324
- * @param {string} documentId
2325
- * @param {string[]} queries
2326
- * @throws {AppwriteException}
2327
- * @returns {Promise}
2328
- */
2329
- getDocument(databaseId, collectionId, documentId, queries) {
2441
+ getDocument(paramsOrFirst, ...rest) {
2442
+ let params;
2443
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2444
+ params = (paramsOrFirst || {});
2445
+ }
2446
+ else {
2447
+ params = {
2448
+ databaseId: paramsOrFirst,
2449
+ collectionId: rest[0],
2450
+ documentId: rest[1],
2451
+ queries: rest[2]
2452
+ };
2453
+ }
2454
+ const databaseId = params.databaseId;
2455
+ const collectionId = params.collectionId;
2456
+ const documentId = params.documentId;
2457
+ const queries = params.queries;
2330
2458
  if (typeof databaseId === 'undefined') {
2331
2459
  throw new AppwriteException('Missing required parameter: "databaseId"');
2332
2460
  }
@@ -2344,25 +2472,25 @@ class Databases extends Service {
2344
2472
  const uri = new URL(this.client.config.endpoint + apiPath);
2345
2473
  return this.client.call('get', uri, {}, payload);
2346
2474
  }
2347
- /**
2348
- * **WARNING: Experimental Feature** - This endpoint is experimental and not
2349
- * yet officially supported. It may be subject to breaking changes or removal
2350
- * in future versions.
2351
- *
2352
- * Create or update a Document. Before using this route, you should create a
2353
- * new collection resource using either a [server
2354
- * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
2355
- * API or directly from your database console.
2356
- *
2357
- * @param {string} databaseId
2358
- * @param {string} collectionId
2359
- * @param {string} documentId
2360
- * @param {object} data
2361
- * @param {string[]} permissions
2362
- * @throws {AppwriteException}
2363
- * @returns {Promise}
2364
- */
2365
- upsertDocument(databaseId, collectionId, documentId, data, permissions) {
2475
+ upsertDocument(paramsOrFirst, ...rest) {
2476
+ let params;
2477
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2478
+ params = (paramsOrFirst || {});
2479
+ }
2480
+ else {
2481
+ params = {
2482
+ databaseId: paramsOrFirst,
2483
+ collectionId: rest[0],
2484
+ documentId: rest[1],
2485
+ data: rest[2],
2486
+ permissions: rest[3]
2487
+ };
2488
+ }
2489
+ const databaseId = params.databaseId;
2490
+ const collectionId = params.collectionId;
2491
+ const documentId = params.documentId;
2492
+ const data = params.data;
2493
+ const permissions = params.permissions;
2366
2494
  if (typeof databaseId === 'undefined') {
2367
2495
  throw new AppwriteException('Missing required parameter: "databaseId"');
2368
2496
  }
@@ -2388,19 +2516,25 @@ class Databases extends Service {
2388
2516
  'content-type': 'application/json',
2389
2517
  }, payload);
2390
2518
  }
2391
- /**
2392
- * Update a document by its unique ID. Using the patch method you can pass
2393
- * only specific fields that will get updated.
2394
- *
2395
- * @param {string} databaseId
2396
- * @param {string} collectionId
2397
- * @param {string} documentId
2398
- * @param {object} data
2399
- * @param {string[]} permissions
2400
- * @throws {AppwriteException}
2401
- * @returns {Promise}
2402
- */
2403
- updateDocument(databaseId, collectionId, documentId, data, permissions) {
2519
+ updateDocument(paramsOrFirst, ...rest) {
2520
+ let params;
2521
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2522
+ params = (paramsOrFirst || {});
2523
+ }
2524
+ else {
2525
+ params = {
2526
+ databaseId: paramsOrFirst,
2527
+ collectionId: rest[0],
2528
+ documentId: rest[1],
2529
+ data: rest[2],
2530
+ permissions: rest[3]
2531
+ };
2532
+ }
2533
+ const databaseId = params.databaseId;
2534
+ const collectionId = params.collectionId;
2535
+ const documentId = params.documentId;
2536
+ const data = params.data;
2537
+ const permissions = params.permissions;
2404
2538
  if (typeof databaseId === 'undefined') {
2405
2539
  throw new AppwriteException('Missing required parameter: "databaseId"');
2406
2540
  }
@@ -2423,16 +2557,21 @@ class Databases extends Service {
2423
2557
  'content-type': 'application/json',
2424
2558
  }, payload);
2425
2559
  }
2426
- /**
2427
- * Delete a document by its unique ID.
2428
- *
2429
- * @param {string} databaseId
2430
- * @param {string} collectionId
2431
- * @param {string} documentId
2432
- * @throws {AppwriteException}
2433
- * @returns {Promise}
2434
- */
2435
- deleteDocument(databaseId, collectionId, documentId) {
2560
+ deleteDocument(paramsOrFirst, ...rest) {
2561
+ let params;
2562
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2563
+ params = (paramsOrFirst || {});
2564
+ }
2565
+ else {
2566
+ params = {
2567
+ databaseId: paramsOrFirst,
2568
+ collectionId: rest[0],
2569
+ documentId: rest[1]
2570
+ };
2571
+ }
2572
+ const databaseId = params.databaseId;
2573
+ const collectionId = params.collectionId;
2574
+ const documentId = params.documentId;
2436
2575
  if (typeof databaseId === 'undefined') {
2437
2576
  throw new AppwriteException('Missing required parameter: "databaseId"');
2438
2577
  }
@@ -2449,19 +2588,27 @@ class Databases extends Service {
2449
2588
  'content-type': 'application/json',
2450
2589
  }, payload);
2451
2590
  }
2452
- /**
2453
- * Decrement a specific attribute of a document by a given value.
2454
- *
2455
- * @param {string} databaseId
2456
- * @param {string} collectionId
2457
- * @param {string} documentId
2458
- * @param {string} attribute
2459
- * @param {number} value
2460
- * @param {number} min
2461
- * @throws {AppwriteException}
2462
- * @returns {Promise}
2463
- */
2464
- decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min) {
2591
+ decrementDocumentAttribute(paramsOrFirst, ...rest) {
2592
+ let params;
2593
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2594
+ params = (paramsOrFirst || {});
2595
+ }
2596
+ else {
2597
+ params = {
2598
+ databaseId: paramsOrFirst,
2599
+ collectionId: rest[0],
2600
+ documentId: rest[1],
2601
+ attribute: rest[2],
2602
+ value: rest[3],
2603
+ min: rest[4]
2604
+ };
2605
+ }
2606
+ const databaseId = params.databaseId;
2607
+ const collectionId = params.collectionId;
2608
+ const documentId = params.documentId;
2609
+ const attribute = params.attribute;
2610
+ const value = params.value;
2611
+ const min = params.min;
2465
2612
  if (typeof databaseId === 'undefined') {
2466
2613
  throw new AppwriteException('Missing required parameter: "databaseId"');
2467
2614
  }
@@ -2487,19 +2634,27 @@ class Databases extends Service {
2487
2634
  'content-type': 'application/json',
2488
2635
  }, payload);
2489
2636
  }
2490
- /**
2491
- * Increment a specific attribute of a document by a given value.
2492
- *
2493
- * @param {string} databaseId
2494
- * @param {string} collectionId
2495
- * @param {string} documentId
2496
- * @param {string} attribute
2497
- * @param {number} value
2498
- * @param {number} max
2499
- * @throws {AppwriteException}
2500
- * @returns {Promise}
2501
- */
2502
- incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max) {
2637
+ incrementDocumentAttribute(paramsOrFirst, ...rest) {
2638
+ let params;
2639
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2640
+ params = (paramsOrFirst || {});
2641
+ }
2642
+ else {
2643
+ params = {
2644
+ databaseId: paramsOrFirst,
2645
+ collectionId: rest[0],
2646
+ documentId: rest[1],
2647
+ attribute: rest[2],
2648
+ value: rest[3],
2649
+ max: rest[4]
2650
+ };
2651
+ }
2652
+ const databaseId = params.databaseId;
2653
+ const collectionId = params.collectionId;
2654
+ const documentId = params.documentId;
2655
+ const attribute = params.attribute;
2656
+ const value = params.value;
2657
+ const max = params.max;
2503
2658
  if (typeof databaseId === 'undefined') {
2504
2659
  throw new AppwriteException('Missing required parameter: "databaseId"');
2505
2660
  }
@@ -2531,16 +2686,19 @@ class Functions extends Service {
2531
2686
  constructor(client) {
2532
2687
  super(client);
2533
2688
  }
2534
- /**
2535
- * Get a list of all the current user function execution logs. You can use the
2536
- * query params to filter your results.
2537
- *
2538
- * @param {string} functionId
2539
- * @param {string[]} queries
2540
- * @throws {AppwriteException}
2541
- * @returns {Promise}
2542
- */
2543
- listExecutions(functionId, queries) {
2689
+ listExecutions(paramsOrFirst, ...rest) {
2690
+ let params;
2691
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2692
+ params = (paramsOrFirst || {});
2693
+ }
2694
+ else {
2695
+ params = {
2696
+ functionId: paramsOrFirst,
2697
+ queries: rest[0]
2698
+ };
2699
+ }
2700
+ const functionId = params.functionId;
2701
+ const queries = params.queries;
2544
2702
  if (typeof functionId === 'undefined') {
2545
2703
  throw new AppwriteException('Missing required parameter: "functionId"');
2546
2704
  }
@@ -2552,23 +2710,29 @@ class Functions extends Service {
2552
2710
  const uri = new URL(this.client.config.endpoint + apiPath);
2553
2711
  return this.client.call('get', uri, {}, payload);
2554
2712
  }
2555
- /**
2556
- * Trigger a function execution. The returned object will return you the
2557
- * current execution status. You can ping the `Get Execution` endpoint to get
2558
- * updates on the current execution status. Once this endpoint is called, your
2559
- * function execution process will start asynchronously.
2560
- *
2561
- * @param {string} functionId
2562
- * @param {string} body
2563
- * @param {boolean} async
2564
- * @param {string} xpath
2565
- * @param {ExecutionMethod} method
2566
- * @param {object} headers
2567
- * @param {string} scheduledAt
2568
- * @throws {AppwriteException}
2569
- * @returns {Promise}
2570
- */
2571
- createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
2713
+ createExecution(paramsOrFirst, ...rest) {
2714
+ let params;
2715
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2716
+ params = (paramsOrFirst || {});
2717
+ }
2718
+ else {
2719
+ params = {
2720
+ functionId: paramsOrFirst,
2721
+ body: rest[0],
2722
+ async: rest[1],
2723
+ xpath: rest[2],
2724
+ method: rest[3],
2725
+ headers: rest[4],
2726
+ scheduledAt: rest[5]
2727
+ };
2728
+ }
2729
+ const functionId = params.functionId;
2730
+ const body = params.body;
2731
+ const async = params.async;
2732
+ const xpath = params.xpath;
2733
+ const method = params.method;
2734
+ const headers = params.headers;
2735
+ const scheduledAt = params.scheduledAt;
2572
2736
  if (typeof functionId === 'undefined') {
2573
2737
  throw new AppwriteException('Missing required parameter: "functionId"');
2574
2738
  }
@@ -2597,15 +2761,19 @@ class Functions extends Service {
2597
2761
  'content-type': 'application/json',
2598
2762
  }, payload);
2599
2763
  }
2600
- /**
2601
- * Get a function execution log by its unique ID.
2602
- *
2603
- * @param {string} functionId
2604
- * @param {string} executionId
2605
- * @throws {AppwriteException}
2606
- * @returns {Promise}
2607
- */
2608
- getExecution(functionId, executionId) {
2764
+ getExecution(paramsOrFirst, ...rest) {
2765
+ let params;
2766
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2767
+ params = (paramsOrFirst || {});
2768
+ }
2769
+ else {
2770
+ params = {
2771
+ functionId: paramsOrFirst,
2772
+ executionId: rest[0]
2773
+ };
2774
+ }
2775
+ const functionId = params.functionId;
2776
+ const executionId = params.executionId;
2609
2777
  if (typeof functionId === 'undefined') {
2610
2778
  throw new AppwriteException('Missing required parameter: "functionId"');
2611
2779
  }
@@ -2623,14 +2791,17 @@ class Graphql extends Service {
2623
2791
  constructor(client) {
2624
2792
  super(client);
2625
2793
  }
2626
- /**
2627
- * Execute a GraphQL mutation.
2628
- *
2629
- * @param {object} query
2630
- * @throws {AppwriteException}
2631
- * @returns {Promise}
2632
- */
2633
- query(query) {
2794
+ query(paramsOrFirst) {
2795
+ let params;
2796
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2797
+ params = (paramsOrFirst || {});
2798
+ }
2799
+ else {
2800
+ params = {
2801
+ query: paramsOrFirst
2802
+ };
2803
+ }
2804
+ const query = params.query;
2634
2805
  if (typeof query === 'undefined') {
2635
2806
  throw new AppwriteException('Missing required parameter: "query"');
2636
2807
  }
@@ -2645,14 +2816,17 @@ class Graphql extends Service {
2645
2816
  'content-type': 'application/json',
2646
2817
  }, payload);
2647
2818
  }
2648
- /**
2649
- * Execute a GraphQL mutation.
2650
- *
2651
- * @param {object} query
2652
- * @throws {AppwriteException}
2653
- * @returns {Promise}
2654
- */
2655
- mutation(query) {
2819
+ mutation(paramsOrFirst) {
2820
+ let params;
2821
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2822
+ params = (paramsOrFirst || {});
2823
+ }
2824
+ else {
2825
+ params = {
2826
+ query: paramsOrFirst
2827
+ };
2828
+ }
2829
+ const query = params.query;
2656
2830
  if (typeof query === 'undefined') {
2657
2831
  throw new AppwriteException('Missing required parameter: "query"');
2658
2832
  }
@@ -2674,10 +2848,7 @@ class Locale extends Service {
2674
2848
  super(client);
2675
2849
  }
2676
2850
  /**
2677
- * Get the current user location based on IP. Returns an object with user
2678
- * country code, country name, continent name, continent code, ip address and
2679
- * suggested currency. You can use the locale header to get the data in a
2680
- * supported language.
2851
+ * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
2681
2852
  *
2682
2853
  * ([IP Geolocation by DB-IP](https://db-ip.com))
2683
2854
  *
@@ -2691,8 +2862,7 @@ class Locale extends Service {
2691
2862
  return this.client.call('get', uri, {}, payload);
2692
2863
  }
2693
2864
  /**
2694
- * List of all locale codes in [ISO
2695
- * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2865
+ * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2696
2866
  *
2697
2867
  * @throws {AppwriteException}
2698
2868
  * @returns {Promise}
@@ -2704,8 +2874,7 @@ class Locale extends Service {
2704
2874
  return this.client.call('get', uri, {}, payload);
2705
2875
  }
2706
2876
  /**
2707
- * List of all continents. You can use the locale header to get the data in a
2708
- * supported language.
2877
+ * List of all continents. You can use the locale header to get the data in a supported language.
2709
2878
  *
2710
2879
  * @throws {AppwriteException}
2711
2880
  * @returns {Promise}
@@ -2717,8 +2886,7 @@ class Locale extends Service {
2717
2886
  return this.client.call('get', uri, {}, payload);
2718
2887
  }
2719
2888
  /**
2720
- * List of all countries. You can use the locale header to get the data in a
2721
- * supported language.
2889
+ * List of all countries. You can use the locale header to get the data in a supported language.
2722
2890
  *
2723
2891
  * @throws {AppwriteException}
2724
2892
  * @returns {Promise}
@@ -2730,8 +2898,7 @@ class Locale extends Service {
2730
2898
  return this.client.call('get', uri, {}, payload);
2731
2899
  }
2732
2900
  /**
2733
- * List of all countries that are currently members of the EU. You can use the
2734
- * locale header to get the data in a supported language.
2901
+ * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
2735
2902
  *
2736
2903
  * @throws {AppwriteException}
2737
2904
  * @returns {Promise}
@@ -2743,8 +2910,7 @@ class Locale extends Service {
2743
2910
  return this.client.call('get', uri, {}, payload);
2744
2911
  }
2745
2912
  /**
2746
- * List of all countries phone codes. You can use the locale header to get the
2747
- * data in a supported language.
2913
+ * List of all countries phone codes. You can use the locale header to get the data in a supported language.
2748
2914
  *
2749
2915
  * @throws {AppwriteException}
2750
2916
  * @returns {Promise}
@@ -2756,9 +2922,7 @@ class Locale extends Service {
2756
2922
  return this.client.call('get', uri, {}, payload);
2757
2923
  }
2758
2924
  /**
2759
- * List of all currencies, including currency symbol, name, plural, and
2760
- * decimal digits for all major and minor currencies. You can use the locale
2761
- * header to get the data in a supported language.
2925
+ * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
2762
2926
  *
2763
2927
  * @throws {AppwriteException}
2764
2928
  * @returns {Promise}
@@ -2770,8 +2934,7 @@ class Locale extends Service {
2770
2934
  return this.client.call('get', uri, {}, payload);
2771
2935
  }
2772
2936
  /**
2773
- * List of all languages classified by ISO 639-1 including 2-letter code, name
2774
- * in English, and name in the respective language.
2937
+ * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
2775
2938
  *
2776
2939
  * @throws {AppwriteException}
2777
2940
  * @returns {Promise}
@@ -2788,16 +2951,21 @@ class Messaging extends Service {
2788
2951
  constructor(client) {
2789
2952
  super(client);
2790
2953
  }
2791
- /**
2792
- * Create a new subscriber.
2793
- *
2794
- * @param {string} topicId
2795
- * @param {string} subscriberId
2796
- * @param {string} targetId
2797
- * @throws {AppwriteException}
2798
- * @returns {Promise}
2799
- */
2800
- createSubscriber(topicId, subscriberId, targetId) {
2954
+ createSubscriber(paramsOrFirst, ...rest) {
2955
+ let params;
2956
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2957
+ params = (paramsOrFirst || {});
2958
+ }
2959
+ else {
2960
+ params = {
2961
+ topicId: paramsOrFirst,
2962
+ subscriberId: rest[0],
2963
+ targetId: rest[1]
2964
+ };
2965
+ }
2966
+ const topicId = params.topicId;
2967
+ const subscriberId = params.subscriberId;
2968
+ const targetId = params.targetId;
2801
2969
  if (typeof topicId === 'undefined') {
2802
2970
  throw new AppwriteException('Missing required parameter: "topicId"');
2803
2971
  }
@@ -2820,15 +2988,19 @@ class Messaging extends Service {
2820
2988
  'content-type': 'application/json',
2821
2989
  }, payload);
2822
2990
  }
2823
- /**
2824
- * Delete a subscriber by its unique ID.
2825
- *
2826
- * @param {string} topicId
2827
- * @param {string} subscriberId
2828
- * @throws {AppwriteException}
2829
- * @returns {Promise}
2830
- */
2831
- deleteSubscriber(topicId, subscriberId) {
2991
+ deleteSubscriber(paramsOrFirst, ...rest) {
2992
+ let params;
2993
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2994
+ params = (paramsOrFirst || {});
2995
+ }
2996
+ else {
2997
+ params = {
2998
+ topicId: paramsOrFirst,
2999
+ subscriberId: rest[0]
3000
+ };
3001
+ }
3002
+ const topicId = params.topicId;
3003
+ const subscriberId = params.subscriberId;
2832
3004
  if (typeof topicId === 'undefined') {
2833
3005
  throw new AppwriteException('Missing required parameter: "topicId"');
2834
3006
  }
@@ -2848,17 +3020,21 @@ class Storage extends Service {
2848
3020
  constructor(client) {
2849
3021
  super(client);
2850
3022
  }
2851
- /**
2852
- * Get a list of all the user files. You can use the query params to filter
2853
- * your results.
2854
- *
2855
- * @param {string} bucketId
2856
- * @param {string[]} queries
2857
- * @param {string} search
2858
- * @throws {AppwriteException}
2859
- * @returns {Promise}
2860
- */
2861
- listFiles(bucketId, queries, search) {
3023
+ listFiles(paramsOrFirst, ...rest) {
3024
+ let params;
3025
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3026
+ params = (paramsOrFirst || {});
3027
+ }
3028
+ else {
3029
+ params = {
3030
+ bucketId: paramsOrFirst,
3031
+ queries: rest[0],
3032
+ search: rest[1]
3033
+ };
3034
+ }
3035
+ const bucketId = params.bucketId;
3036
+ const queries = params.queries;
3037
+ const search = params.search;
2862
3038
  if (typeof bucketId === 'undefined') {
2863
3039
  throw new AppwriteException('Missing required parameter: "bucketId"');
2864
3040
  }
@@ -2873,35 +3049,27 @@ class Storage extends Service {
2873
3049
  const uri = new URL(this.client.config.endpoint + apiPath);
2874
3050
  return this.client.call('get', uri, {}, payload);
2875
3051
  }
2876
- /**
2877
- * Create a new file. Before using this route, you should create a new bucket
2878
- * resource using either a [server
2879
- * integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
2880
- * API or directly from your Appwrite console.
2881
- *
2882
- * Larger files should be uploaded using multiple requests with the
2883
- * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
2884
- * header to send a partial request with a maximum supported chunk of `5MB`.
2885
- * The `content-range` header values should always be in bytes.
2886
- *
2887
- * When the first request is sent, the server will return the **File** object,
2888
- * and the subsequent part request must include the file's **id** in
2889
- * `x-appwrite-id` header to allow the server to know that the partial upload
2890
- * is for the existing file and not for a new one.
2891
- *
2892
- * If you're creating a new file using one of the Appwrite SDKs, all the
2893
- * chunking logic will be managed by the SDK internally.
2894
- *
2895
- *
2896
- * @param {string} bucketId
2897
- * @param {string} fileId
2898
- * @param {{name: string, type: string, size: number, uri: string}} file
2899
- * @param {string[]} permissions
2900
- * @throws {AppwriteException}
2901
- * @returns {Promise}
2902
- */
2903
- createFile(bucketId_1, fileId_1, file_1, permissions_1) {
2904
- return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
3052
+ createFile(paramsOrFirst, ...rest) {
3053
+ return __awaiter(this, void 0, void 0, function* () {
3054
+ let params;
3055
+ let onProgress;
3056
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3057
+ params = (paramsOrFirst || {});
3058
+ onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
3059
+ }
3060
+ else {
3061
+ params = {
3062
+ bucketId: paramsOrFirst,
3063
+ fileId: rest[0],
3064
+ file: rest[1],
3065
+ permissions: rest[2]
3066
+ };
3067
+ onProgress = rest[3];
3068
+ }
3069
+ const bucketId = params.bucketId;
3070
+ const fileId = params.fileId;
3071
+ const file = params.file;
3072
+ const permissions = params.permissions;
2905
3073
  if (typeof bucketId === 'undefined') {
2906
3074
  throw new AppwriteException('Missing required parameter: "bucketId"');
2907
3075
  }
@@ -2973,16 +3141,19 @@ class Storage extends Service {
2973
3141
  return response;
2974
3142
  });
2975
3143
  }
2976
- /**
2977
- * Get a file by its unique ID. This endpoint response returns a JSON object
2978
- * with the file metadata.
2979
- *
2980
- * @param {string} bucketId
2981
- * @param {string} fileId
2982
- * @throws {AppwriteException}
2983
- * @returns {Promise}
2984
- */
2985
- getFile(bucketId, fileId) {
3144
+ getFile(paramsOrFirst, ...rest) {
3145
+ let params;
3146
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3147
+ params = (paramsOrFirst || {});
3148
+ }
3149
+ else {
3150
+ params = {
3151
+ bucketId: paramsOrFirst,
3152
+ fileId: rest[0]
3153
+ };
3154
+ }
3155
+ const bucketId = params.bucketId;
3156
+ const fileId = params.fileId;
2986
3157
  if (typeof bucketId === 'undefined') {
2987
3158
  throw new AppwriteException('Missing required parameter: "bucketId"');
2988
3159
  }
@@ -2994,18 +3165,23 @@ class Storage extends Service {
2994
3165
  const uri = new URL(this.client.config.endpoint + apiPath);
2995
3166
  return this.client.call('get', uri, {}, payload);
2996
3167
  }
2997
- /**
2998
- * Update a file by its unique ID. Only users with write permissions have
2999
- * access to update this resource.
3000
- *
3001
- * @param {string} bucketId
3002
- * @param {string} fileId
3003
- * @param {string} name
3004
- * @param {string[]} permissions
3005
- * @throws {AppwriteException}
3006
- * @returns {Promise}
3007
- */
3008
- updateFile(bucketId, fileId, name, permissions) {
3168
+ updateFile(paramsOrFirst, ...rest) {
3169
+ let params;
3170
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3171
+ params = (paramsOrFirst || {});
3172
+ }
3173
+ else {
3174
+ params = {
3175
+ bucketId: paramsOrFirst,
3176
+ fileId: rest[0],
3177
+ name: rest[1],
3178
+ permissions: rest[2]
3179
+ };
3180
+ }
3181
+ const bucketId = params.bucketId;
3182
+ const fileId = params.fileId;
3183
+ const name = params.name;
3184
+ const permissions = params.permissions;
3009
3185
  if (typeof bucketId === 'undefined') {
3010
3186
  throw new AppwriteException('Missing required parameter: "bucketId"');
3011
3187
  }
@@ -3025,16 +3201,19 @@ class Storage extends Service {
3025
3201
  'content-type': 'application/json',
3026
3202
  }, payload);
3027
3203
  }
3028
- /**
3029
- * Delete a file by its unique ID. Only users with write permissions have
3030
- * access to delete this resource.
3031
- *
3032
- * @param {string} bucketId
3033
- * @param {string} fileId
3034
- * @throws {AppwriteException}
3035
- * @returns {Promise}
3036
- */
3037
- deleteFile(bucketId, fileId) {
3204
+ deleteFile(paramsOrFirst, ...rest) {
3205
+ let params;
3206
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3207
+ params = (paramsOrFirst || {});
3208
+ }
3209
+ else {
3210
+ params = {
3211
+ bucketId: paramsOrFirst,
3212
+ fileId: rest[0]
3213
+ };
3214
+ }
3215
+ const bucketId = params.bucketId;
3216
+ const fileId = params.fileId;
3038
3217
  if (typeof bucketId === 'undefined') {
3039
3218
  throw new AppwriteException('Missing required parameter: "bucketId"');
3040
3219
  }
@@ -3048,18 +3227,21 @@ class Storage extends Service {
3048
3227
  'content-type': 'application/json',
3049
3228
  }, payload);
3050
3229
  }
3051
- /**
3052
- * Get a file content by its unique ID. The endpoint response return with a
3053
- * 'Content-Disposition: attachment' header that tells the browser to start
3054
- * downloading the file to user downloads directory.
3055
- *
3056
- * @param {string} bucketId
3057
- * @param {string} fileId
3058
- * @param {string} token
3059
- * @throws {AppwriteException}
3060
- * @returns {ArrayBuffer}
3061
- */
3062
- getFileDownload(bucketId, fileId, token) {
3230
+ getFileDownload(paramsOrFirst, ...rest) {
3231
+ let params;
3232
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3233
+ params = (paramsOrFirst || {});
3234
+ }
3235
+ else {
3236
+ params = {
3237
+ bucketId: paramsOrFirst,
3238
+ fileId: rest[0],
3239
+ token: rest[1]
3240
+ };
3241
+ }
3242
+ const bucketId = params.bucketId;
3243
+ const fileId = params.fileId;
3244
+ const token = params.token;
3063
3245
  if (typeof bucketId === 'undefined') {
3064
3246
  throw new AppwriteException('Missing required parameter: "bucketId"');
3065
3247
  }
@@ -3078,31 +3260,43 @@ class Storage extends Service {
3078
3260
  }
3079
3261
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3080
3262
  }
3081
- /**
3082
- * Get a file preview image. Currently, this method supports preview for image
3083
- * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
3084
- * and spreadsheets, will return the file icon image. You can also pass query
3085
- * string arguments for cutting and resizing your preview image. Preview is
3086
- * supported only for image files smaller than 10MB.
3087
- *
3088
- * @param {string} bucketId
3089
- * @param {string} fileId
3090
- * @param {number} width
3091
- * @param {number} height
3092
- * @param {ImageGravity} gravity
3093
- * @param {number} quality
3094
- * @param {number} borderWidth
3095
- * @param {string} borderColor
3096
- * @param {number} borderRadius
3097
- * @param {number} opacity
3098
- * @param {number} rotation
3099
- * @param {string} background
3100
- * @param {ImageFormat} output
3101
- * @param {string} token
3102
- * @throws {AppwriteException}
3103
- * @returns {ArrayBuffer}
3104
- */
3105
- getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) {
3263
+ getFilePreview(paramsOrFirst, ...rest) {
3264
+ let params;
3265
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3266
+ params = (paramsOrFirst || {});
3267
+ }
3268
+ else {
3269
+ params = {
3270
+ bucketId: paramsOrFirst,
3271
+ fileId: rest[0],
3272
+ width: rest[1],
3273
+ height: rest[2],
3274
+ gravity: rest[3],
3275
+ quality: rest[4],
3276
+ borderWidth: rest[5],
3277
+ borderColor: rest[6],
3278
+ borderRadius: rest[7],
3279
+ opacity: rest[8],
3280
+ rotation: rest[9],
3281
+ background: rest[10],
3282
+ output: rest[11],
3283
+ token: rest[12]
3284
+ };
3285
+ }
3286
+ const bucketId = params.bucketId;
3287
+ const fileId = params.fileId;
3288
+ const width = params.width;
3289
+ const height = params.height;
3290
+ const gravity = params.gravity;
3291
+ const quality = params.quality;
3292
+ const borderWidth = params.borderWidth;
3293
+ const borderColor = params.borderColor;
3294
+ const borderRadius = params.borderRadius;
3295
+ const opacity = params.opacity;
3296
+ const rotation = params.rotation;
3297
+ const background = params.background;
3298
+ const output = params.output;
3299
+ const token = params.token;
3106
3300
  if (typeof bucketId === 'undefined') {
3107
3301
  throw new AppwriteException('Missing required parameter: "bucketId"');
3108
3302
  }
@@ -3154,18 +3348,21 @@ class Storage extends Service {
3154
3348
  }
3155
3349
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3156
3350
  }
3157
- /**
3158
- * Get a file content by its unique ID. This endpoint is similar to the
3159
- * download method but returns with no 'Content-Disposition: attachment'
3160
- * header.
3161
- *
3162
- * @param {string} bucketId
3163
- * @param {string} fileId
3164
- * @param {string} token
3165
- * @throws {AppwriteException}
3166
- * @returns {ArrayBuffer}
3167
- */
3168
- getFileView(bucketId, fileId, token) {
3351
+ getFileView(paramsOrFirst, ...rest) {
3352
+ let params;
3353
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3354
+ params = (paramsOrFirst || {});
3355
+ }
3356
+ else {
3357
+ params = {
3358
+ bucketId: paramsOrFirst,
3359
+ fileId: rest[0],
3360
+ token: rest[1]
3361
+ };
3362
+ }
3363
+ const bucketId = params.bucketId;
3364
+ const fileId = params.fileId;
3365
+ const token = params.token;
3169
3366
  if (typeof bucketId === 'undefined') {
3170
3367
  throw new AppwriteException('Missing required parameter: "bucketId"');
3171
3368
  }
@@ -3304,20 +3501,344 @@ class Storage extends Service {
3304
3501
  }
3305
3502
  }
3306
3503
 
3307
- class Teams extends Service {
3504
+ class TablesDB extends Service {
3308
3505
  constructor(client) {
3309
3506
  super(client);
3310
3507
  }
3311
- /**
3312
- * Get a list of all the teams in which the current user is a member. You can
3313
- * use the parameters to filter your results.
3314
- *
3315
- * @param {string[]} queries
3316
- * @param {string} search
3317
- * @throws {AppwriteException}
3318
- * @returns {Promise}
3319
- */
3320
- list(queries, search) {
3508
+ listRows(paramsOrFirst, ...rest) {
3509
+ let params;
3510
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3511
+ params = (paramsOrFirst || {});
3512
+ }
3513
+ else {
3514
+ params = {
3515
+ databaseId: paramsOrFirst,
3516
+ tableId: rest[0],
3517
+ queries: rest[1]
3518
+ };
3519
+ }
3520
+ const databaseId = params.databaseId;
3521
+ const tableId = params.tableId;
3522
+ const queries = params.queries;
3523
+ if (typeof databaseId === 'undefined') {
3524
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3525
+ }
3526
+ if (typeof tableId === 'undefined') {
3527
+ throw new AppwriteException('Missing required parameter: "tableId"');
3528
+ }
3529
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3530
+ const payload = {};
3531
+ if (typeof queries !== 'undefined') {
3532
+ payload['queries'] = queries;
3533
+ }
3534
+ const uri = new URL(this.client.config.endpoint + apiPath);
3535
+ return this.client.call('get', uri, {}, payload);
3536
+ }
3537
+ createRow(paramsOrFirst, ...rest) {
3538
+ let params;
3539
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3540
+ params = (paramsOrFirst || {});
3541
+ }
3542
+ else {
3543
+ params = {
3544
+ databaseId: paramsOrFirst,
3545
+ tableId: rest[0],
3546
+ rowId: rest[1],
3547
+ data: rest[2],
3548
+ permissions: rest[3]
3549
+ };
3550
+ }
3551
+ const databaseId = params.databaseId;
3552
+ const tableId = params.tableId;
3553
+ const rowId = params.rowId;
3554
+ const data = params.data;
3555
+ const permissions = params.permissions;
3556
+ if (typeof databaseId === 'undefined') {
3557
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3558
+ }
3559
+ if (typeof tableId === 'undefined') {
3560
+ throw new AppwriteException('Missing required parameter: "tableId"');
3561
+ }
3562
+ if (typeof rowId === 'undefined') {
3563
+ throw new AppwriteException('Missing required parameter: "rowId"');
3564
+ }
3565
+ if (typeof data === 'undefined') {
3566
+ throw new AppwriteException('Missing required parameter: "data"');
3567
+ }
3568
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3569
+ const payload = {};
3570
+ if (typeof rowId !== 'undefined') {
3571
+ payload['rowId'] = rowId;
3572
+ }
3573
+ if (typeof data !== 'undefined') {
3574
+ payload['data'] = data;
3575
+ }
3576
+ if (typeof permissions !== 'undefined') {
3577
+ payload['permissions'] = permissions;
3578
+ }
3579
+ const uri = new URL(this.client.config.endpoint + apiPath);
3580
+ return this.client.call('post', uri, {
3581
+ 'content-type': 'application/json',
3582
+ }, payload);
3583
+ }
3584
+ getRow(paramsOrFirst, ...rest) {
3585
+ let params;
3586
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3587
+ params = (paramsOrFirst || {});
3588
+ }
3589
+ else {
3590
+ params = {
3591
+ databaseId: paramsOrFirst,
3592
+ tableId: rest[0],
3593
+ rowId: rest[1],
3594
+ queries: rest[2]
3595
+ };
3596
+ }
3597
+ const databaseId = params.databaseId;
3598
+ const tableId = params.tableId;
3599
+ const rowId = params.rowId;
3600
+ const queries = params.queries;
3601
+ if (typeof databaseId === 'undefined') {
3602
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3603
+ }
3604
+ if (typeof tableId === 'undefined') {
3605
+ throw new AppwriteException('Missing required parameter: "tableId"');
3606
+ }
3607
+ if (typeof rowId === 'undefined') {
3608
+ throw new AppwriteException('Missing required parameter: "rowId"');
3609
+ }
3610
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3611
+ const payload = {};
3612
+ if (typeof queries !== 'undefined') {
3613
+ payload['queries'] = queries;
3614
+ }
3615
+ const uri = new URL(this.client.config.endpoint + apiPath);
3616
+ return this.client.call('get', uri, {}, payload);
3617
+ }
3618
+ upsertRow(paramsOrFirst, ...rest) {
3619
+ let params;
3620
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3621
+ params = (paramsOrFirst || {});
3622
+ }
3623
+ else {
3624
+ params = {
3625
+ databaseId: paramsOrFirst,
3626
+ tableId: rest[0],
3627
+ rowId: rest[1],
3628
+ data: rest[2],
3629
+ permissions: rest[3]
3630
+ };
3631
+ }
3632
+ const databaseId = params.databaseId;
3633
+ const tableId = params.tableId;
3634
+ const rowId = params.rowId;
3635
+ const data = params.data;
3636
+ const permissions = params.permissions;
3637
+ if (typeof databaseId === 'undefined') {
3638
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3639
+ }
3640
+ if (typeof tableId === 'undefined') {
3641
+ throw new AppwriteException('Missing required parameter: "tableId"');
3642
+ }
3643
+ if (typeof rowId === 'undefined') {
3644
+ throw new AppwriteException('Missing required parameter: "rowId"');
3645
+ }
3646
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3647
+ const payload = {};
3648
+ if (typeof data !== 'undefined') {
3649
+ payload['data'] = data;
3650
+ }
3651
+ if (typeof permissions !== 'undefined') {
3652
+ payload['permissions'] = permissions;
3653
+ }
3654
+ const uri = new URL(this.client.config.endpoint + apiPath);
3655
+ return this.client.call('put', uri, {
3656
+ 'content-type': 'application/json',
3657
+ }, payload);
3658
+ }
3659
+ updateRow(paramsOrFirst, ...rest) {
3660
+ let params;
3661
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3662
+ params = (paramsOrFirst || {});
3663
+ }
3664
+ else {
3665
+ params = {
3666
+ databaseId: paramsOrFirst,
3667
+ tableId: rest[0],
3668
+ rowId: rest[1],
3669
+ data: rest[2],
3670
+ permissions: rest[3]
3671
+ };
3672
+ }
3673
+ const databaseId = params.databaseId;
3674
+ const tableId = params.tableId;
3675
+ const rowId = params.rowId;
3676
+ const data = params.data;
3677
+ const permissions = params.permissions;
3678
+ if (typeof databaseId === 'undefined') {
3679
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3680
+ }
3681
+ if (typeof tableId === 'undefined') {
3682
+ throw new AppwriteException('Missing required parameter: "tableId"');
3683
+ }
3684
+ if (typeof rowId === 'undefined') {
3685
+ throw new AppwriteException('Missing required parameter: "rowId"');
3686
+ }
3687
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3688
+ const payload = {};
3689
+ if (typeof data !== 'undefined') {
3690
+ payload['data'] = data;
3691
+ }
3692
+ if (typeof permissions !== 'undefined') {
3693
+ payload['permissions'] = permissions;
3694
+ }
3695
+ const uri = new URL(this.client.config.endpoint + apiPath);
3696
+ return this.client.call('patch', uri, {
3697
+ 'content-type': 'application/json',
3698
+ }, payload);
3699
+ }
3700
+ deleteRow(paramsOrFirst, ...rest) {
3701
+ let params;
3702
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3703
+ params = (paramsOrFirst || {});
3704
+ }
3705
+ else {
3706
+ params = {
3707
+ databaseId: paramsOrFirst,
3708
+ tableId: rest[0],
3709
+ rowId: rest[1]
3710
+ };
3711
+ }
3712
+ const databaseId = params.databaseId;
3713
+ const tableId = params.tableId;
3714
+ const rowId = params.rowId;
3715
+ if (typeof databaseId === 'undefined') {
3716
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3717
+ }
3718
+ if (typeof tableId === 'undefined') {
3719
+ throw new AppwriteException('Missing required parameter: "tableId"');
3720
+ }
3721
+ if (typeof rowId === 'undefined') {
3722
+ throw new AppwriteException('Missing required parameter: "rowId"');
3723
+ }
3724
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3725
+ const payload = {};
3726
+ const uri = new URL(this.client.config.endpoint + apiPath);
3727
+ return this.client.call('delete', uri, {
3728
+ 'content-type': 'application/json',
3729
+ }, payload);
3730
+ }
3731
+ decrementRowColumn(paramsOrFirst, ...rest) {
3732
+ let params;
3733
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3734
+ params = (paramsOrFirst || {});
3735
+ }
3736
+ else {
3737
+ params = {
3738
+ databaseId: paramsOrFirst,
3739
+ tableId: rest[0],
3740
+ rowId: rest[1],
3741
+ column: rest[2],
3742
+ value: rest[3],
3743
+ min: rest[4]
3744
+ };
3745
+ }
3746
+ const databaseId = params.databaseId;
3747
+ const tableId = params.tableId;
3748
+ const rowId = params.rowId;
3749
+ const column = params.column;
3750
+ const value = params.value;
3751
+ const min = params.min;
3752
+ if (typeof databaseId === 'undefined') {
3753
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3754
+ }
3755
+ if (typeof tableId === 'undefined') {
3756
+ throw new AppwriteException('Missing required parameter: "tableId"');
3757
+ }
3758
+ if (typeof rowId === 'undefined') {
3759
+ throw new AppwriteException('Missing required parameter: "rowId"');
3760
+ }
3761
+ if (typeof column === 'undefined') {
3762
+ throw new AppwriteException('Missing required parameter: "column"');
3763
+ }
3764
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3765
+ const payload = {};
3766
+ if (typeof value !== 'undefined') {
3767
+ payload['value'] = value;
3768
+ }
3769
+ if (typeof min !== 'undefined') {
3770
+ payload['min'] = min;
3771
+ }
3772
+ const uri = new URL(this.client.config.endpoint + apiPath);
3773
+ return this.client.call('patch', uri, {
3774
+ 'content-type': 'application/json',
3775
+ }, payload);
3776
+ }
3777
+ incrementRowColumn(paramsOrFirst, ...rest) {
3778
+ let params;
3779
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3780
+ params = (paramsOrFirst || {});
3781
+ }
3782
+ else {
3783
+ params = {
3784
+ databaseId: paramsOrFirst,
3785
+ tableId: rest[0],
3786
+ rowId: rest[1],
3787
+ column: rest[2],
3788
+ value: rest[3],
3789
+ max: rest[4]
3790
+ };
3791
+ }
3792
+ const databaseId = params.databaseId;
3793
+ const tableId = params.tableId;
3794
+ const rowId = params.rowId;
3795
+ const column = params.column;
3796
+ const value = params.value;
3797
+ const max = params.max;
3798
+ if (typeof databaseId === 'undefined') {
3799
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3800
+ }
3801
+ if (typeof tableId === 'undefined') {
3802
+ throw new AppwriteException('Missing required parameter: "tableId"');
3803
+ }
3804
+ if (typeof rowId === 'undefined') {
3805
+ throw new AppwriteException('Missing required parameter: "rowId"');
3806
+ }
3807
+ if (typeof column === 'undefined') {
3808
+ throw new AppwriteException('Missing required parameter: "column"');
3809
+ }
3810
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3811
+ const payload = {};
3812
+ if (typeof value !== 'undefined') {
3813
+ payload['value'] = value;
3814
+ }
3815
+ if (typeof max !== 'undefined') {
3816
+ payload['max'] = max;
3817
+ }
3818
+ const uri = new URL(this.client.config.endpoint + apiPath);
3819
+ return this.client.call('patch', uri, {
3820
+ 'content-type': 'application/json',
3821
+ }, payload);
3822
+ }
3823
+ }
3824
+
3825
+ class Teams extends Service {
3826
+ constructor(client) {
3827
+ super(client);
3828
+ }
3829
+ list(paramsOrFirst, ...rest) {
3830
+ let params;
3831
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3832
+ params = (paramsOrFirst || {});
3833
+ }
3834
+ else {
3835
+ params = {
3836
+ queries: paramsOrFirst,
3837
+ search: rest[0]
3838
+ };
3839
+ }
3840
+ const queries = params.queries;
3841
+ const search = params.search;
3321
3842
  const apiPath = '/teams';
3322
3843
  const payload = {};
3323
3844
  if (typeof queries !== 'undefined') {
@@ -3329,18 +3850,21 @@ class Teams extends Service {
3329
3850
  const uri = new URL(this.client.config.endpoint + apiPath);
3330
3851
  return this.client.call('get', uri, {}, payload);
3331
3852
  }
3332
- /**
3333
- * Create a new team. The user who creates the team will automatically be
3334
- * assigned as the owner of the team. Only the users with the owner role can
3335
- * invite new members, add new owners and delete or update the team.
3336
- *
3337
- * @param {string} teamId
3338
- * @param {string} name
3339
- * @param {string[]} roles
3340
- * @throws {AppwriteException}
3341
- * @returns {Promise}
3342
- */
3343
- create(teamId, name, roles) {
3853
+ create(paramsOrFirst, ...rest) {
3854
+ let params;
3855
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3856
+ params = (paramsOrFirst || {});
3857
+ }
3858
+ else {
3859
+ params = {
3860
+ teamId: paramsOrFirst,
3861
+ name: rest[0],
3862
+ roles: rest[1]
3863
+ };
3864
+ }
3865
+ const teamId = params.teamId;
3866
+ const name = params.name;
3867
+ const roles = params.roles;
3344
3868
  if (typeof teamId === 'undefined') {
3345
3869
  throw new AppwriteException('Missing required parameter: "teamId"');
3346
3870
  }
@@ -3363,14 +3887,17 @@ class Teams extends Service {
3363
3887
  'content-type': 'application/json',
3364
3888
  }, payload);
3365
3889
  }
3366
- /**
3367
- * Get a team by its ID. All team members have read access for this resource.
3368
- *
3369
- * @param {string} teamId
3370
- * @throws {AppwriteException}
3371
- * @returns {Promise}
3372
- */
3373
- get(teamId) {
3890
+ get(paramsOrFirst) {
3891
+ let params;
3892
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3893
+ params = (paramsOrFirst || {});
3894
+ }
3895
+ else {
3896
+ params = {
3897
+ teamId: paramsOrFirst
3898
+ };
3899
+ }
3900
+ const teamId = params.teamId;
3374
3901
  if (typeof teamId === 'undefined') {
3375
3902
  throw new AppwriteException('Missing required parameter: "teamId"');
3376
3903
  }
@@ -3379,15 +3906,19 @@ class Teams extends Service {
3379
3906
  const uri = new URL(this.client.config.endpoint + apiPath);
3380
3907
  return this.client.call('get', uri, {}, payload);
3381
3908
  }
3382
- /**
3383
- * Update the team's name by its unique ID.
3384
- *
3385
- * @param {string} teamId
3386
- * @param {string} name
3387
- * @throws {AppwriteException}
3388
- * @returns {Promise}
3389
- */
3390
- updateName(teamId, name) {
3909
+ updateName(paramsOrFirst, ...rest) {
3910
+ let params;
3911
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3912
+ params = (paramsOrFirst || {});
3913
+ }
3914
+ else {
3915
+ params = {
3916
+ teamId: paramsOrFirst,
3917
+ name: rest[0]
3918
+ };
3919
+ }
3920
+ const teamId = params.teamId;
3921
+ const name = params.name;
3391
3922
  if (typeof teamId === 'undefined') {
3392
3923
  throw new AppwriteException('Missing required parameter: "teamId"');
3393
3924
  }
@@ -3404,15 +3935,17 @@ class Teams extends Service {
3404
3935
  'content-type': 'application/json',
3405
3936
  }, payload);
3406
3937
  }
3407
- /**
3408
- * Delete a team using its ID. Only team members with the owner role can
3409
- * delete the team.
3410
- *
3411
- * @param {string} teamId
3412
- * @throws {AppwriteException}
3413
- * @returns {Promise}
3414
- */
3415
- delete(teamId) {
3938
+ delete(paramsOrFirst) {
3939
+ let params;
3940
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3941
+ params = (paramsOrFirst || {});
3942
+ }
3943
+ else {
3944
+ params = {
3945
+ teamId: paramsOrFirst
3946
+ };
3947
+ }
3948
+ const teamId = params.teamId;
3416
3949
  if (typeof teamId === 'undefined') {
3417
3950
  throw new AppwriteException('Missing required parameter: "teamId"');
3418
3951
  }
@@ -3423,18 +3956,21 @@ class Teams extends Service {
3423
3956
  'content-type': 'application/json',
3424
3957
  }, payload);
3425
3958
  }
3426
- /**
3427
- * Use this endpoint to list a team's members using the team's ID. All team
3428
- * members have read access to this endpoint. Hide sensitive attributes from
3429
- * the response by toggling membership privacy in the Console.
3430
- *
3431
- * @param {string} teamId
3432
- * @param {string[]} queries
3433
- * @param {string} search
3434
- * @throws {AppwriteException}
3435
- * @returns {Promise}
3436
- */
3437
- listMemberships(teamId, queries, search) {
3959
+ listMemberships(paramsOrFirst, ...rest) {
3960
+ let params;
3961
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3962
+ params = (paramsOrFirst || {});
3963
+ }
3964
+ else {
3965
+ params = {
3966
+ teamId: paramsOrFirst,
3967
+ queries: rest[0],
3968
+ search: rest[1]
3969
+ };
3970
+ }
3971
+ const teamId = params.teamId;
3972
+ const queries = params.queries;
3973
+ const search = params.search;
3438
3974
  if (typeof teamId === 'undefined') {
3439
3975
  throw new AppwriteException('Missing required parameter: "teamId"');
3440
3976
  }
@@ -3449,40 +3985,29 @@ class Teams extends Service {
3449
3985
  const uri = new URL(this.client.config.endpoint + apiPath);
3450
3986
  return this.client.call('get', uri, {}, payload);
3451
3987
  }
3452
- /**
3453
- * Invite a new member to join your team. Provide an ID for existing users, or
3454
- * invite unregistered users using an email or phone number. If initiated from
3455
- * a Client SDK, Appwrite will send an email or sms with a link to join the
3456
- * team to the invited user, and an account will be created for them if one
3457
- * doesn't exist. If initiated from a Server SDK, the new member will be added
3458
- * automatically to the team.
3459
- *
3460
- * You only need to provide one of a user ID, email, or phone number. Appwrite
3461
- * will prioritize accepting the user ID > email > phone number if you provide
3462
- * more than one of these parameters.
3463
- *
3464
- * Use the `url` parameter to redirect the user from the invitation email to
3465
- * your app. After the user is redirected, use the [Update Team Membership
3466
- * Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus)
3467
- * endpoint to allow the user to accept the invitation to the team.
3468
- *
3469
- * Please note that to avoid a [Redirect
3470
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
3471
- * Appwrite will accept the only redirect URLs under the domains you have
3472
- * added as a platform on the Appwrite Console.
3473
- *
3474
- *
3475
- * @param {string} teamId
3476
- * @param {string[]} roles
3477
- * @param {string} email
3478
- * @param {string} userId
3479
- * @param {string} phone
3480
- * @param {string} url
3481
- * @param {string} name
3482
- * @throws {AppwriteException}
3483
- * @returns {Promise}
3484
- */
3485
- createMembership(teamId, roles, email, userId, phone, url, name) {
3988
+ createMembership(paramsOrFirst, ...rest) {
3989
+ let params;
3990
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3991
+ params = (paramsOrFirst || {});
3992
+ }
3993
+ else {
3994
+ params = {
3995
+ teamId: paramsOrFirst,
3996
+ roles: rest[0],
3997
+ email: rest[1],
3998
+ userId: rest[2],
3999
+ phone: rest[3],
4000
+ url: rest[4],
4001
+ name: rest[5]
4002
+ };
4003
+ }
4004
+ const teamId = params.teamId;
4005
+ const roles = params.roles;
4006
+ const email = params.email;
4007
+ const userId = params.userId;
4008
+ const phone = params.phone;
4009
+ const url = params.url;
4010
+ const name = params.name;
3486
4011
  if (typeof teamId === 'undefined') {
3487
4012
  throw new AppwriteException('Missing required parameter: "teamId"');
3488
4013
  }
@@ -3514,17 +4039,19 @@ class Teams extends Service {
3514
4039
  'content-type': 'application/json',
3515
4040
  }, payload);
3516
4041
  }
3517
- /**
3518
- * Get a team member by the membership unique id. All team members have read
3519
- * access for this resource. Hide sensitive attributes from the response by
3520
- * toggling membership privacy in the Console.
3521
- *
3522
- * @param {string} teamId
3523
- * @param {string} membershipId
3524
- * @throws {AppwriteException}
3525
- * @returns {Promise}
3526
- */
3527
- getMembership(teamId, membershipId) {
4042
+ getMembership(paramsOrFirst, ...rest) {
4043
+ let params;
4044
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4045
+ params = (paramsOrFirst || {});
4046
+ }
4047
+ else {
4048
+ params = {
4049
+ teamId: paramsOrFirst,
4050
+ membershipId: rest[0]
4051
+ };
4052
+ }
4053
+ const teamId = params.teamId;
4054
+ const membershipId = params.membershipId;
3528
4055
  if (typeof teamId === 'undefined') {
3529
4056
  throw new AppwriteException('Missing required parameter: "teamId"');
3530
4057
  }
@@ -3536,19 +4063,21 @@ class Teams extends Service {
3536
4063
  const uri = new URL(this.client.config.endpoint + apiPath);
3537
4064
  return this.client.call('get', uri, {}, payload);
3538
4065
  }
3539
- /**
3540
- * Modify the roles of a team member. Only team members with the owner role
3541
- * have access to this endpoint. Learn more about [roles and
3542
- * permissions](https://appwrite.io/docs/permissions).
3543
- *
3544
- *
3545
- * @param {string} teamId
3546
- * @param {string} membershipId
3547
- * @param {string[]} roles
3548
- * @throws {AppwriteException}
3549
- * @returns {Promise}
3550
- */
3551
- updateMembership(teamId, membershipId, roles) {
4066
+ updateMembership(paramsOrFirst, ...rest) {
4067
+ let params;
4068
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4069
+ params = (paramsOrFirst || {});
4070
+ }
4071
+ else {
4072
+ params = {
4073
+ teamId: paramsOrFirst,
4074
+ membershipId: rest[0],
4075
+ roles: rest[1]
4076
+ };
4077
+ }
4078
+ const teamId = params.teamId;
4079
+ const membershipId = params.membershipId;
4080
+ const roles = params.roles;
3552
4081
  if (typeof teamId === 'undefined') {
3553
4082
  throw new AppwriteException('Missing required parameter: "teamId"');
3554
4083
  }
@@ -3568,17 +4097,19 @@ class Teams extends Service {
3568
4097
  'content-type': 'application/json',
3569
4098
  }, payload);
3570
4099
  }
3571
- /**
3572
- * This endpoint allows a user to leave a team or for a team owner to delete
3573
- * the membership of any other team member. You can also use this endpoint to
3574
- * delete a user membership even if it is not accepted.
3575
- *
3576
- * @param {string} teamId
3577
- * @param {string} membershipId
3578
- * @throws {AppwriteException}
3579
- * @returns {Promise}
3580
- */
3581
- deleteMembership(teamId, membershipId) {
4100
+ deleteMembership(paramsOrFirst, ...rest) {
4101
+ let params;
4102
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4103
+ params = (paramsOrFirst || {});
4104
+ }
4105
+ else {
4106
+ params = {
4107
+ teamId: paramsOrFirst,
4108
+ membershipId: rest[0]
4109
+ };
4110
+ }
4111
+ const teamId = params.teamId;
4112
+ const membershipId = params.membershipId;
3582
4113
  if (typeof teamId === 'undefined') {
3583
4114
  throw new AppwriteException('Missing required parameter: "teamId"');
3584
4115
  }
@@ -3592,23 +4123,23 @@ class Teams extends Service {
3592
4123
  'content-type': 'application/json',
3593
4124
  }, payload);
3594
4125
  }
3595
- /**
3596
- * Use this endpoint to allow a user to accept an invitation to join a team
3597
- * after being redirected back to your app from the invitation email received
3598
- * by the user.
3599
- *
3600
- * If the request is successful, a session for the user is automatically
3601
- * created.
3602
- *
3603
- *
3604
- * @param {string} teamId
3605
- * @param {string} membershipId
3606
- * @param {string} userId
3607
- * @param {string} secret
3608
- * @throws {AppwriteException}
3609
- * @returns {Promise}
3610
- */
3611
- updateMembershipStatus(teamId, membershipId, userId, secret) {
4126
+ updateMembershipStatus(paramsOrFirst, ...rest) {
4127
+ let params;
4128
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4129
+ params = (paramsOrFirst || {});
4130
+ }
4131
+ else {
4132
+ params = {
4133
+ teamId: paramsOrFirst,
4134
+ membershipId: rest[0],
4135
+ userId: rest[1],
4136
+ secret: rest[2]
4137
+ };
4138
+ }
4139
+ const teamId = params.teamId;
4140
+ const membershipId = params.membershipId;
4141
+ const userId = params.userId;
4142
+ const secret = params.secret;
3612
4143
  if (typeof teamId === 'undefined') {
3613
4144
  throw new AppwriteException('Missing required parameter: "teamId"');
3614
4145
  }
@@ -3634,16 +4165,17 @@ class Teams extends Service {
3634
4165
  'content-type': 'application/json',
3635
4166
  }, payload);
3636
4167
  }
3637
- /**
3638
- * Get the team's shared preferences by its unique ID. If a preference doesn't
3639
- * need to be shared by all team members, prefer storing them in [user
3640
- * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
3641
- *
3642
- * @param {string} teamId
3643
- * @throws {AppwriteException}
3644
- * @returns {Promise}
3645
- */
3646
- getPrefs(teamId) {
4168
+ getPrefs(paramsOrFirst) {
4169
+ let params;
4170
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4171
+ params = (paramsOrFirst || {});
4172
+ }
4173
+ else {
4174
+ params = {
4175
+ teamId: paramsOrFirst
4176
+ };
4177
+ }
4178
+ const teamId = params.teamId;
3647
4179
  if (typeof teamId === 'undefined') {
3648
4180
  throw new AppwriteException('Missing required parameter: "teamId"');
3649
4181
  }
@@ -3652,17 +4184,19 @@ class Teams extends Service {
3652
4184
  const uri = new URL(this.client.config.endpoint + apiPath);
3653
4185
  return this.client.call('get', uri, {}, payload);
3654
4186
  }
3655
- /**
3656
- * Update the team's preferences by its unique ID. The object you pass is
3657
- * stored as is and replaces any previous value. The maximum allowed prefs
3658
- * size is 64kB and throws an error if exceeded.
3659
- *
3660
- * @param {string} teamId
3661
- * @param {object} prefs
3662
- * @throws {AppwriteException}
3663
- * @returns {Promise}
3664
- */
3665
- updatePrefs(teamId, prefs) {
4187
+ updatePrefs(paramsOrFirst, ...rest) {
4188
+ let params;
4189
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4190
+ params = (paramsOrFirst || {});
4191
+ }
4192
+ else {
4193
+ params = {
4194
+ teamId: paramsOrFirst,
4195
+ prefs: rest[0]
4196
+ };
4197
+ }
4198
+ const teamId = params.teamId;
4199
+ const prefs = params.prefs;
3666
4200
  if (typeof teamId === 'undefined') {
3667
4201
  throw new AppwriteException('Missing required parameter: "teamId"');
3668
4202
  }
@@ -3721,9 +4255,206 @@ Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, document
3721
4255
  Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
3722
4256
  Query.limit = (limit) => new Query("limit", undefined, limit).toString();
3723
4257
  Query.offset = (offset) => new Query("offset", undefined, offset).toString();
4258
+ /**
4259
+ * Filter resources where attribute contains the specified value.
4260
+ *
4261
+ * @param {string} attribute
4262
+ * @param {string | string[]} value
4263
+ * @returns {string}
4264
+ */
3724
4265
  Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
4266
+ /**
4267
+ * Filter resources where attribute does not contain the specified value.
4268
+ *
4269
+ * @param {string} attribute
4270
+ * @param {string | string[]} value
4271
+ * @returns {string}
4272
+ */
4273
+ Query.notContains = (attribute, value) => new Query("notContains", attribute, value).toString();
4274
+ /**
4275
+ * Filter resources by searching attribute for value (inverse of search).
4276
+ * A fulltext index on attribute is required for this query to work.
4277
+ *
4278
+ * @param {string} attribute
4279
+ * @param {string} value
4280
+ * @returns {string}
4281
+ */
4282
+ Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value).toString();
4283
+ /**
4284
+ * Filter resources where attribute is not between start and end (exclusive).
4285
+ *
4286
+ * @param {string} attribute
4287
+ * @param {string | number} start
4288
+ * @param {string | number} end
4289
+ * @returns {string}
4290
+ */
4291
+ Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
4292
+ /**
4293
+ * Filter resources where attribute does not start with value.
4294
+ *
4295
+ * @param {string} attribute
4296
+ * @param {string} value
4297
+ * @returns {string}
4298
+ */
4299
+ Query.notStartsWith = (attribute, value) => new Query("notStartsWith", attribute, value).toString();
4300
+ /**
4301
+ * Filter resources where attribute does not end with value.
4302
+ *
4303
+ * @param {string} attribute
4304
+ * @param {string} value
4305
+ * @returns {string}
4306
+ */
4307
+ Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, value).toString();
4308
+ /**
4309
+ * Filter resources where document was created before date.
4310
+ *
4311
+ * @param {string} value
4312
+ * @returns {string}
4313
+ */
4314
+ Query.createdBefore = (value) => new Query("createdBefore", undefined, value).toString();
4315
+ /**
4316
+ * Filter resources where document was created after date.
4317
+ *
4318
+ * @param {string} value
4319
+ * @returns {string}
4320
+ */
4321
+ Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toString();
4322
+ /**
4323
+ * Filter resources where document was created between dates.
4324
+ *
4325
+ * @param {string} start
4326
+ * @param {string} end
4327
+ * @returns {string}
4328
+ */
4329
+ Query.createdBetween = (start, end) => new Query("createdBetween", undefined, [start, end]).toString();
4330
+ /**
4331
+ * Filter resources where document was updated before date.
4332
+ *
4333
+ * @param {string} value
4334
+ * @returns {string}
4335
+ */
4336
+ Query.updatedBefore = (value) => new Query("updatedBefore", undefined, value).toString();
4337
+ /**
4338
+ * Filter resources where document was updated after date.
4339
+ *
4340
+ * @param {string} value
4341
+ * @returns {string}
4342
+ */
4343
+ Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toString();
4344
+ /**
4345
+ * Filter resources where document was updated between dates.
4346
+ *
4347
+ * @param {string} start
4348
+ * @param {string} end
4349
+ * @returns {string}
4350
+ */
4351
+ Query.updatedBetween = (start, end) => new Query("updatedBetween", undefined, [start, end]).toString();
3725
4352
  Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
3726
4353
  Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
4354
+ /**
4355
+ * Filter resources where attribute is at a specific distance from the given coordinates.
4356
+ *
4357
+ * @param {string} attribute
4358
+ * @param {any[]} values
4359
+ * @param {number} distance
4360
+ * @param {boolean} meters
4361
+ * @returns {string}
4362
+ */
4363
+ Query.distanceEqual = (attribute, values, distance, meters = true) => new Query("distanceEqual", attribute, [[values, distance, meters]]).toString();
4364
+ /**
4365
+ * Filter resources where attribute is not at a specific distance from the given coordinates.
4366
+ *
4367
+ * @param {string} attribute
4368
+ * @param {any[]} values
4369
+ * @param {number} distance
4370
+ * @param {boolean} meters
4371
+ * @returns {string}
4372
+ */
4373
+ Query.distanceNotEqual = (attribute, values, distance, meters = true) => new Query("distanceNotEqual", attribute, [[values, distance, meters]]).toString();
4374
+ /**
4375
+ * Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
4376
+ *
4377
+ * @param {string} attribute
4378
+ * @param {any[]} values
4379
+ * @param {number} distance
4380
+ * @param {boolean} meters
4381
+ * @returns {string}
4382
+ */
4383
+ Query.distanceGreaterThan = (attribute, values, distance, meters = true) => new Query("distanceGreaterThan", attribute, [[values, distance, meters]]).toString();
4384
+ /**
4385
+ * Filter resources where attribute is at a distance less than the specified value from the given coordinates.
4386
+ *
4387
+ * @param {string} attribute
4388
+ * @param {any[]} values
4389
+ * @param {number} distance
4390
+ * @param {boolean} meters
4391
+ * @returns {string}
4392
+ */
4393
+ Query.distanceLessThan = (attribute, values, distance, meters = true) => new Query("distanceLessThan", attribute, [[values, distance, meters]]).toString();
4394
+ /**
4395
+ * Filter resources where attribute intersects with the given geometry.
4396
+ *
4397
+ * @param {string} attribute
4398
+ * @param {any[]} values
4399
+ * @returns {string}
4400
+ */
4401
+ Query.intersects = (attribute, values) => new Query("intersects", attribute, [values]).toString();
4402
+ /**
4403
+ * Filter resources where attribute does not intersect with the given geometry.
4404
+ *
4405
+ * @param {string} attribute
4406
+ * @param {any[]} values
4407
+ * @returns {string}
4408
+ */
4409
+ Query.notIntersects = (attribute, values) => new Query("notIntersects", attribute, [values]).toString();
4410
+ /**
4411
+ * Filter resources where attribute crosses the given geometry.
4412
+ *
4413
+ * @param {string} attribute
4414
+ * @param {any[]} values
4415
+ * @returns {string}
4416
+ */
4417
+ Query.crosses = (attribute, values) => new Query("crosses", attribute, [values]).toString();
4418
+ /**
4419
+ * Filter resources where attribute does not cross the given geometry.
4420
+ *
4421
+ * @param {string} attribute
4422
+ * @param {any[]} values
4423
+ * @returns {string}
4424
+ */
4425
+ Query.notCrosses = (attribute, values) => new Query("notCrosses", attribute, [values]).toString();
4426
+ /**
4427
+ * Filter resources where attribute overlaps with the given geometry.
4428
+ *
4429
+ * @param {string} attribute
4430
+ * @param {any[]} values
4431
+ * @returns {string}
4432
+ */
4433
+ Query.overlaps = (attribute, values) => new Query("overlaps", attribute, [values]).toString();
4434
+ /**
4435
+ * Filter resources where attribute does not overlap with the given geometry.
4436
+ *
4437
+ * @param {string} attribute
4438
+ * @param {any[]} values
4439
+ * @returns {string}
4440
+ */
4441
+ Query.notOverlaps = (attribute, values) => new Query("notOverlaps", attribute, [values]).toString();
4442
+ /**
4443
+ * Filter resources where attribute touches the given geometry.
4444
+ *
4445
+ * @param {string} attribute
4446
+ * @param {any[]} values
4447
+ * @returns {string}
4448
+ */
4449
+ Query.touches = (attribute, values) => new Query("touches", attribute, [values]).toString();
4450
+ /**
4451
+ * Filter resources where attribute does not touch the given geometry.
4452
+ *
4453
+ * @param {string} attribute
4454
+ * @param {any[]} values
4455
+ * @returns {string}
4456
+ */
4457
+ Query.notTouches = (attribute, values) => new Query("notTouches", attribute, [values]).toString();
3727
4458
 
3728
4459
  class Permission {
3729
4460
  }
@@ -3951,7 +4682,7 @@ exports.CreditCard = void 0;
3951
4682
  CreditCard["Mastercard"] = "mastercard";
3952
4683
  CreditCard["Naranja"] = "naranja";
3953
4684
  CreditCard["TarjetaShopping"] = "targeta-shopping";
3954
- CreditCard["UnionChinaPay"] = "union-china-pay";
4685
+ CreditCard["UnionPay"] = "unionpay";
3955
4686
  CreditCard["Visa"] = "visa";
3956
4687
  CreditCard["MIR"] = "mir";
3957
4688
  CreditCard["Maestro"] = "maestro";
@@ -4165,6 +4896,7 @@ exports.ExecutionMethod = void 0;
4165
4896
  ExecutionMethod["PATCH"] = "PATCH";
4166
4897
  ExecutionMethod["DELETE"] = "DELETE";
4167
4898
  ExecutionMethod["OPTIONS"] = "OPTIONS";
4899
+ ExecutionMethod["HEAD"] = "HEAD";
4168
4900
  })(exports.ExecutionMethod || (exports.ExecutionMethod = {}));
4169
4901
 
4170
4902
  exports.ImageGravity = void 0;
@@ -4205,5 +4937,6 @@ exports.Permission = Permission;
4205
4937
  exports.Query = Query;
4206
4938
  exports.Role = Role;
4207
4939
  exports.Storage = Storage;
4940
+ exports.TablesDB = TablesDB;
4208
4941
  exports.Teams = Teams;
4209
4942
  //# sourceMappingURL=sdk.js.map