react-native-appwrite 0.11.0 → 0.12.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 (125) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1741 -1120
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1741 -1121
  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 +3 -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 +7 -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 +17 -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/index.ts +1 -0
  99. package/src/models.ts +72 -27
  100. package/src/query.ts +95 -0
  101. package/src/services/account.ts +1469 -315
  102. package/src/services/avatars.ts +289 -80
  103. package/src/services/databases.ts +354 -63
  104. package/src/services/functions.ts +115 -20
  105. package/src/services/graphql.ts +52 -4
  106. package/src/services/locale.ts +8 -19
  107. package/src/services/messaging.ts +66 -7
  108. package/src/services/storage.ts +345 -76
  109. package/src/services/tables-db.ts +621 -0
  110. package/src/services/teams.ts +454 -93
  111. package/types/index.d.ts +1 -0
  112. package/types/models.d.ts +69 -25
  113. package/types/query.d.ts +77 -0
  114. package/types/services/account.d.ts +734 -280
  115. package/types/services/avatars.d.ts +168 -73
  116. package/types/services/databases.d.ts +199 -58
  117. package/types/services/functions.d.ts +62 -17
  118. package/types/services/graphql.d.ts +24 -2
  119. package/types/services/locale.d.ts +8 -19
  120. package/types/services/messaging.d.ts +33 -5
  121. package/types/services/storage.d.ts +201 -68
  122. package/types/services/tables-db.d.ts +245 -0
  123. package/types/services/teams.d.ts +242 -80
  124. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  125. /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.12.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
  }
@@ -2299,6 +2422,9 @@ class Databases extends Service {
2299
2422
  if (typeof data === 'undefined') {
2300
2423
  throw new AppwriteException('Missing required parameter: "data"');
2301
2424
  }
2425
+ data === null || data === void 0 ? true : delete data.$sequence;
2426
+ data === null || data === void 0 ? true : delete data.$collectionId;
2427
+ data === null || data === void 0 ? true : delete data.$databaseId;
2302
2428
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2303
2429
  const payload = {};
2304
2430
  if (typeof documentId !== 'undefined') {
@@ -2315,18 +2441,23 @@ class Databases extends Service {
2315
2441
  'content-type': 'application/json',
2316
2442
  }, payload);
2317
2443
  }
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) {
2444
+ getDocument(paramsOrFirst, ...rest) {
2445
+ let params;
2446
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2447
+ params = (paramsOrFirst || {});
2448
+ }
2449
+ else {
2450
+ params = {
2451
+ databaseId: paramsOrFirst,
2452
+ collectionId: rest[0],
2453
+ documentId: rest[1],
2454
+ queries: rest[2]
2455
+ };
2456
+ }
2457
+ const databaseId = params.databaseId;
2458
+ const collectionId = params.collectionId;
2459
+ const documentId = params.documentId;
2460
+ const queries = params.queries;
2330
2461
  if (typeof databaseId === 'undefined') {
2331
2462
  throw new AppwriteException('Missing required parameter: "databaseId"');
2332
2463
  }
@@ -2344,25 +2475,25 @@ class Databases extends Service {
2344
2475
  const uri = new URL(this.client.config.endpoint + apiPath);
2345
2476
  return this.client.call('get', uri, {}, payload);
2346
2477
  }
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) {
2478
+ upsertDocument(paramsOrFirst, ...rest) {
2479
+ let params;
2480
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2481
+ params = (paramsOrFirst || {});
2482
+ }
2483
+ else {
2484
+ params = {
2485
+ databaseId: paramsOrFirst,
2486
+ collectionId: rest[0],
2487
+ documentId: rest[1],
2488
+ data: rest[2],
2489
+ permissions: rest[3]
2490
+ };
2491
+ }
2492
+ const databaseId = params.databaseId;
2493
+ const collectionId = params.collectionId;
2494
+ const documentId = params.documentId;
2495
+ const data = params.data;
2496
+ const permissions = params.permissions;
2366
2497
  if (typeof databaseId === 'undefined') {
2367
2498
  throw new AppwriteException('Missing required parameter: "databaseId"');
2368
2499
  }
@@ -2375,6 +2506,9 @@ class Databases extends Service {
2375
2506
  if (typeof data === 'undefined') {
2376
2507
  throw new AppwriteException('Missing required parameter: "data"');
2377
2508
  }
2509
+ data === null || data === void 0 ? true : delete data.$sequence;
2510
+ data === null || data === void 0 ? true : delete data.$collectionId;
2511
+ data === null || data === void 0 ? true : delete data.$databaseId;
2378
2512
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2379
2513
  const payload = {};
2380
2514
  if (typeof data !== 'undefined') {
@@ -2388,19 +2522,25 @@ class Databases extends Service {
2388
2522
  'content-type': 'application/json',
2389
2523
  }, payload);
2390
2524
  }
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) {
2525
+ updateDocument(paramsOrFirst, ...rest) {
2526
+ let params;
2527
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2528
+ params = (paramsOrFirst || {});
2529
+ }
2530
+ else {
2531
+ params = {
2532
+ databaseId: paramsOrFirst,
2533
+ collectionId: rest[0],
2534
+ documentId: rest[1],
2535
+ data: rest[2],
2536
+ permissions: rest[3]
2537
+ };
2538
+ }
2539
+ const databaseId = params.databaseId;
2540
+ const collectionId = params.collectionId;
2541
+ const documentId = params.documentId;
2542
+ const data = params.data;
2543
+ const permissions = params.permissions;
2404
2544
  if (typeof databaseId === 'undefined') {
2405
2545
  throw new AppwriteException('Missing required parameter: "databaseId"');
2406
2546
  }
@@ -2410,6 +2550,9 @@ class Databases extends Service {
2410
2550
  if (typeof documentId === 'undefined') {
2411
2551
  throw new AppwriteException('Missing required parameter: "documentId"');
2412
2552
  }
2553
+ data === null || data === void 0 ? true : delete data.$sequence;
2554
+ data === null || data === void 0 ? true : delete data.$collectionId;
2555
+ data === null || data === void 0 ? true : delete data.$databaseId;
2413
2556
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2414
2557
  const payload = {};
2415
2558
  if (typeof data !== 'undefined') {
@@ -2423,16 +2566,21 @@ class Databases extends Service {
2423
2566
  'content-type': 'application/json',
2424
2567
  }, payload);
2425
2568
  }
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) {
2569
+ deleteDocument(paramsOrFirst, ...rest) {
2570
+ let params;
2571
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2572
+ params = (paramsOrFirst || {});
2573
+ }
2574
+ else {
2575
+ params = {
2576
+ databaseId: paramsOrFirst,
2577
+ collectionId: rest[0],
2578
+ documentId: rest[1]
2579
+ };
2580
+ }
2581
+ const databaseId = params.databaseId;
2582
+ const collectionId = params.collectionId;
2583
+ const documentId = params.documentId;
2436
2584
  if (typeof databaseId === 'undefined') {
2437
2585
  throw new AppwriteException('Missing required parameter: "databaseId"');
2438
2586
  }
@@ -2449,19 +2597,27 @@ class Databases extends Service {
2449
2597
  'content-type': 'application/json',
2450
2598
  }, payload);
2451
2599
  }
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) {
2600
+ decrementDocumentAttribute(paramsOrFirst, ...rest) {
2601
+ let params;
2602
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2603
+ params = (paramsOrFirst || {});
2604
+ }
2605
+ else {
2606
+ params = {
2607
+ databaseId: paramsOrFirst,
2608
+ collectionId: rest[0],
2609
+ documentId: rest[1],
2610
+ attribute: rest[2],
2611
+ value: rest[3],
2612
+ min: rest[4]
2613
+ };
2614
+ }
2615
+ const databaseId = params.databaseId;
2616
+ const collectionId = params.collectionId;
2617
+ const documentId = params.documentId;
2618
+ const attribute = params.attribute;
2619
+ const value = params.value;
2620
+ const min = params.min;
2465
2621
  if (typeof databaseId === 'undefined') {
2466
2622
  throw new AppwriteException('Missing required parameter: "databaseId"');
2467
2623
  }
@@ -2487,19 +2643,27 @@ class Databases extends Service {
2487
2643
  'content-type': 'application/json',
2488
2644
  }, payload);
2489
2645
  }
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) {
2646
+ incrementDocumentAttribute(paramsOrFirst, ...rest) {
2647
+ let params;
2648
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2649
+ params = (paramsOrFirst || {});
2650
+ }
2651
+ else {
2652
+ params = {
2653
+ databaseId: paramsOrFirst,
2654
+ collectionId: rest[0],
2655
+ documentId: rest[1],
2656
+ attribute: rest[2],
2657
+ value: rest[3],
2658
+ max: rest[4]
2659
+ };
2660
+ }
2661
+ const databaseId = params.databaseId;
2662
+ const collectionId = params.collectionId;
2663
+ const documentId = params.documentId;
2664
+ const attribute = params.attribute;
2665
+ const value = params.value;
2666
+ const max = params.max;
2503
2667
  if (typeof databaseId === 'undefined') {
2504
2668
  throw new AppwriteException('Missing required parameter: "databaseId"');
2505
2669
  }
@@ -2531,16 +2695,19 @@ class Functions extends Service {
2531
2695
  constructor(client) {
2532
2696
  super(client);
2533
2697
  }
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) {
2698
+ listExecutions(paramsOrFirst, ...rest) {
2699
+ let params;
2700
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2701
+ params = (paramsOrFirst || {});
2702
+ }
2703
+ else {
2704
+ params = {
2705
+ functionId: paramsOrFirst,
2706
+ queries: rest[0]
2707
+ };
2708
+ }
2709
+ const functionId = params.functionId;
2710
+ const queries = params.queries;
2544
2711
  if (typeof functionId === 'undefined') {
2545
2712
  throw new AppwriteException('Missing required parameter: "functionId"');
2546
2713
  }
@@ -2552,23 +2719,29 @@ class Functions extends Service {
2552
2719
  const uri = new URL(this.client.config.endpoint + apiPath);
2553
2720
  return this.client.call('get', uri, {}, payload);
2554
2721
  }
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) {
2722
+ createExecution(paramsOrFirst, ...rest) {
2723
+ let params;
2724
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2725
+ params = (paramsOrFirst || {});
2726
+ }
2727
+ else {
2728
+ params = {
2729
+ functionId: paramsOrFirst,
2730
+ body: rest[0],
2731
+ async: rest[1],
2732
+ xpath: rest[2],
2733
+ method: rest[3],
2734
+ headers: rest[4],
2735
+ scheduledAt: rest[5]
2736
+ };
2737
+ }
2738
+ const functionId = params.functionId;
2739
+ const body = params.body;
2740
+ const async = params.async;
2741
+ const xpath = params.xpath;
2742
+ const method = params.method;
2743
+ const headers = params.headers;
2744
+ const scheduledAt = params.scheduledAt;
2572
2745
  if (typeof functionId === 'undefined') {
2573
2746
  throw new AppwriteException('Missing required parameter: "functionId"');
2574
2747
  }
@@ -2597,15 +2770,19 @@ class Functions extends Service {
2597
2770
  'content-type': 'application/json',
2598
2771
  }, payload);
2599
2772
  }
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) {
2773
+ getExecution(paramsOrFirst, ...rest) {
2774
+ let params;
2775
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2776
+ params = (paramsOrFirst || {});
2777
+ }
2778
+ else {
2779
+ params = {
2780
+ functionId: paramsOrFirst,
2781
+ executionId: rest[0]
2782
+ };
2783
+ }
2784
+ const functionId = params.functionId;
2785
+ const executionId = params.executionId;
2609
2786
  if (typeof functionId === 'undefined') {
2610
2787
  throw new AppwriteException('Missing required parameter: "functionId"');
2611
2788
  }
@@ -2623,14 +2800,17 @@ class Graphql extends Service {
2623
2800
  constructor(client) {
2624
2801
  super(client);
2625
2802
  }
2626
- /**
2627
- * Execute a GraphQL mutation.
2628
- *
2629
- * @param {object} query
2630
- * @throws {AppwriteException}
2631
- * @returns {Promise}
2632
- */
2633
- query(query) {
2803
+ query(paramsOrFirst) {
2804
+ let params;
2805
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2806
+ params = (paramsOrFirst || {});
2807
+ }
2808
+ else {
2809
+ params = {
2810
+ query: paramsOrFirst
2811
+ };
2812
+ }
2813
+ const query = params.query;
2634
2814
  if (typeof query === 'undefined') {
2635
2815
  throw new AppwriteException('Missing required parameter: "query"');
2636
2816
  }
@@ -2645,14 +2825,17 @@ class Graphql extends Service {
2645
2825
  'content-type': 'application/json',
2646
2826
  }, payload);
2647
2827
  }
2648
- /**
2649
- * Execute a GraphQL mutation.
2650
- *
2651
- * @param {object} query
2652
- * @throws {AppwriteException}
2653
- * @returns {Promise}
2654
- */
2655
- mutation(query) {
2828
+ mutation(paramsOrFirst) {
2829
+ let params;
2830
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2831
+ params = (paramsOrFirst || {});
2832
+ }
2833
+ else {
2834
+ params = {
2835
+ query: paramsOrFirst
2836
+ };
2837
+ }
2838
+ const query = params.query;
2656
2839
  if (typeof query === 'undefined') {
2657
2840
  throw new AppwriteException('Missing required parameter: "query"');
2658
2841
  }
@@ -2674,10 +2857,7 @@ class Locale extends Service {
2674
2857
  super(client);
2675
2858
  }
2676
2859
  /**
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.
2860
+ * 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
2861
  *
2682
2862
  * ([IP Geolocation by DB-IP](https://db-ip.com))
2683
2863
  *
@@ -2691,8 +2871,7 @@ class Locale extends Service {
2691
2871
  return this.client.call('get', uri, {}, payload);
2692
2872
  }
2693
2873
  /**
2694
- * List of all locale codes in [ISO
2695
- * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2874
+ * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2696
2875
  *
2697
2876
  * @throws {AppwriteException}
2698
2877
  * @returns {Promise}
@@ -2704,8 +2883,7 @@ class Locale extends Service {
2704
2883
  return this.client.call('get', uri, {}, payload);
2705
2884
  }
2706
2885
  /**
2707
- * List of all continents. You can use the locale header to get the data in a
2708
- * supported language.
2886
+ * List of all continents. You can use the locale header to get the data in a supported language.
2709
2887
  *
2710
2888
  * @throws {AppwriteException}
2711
2889
  * @returns {Promise}
@@ -2717,8 +2895,7 @@ class Locale extends Service {
2717
2895
  return this.client.call('get', uri, {}, payload);
2718
2896
  }
2719
2897
  /**
2720
- * List of all countries. You can use the locale header to get the data in a
2721
- * supported language.
2898
+ * List of all countries. You can use the locale header to get the data in a supported language.
2722
2899
  *
2723
2900
  * @throws {AppwriteException}
2724
2901
  * @returns {Promise}
@@ -2730,8 +2907,7 @@ class Locale extends Service {
2730
2907
  return this.client.call('get', uri, {}, payload);
2731
2908
  }
2732
2909
  /**
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.
2910
+ * 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
2911
  *
2736
2912
  * @throws {AppwriteException}
2737
2913
  * @returns {Promise}
@@ -2743,8 +2919,7 @@ class Locale extends Service {
2743
2919
  return this.client.call('get', uri, {}, payload);
2744
2920
  }
2745
2921
  /**
2746
- * List of all countries phone codes. You can use the locale header to get the
2747
- * data in a supported language.
2922
+ * List of all countries phone codes. You can use the locale header to get the data in a supported language.
2748
2923
  *
2749
2924
  * @throws {AppwriteException}
2750
2925
  * @returns {Promise}
@@ -2756,9 +2931,7 @@ class Locale extends Service {
2756
2931
  return this.client.call('get', uri, {}, payload);
2757
2932
  }
2758
2933
  /**
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.
2934
+ * 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
2935
  *
2763
2936
  * @throws {AppwriteException}
2764
2937
  * @returns {Promise}
@@ -2770,8 +2943,7 @@ class Locale extends Service {
2770
2943
  return this.client.call('get', uri, {}, payload);
2771
2944
  }
2772
2945
  /**
2773
- * List of all languages classified by ISO 639-1 including 2-letter code, name
2774
- * in English, and name in the respective language.
2946
+ * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
2775
2947
  *
2776
2948
  * @throws {AppwriteException}
2777
2949
  * @returns {Promise}
@@ -2788,16 +2960,21 @@ class Messaging extends Service {
2788
2960
  constructor(client) {
2789
2961
  super(client);
2790
2962
  }
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) {
2963
+ createSubscriber(paramsOrFirst, ...rest) {
2964
+ let params;
2965
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2966
+ params = (paramsOrFirst || {});
2967
+ }
2968
+ else {
2969
+ params = {
2970
+ topicId: paramsOrFirst,
2971
+ subscriberId: rest[0],
2972
+ targetId: rest[1]
2973
+ };
2974
+ }
2975
+ const topicId = params.topicId;
2976
+ const subscriberId = params.subscriberId;
2977
+ const targetId = params.targetId;
2801
2978
  if (typeof topicId === 'undefined') {
2802
2979
  throw new AppwriteException('Missing required parameter: "topicId"');
2803
2980
  }
@@ -2820,15 +2997,19 @@ class Messaging extends Service {
2820
2997
  'content-type': 'application/json',
2821
2998
  }, payload);
2822
2999
  }
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) {
3000
+ deleteSubscriber(paramsOrFirst, ...rest) {
3001
+ let params;
3002
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3003
+ params = (paramsOrFirst || {});
3004
+ }
3005
+ else {
3006
+ params = {
3007
+ topicId: paramsOrFirst,
3008
+ subscriberId: rest[0]
3009
+ };
3010
+ }
3011
+ const topicId = params.topicId;
3012
+ const subscriberId = params.subscriberId;
2832
3013
  if (typeof topicId === 'undefined') {
2833
3014
  throw new AppwriteException('Missing required parameter: "topicId"');
2834
3015
  }
@@ -2848,17 +3029,21 @@ class Storage extends Service {
2848
3029
  constructor(client) {
2849
3030
  super(client);
2850
3031
  }
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) {
3032
+ listFiles(paramsOrFirst, ...rest) {
3033
+ let params;
3034
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3035
+ params = (paramsOrFirst || {});
3036
+ }
3037
+ else {
3038
+ params = {
3039
+ bucketId: paramsOrFirst,
3040
+ queries: rest[0],
3041
+ search: rest[1]
3042
+ };
3043
+ }
3044
+ const bucketId = params.bucketId;
3045
+ const queries = params.queries;
3046
+ const search = params.search;
2862
3047
  if (typeof bucketId === 'undefined') {
2863
3048
  throw new AppwriteException('Missing required parameter: "bucketId"');
2864
3049
  }
@@ -2873,35 +3058,27 @@ class Storage extends Service {
2873
3058
  const uri = new URL(this.client.config.endpoint + apiPath);
2874
3059
  return this.client.call('get', uri, {}, payload);
2875
3060
  }
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) => { }) {
3061
+ createFile(paramsOrFirst, ...rest) {
3062
+ return __awaiter(this, void 0, void 0, function* () {
3063
+ let params;
3064
+ let onProgress;
3065
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3066
+ params = (paramsOrFirst || {});
3067
+ onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
3068
+ }
3069
+ else {
3070
+ params = {
3071
+ bucketId: paramsOrFirst,
3072
+ fileId: rest[0],
3073
+ file: rest[1],
3074
+ permissions: rest[2]
3075
+ };
3076
+ onProgress = rest[3];
3077
+ }
3078
+ const bucketId = params.bucketId;
3079
+ const fileId = params.fileId;
3080
+ const file = params.file;
3081
+ const permissions = params.permissions;
2905
3082
  if (typeof bucketId === 'undefined') {
2906
3083
  throw new AppwriteException('Missing required parameter: "bucketId"');
2907
3084
  }
@@ -2973,16 +3150,19 @@ class Storage extends Service {
2973
3150
  return response;
2974
3151
  });
2975
3152
  }
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) {
3153
+ getFile(paramsOrFirst, ...rest) {
3154
+ let params;
3155
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3156
+ params = (paramsOrFirst || {});
3157
+ }
3158
+ else {
3159
+ params = {
3160
+ bucketId: paramsOrFirst,
3161
+ fileId: rest[0]
3162
+ };
3163
+ }
3164
+ const bucketId = params.bucketId;
3165
+ const fileId = params.fileId;
2986
3166
  if (typeof bucketId === 'undefined') {
2987
3167
  throw new AppwriteException('Missing required parameter: "bucketId"');
2988
3168
  }
@@ -2994,18 +3174,23 @@ class Storage extends Service {
2994
3174
  const uri = new URL(this.client.config.endpoint + apiPath);
2995
3175
  return this.client.call('get', uri, {}, payload);
2996
3176
  }
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) {
3177
+ updateFile(paramsOrFirst, ...rest) {
3178
+ let params;
3179
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3180
+ params = (paramsOrFirst || {});
3181
+ }
3182
+ else {
3183
+ params = {
3184
+ bucketId: paramsOrFirst,
3185
+ fileId: rest[0],
3186
+ name: rest[1],
3187
+ permissions: rest[2]
3188
+ };
3189
+ }
3190
+ const bucketId = params.bucketId;
3191
+ const fileId = params.fileId;
3192
+ const name = params.name;
3193
+ const permissions = params.permissions;
3009
3194
  if (typeof bucketId === 'undefined') {
3010
3195
  throw new AppwriteException('Missing required parameter: "bucketId"');
3011
3196
  }
@@ -3025,16 +3210,19 @@ class Storage extends Service {
3025
3210
  'content-type': 'application/json',
3026
3211
  }, payload);
3027
3212
  }
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) {
3213
+ deleteFile(paramsOrFirst, ...rest) {
3214
+ let params;
3215
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3216
+ params = (paramsOrFirst || {});
3217
+ }
3218
+ else {
3219
+ params = {
3220
+ bucketId: paramsOrFirst,
3221
+ fileId: rest[0]
3222
+ };
3223
+ }
3224
+ const bucketId = params.bucketId;
3225
+ const fileId = params.fileId;
3038
3226
  if (typeof bucketId === 'undefined') {
3039
3227
  throw new AppwriteException('Missing required parameter: "bucketId"');
3040
3228
  }
@@ -3048,18 +3236,21 @@ class Storage extends Service {
3048
3236
  'content-type': 'application/json',
3049
3237
  }, payload);
3050
3238
  }
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) {
3239
+ getFileDownload(paramsOrFirst, ...rest) {
3240
+ let params;
3241
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3242
+ params = (paramsOrFirst || {});
3243
+ }
3244
+ else {
3245
+ params = {
3246
+ bucketId: paramsOrFirst,
3247
+ fileId: rest[0],
3248
+ token: rest[1]
3249
+ };
3250
+ }
3251
+ const bucketId = params.bucketId;
3252
+ const fileId = params.fileId;
3253
+ const token = params.token;
3063
3254
  if (typeof bucketId === 'undefined') {
3064
3255
  throw new AppwriteException('Missing required parameter: "bucketId"');
3065
3256
  }
@@ -3078,31 +3269,43 @@ class Storage extends Service {
3078
3269
  }
3079
3270
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3080
3271
  }
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) {
3272
+ getFilePreview(paramsOrFirst, ...rest) {
3273
+ let params;
3274
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3275
+ params = (paramsOrFirst || {});
3276
+ }
3277
+ else {
3278
+ params = {
3279
+ bucketId: paramsOrFirst,
3280
+ fileId: rest[0],
3281
+ width: rest[1],
3282
+ height: rest[2],
3283
+ gravity: rest[3],
3284
+ quality: rest[4],
3285
+ borderWidth: rest[5],
3286
+ borderColor: rest[6],
3287
+ borderRadius: rest[7],
3288
+ opacity: rest[8],
3289
+ rotation: rest[9],
3290
+ background: rest[10],
3291
+ output: rest[11],
3292
+ token: rest[12]
3293
+ };
3294
+ }
3295
+ const bucketId = params.bucketId;
3296
+ const fileId = params.fileId;
3297
+ const width = params.width;
3298
+ const height = params.height;
3299
+ const gravity = params.gravity;
3300
+ const quality = params.quality;
3301
+ const borderWidth = params.borderWidth;
3302
+ const borderColor = params.borderColor;
3303
+ const borderRadius = params.borderRadius;
3304
+ const opacity = params.opacity;
3305
+ const rotation = params.rotation;
3306
+ const background = params.background;
3307
+ const output = params.output;
3308
+ const token = params.token;
3106
3309
  if (typeof bucketId === 'undefined') {
3107
3310
  throw new AppwriteException('Missing required parameter: "bucketId"');
3108
3311
  }
@@ -3154,18 +3357,21 @@ class Storage extends Service {
3154
3357
  }
3155
3358
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3156
3359
  }
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) {
3360
+ getFileView(paramsOrFirst, ...rest) {
3361
+ let params;
3362
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3363
+ params = (paramsOrFirst || {});
3364
+ }
3365
+ else {
3366
+ params = {
3367
+ bucketId: paramsOrFirst,
3368
+ fileId: rest[0],
3369
+ token: rest[1]
3370
+ };
3371
+ }
3372
+ const bucketId = params.bucketId;
3373
+ const fileId = params.fileId;
3374
+ const token = params.token;
3169
3375
  if (typeof bucketId === 'undefined') {
3170
3376
  throw new AppwriteException('Missing required parameter: "bucketId"');
3171
3377
  }
@@ -3304,20 +3510,344 @@ class Storage extends Service {
3304
3510
  }
3305
3511
  }
3306
3512
 
3307
- class Teams extends Service {
3513
+ class TablesDB extends Service {
3308
3514
  constructor(client) {
3309
3515
  super(client);
3310
3516
  }
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) {
3517
+ listRows(paramsOrFirst, ...rest) {
3518
+ let params;
3519
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3520
+ params = (paramsOrFirst || {});
3521
+ }
3522
+ else {
3523
+ params = {
3524
+ databaseId: paramsOrFirst,
3525
+ tableId: rest[0],
3526
+ queries: rest[1]
3527
+ };
3528
+ }
3529
+ const databaseId = params.databaseId;
3530
+ const tableId = params.tableId;
3531
+ const queries = params.queries;
3532
+ if (typeof databaseId === 'undefined') {
3533
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3534
+ }
3535
+ if (typeof tableId === 'undefined') {
3536
+ throw new AppwriteException('Missing required parameter: "tableId"');
3537
+ }
3538
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3539
+ const payload = {};
3540
+ if (typeof queries !== 'undefined') {
3541
+ payload['queries'] = queries;
3542
+ }
3543
+ const uri = new URL(this.client.config.endpoint + apiPath);
3544
+ return this.client.call('get', uri, {}, payload);
3545
+ }
3546
+ createRow(paramsOrFirst, ...rest) {
3547
+ let params;
3548
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3549
+ params = (paramsOrFirst || {});
3550
+ }
3551
+ else {
3552
+ params = {
3553
+ databaseId: paramsOrFirst,
3554
+ tableId: rest[0],
3555
+ rowId: rest[1],
3556
+ data: rest[2],
3557
+ permissions: rest[3]
3558
+ };
3559
+ }
3560
+ const databaseId = params.databaseId;
3561
+ const tableId = params.tableId;
3562
+ const rowId = params.rowId;
3563
+ const data = params.data;
3564
+ const permissions = params.permissions;
3565
+ if (typeof databaseId === 'undefined') {
3566
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3567
+ }
3568
+ if (typeof tableId === 'undefined') {
3569
+ throw new AppwriteException('Missing required parameter: "tableId"');
3570
+ }
3571
+ if (typeof rowId === 'undefined') {
3572
+ throw new AppwriteException('Missing required parameter: "rowId"');
3573
+ }
3574
+ if (typeof data === 'undefined') {
3575
+ throw new AppwriteException('Missing required parameter: "data"');
3576
+ }
3577
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3578
+ const payload = {};
3579
+ if (typeof rowId !== 'undefined') {
3580
+ payload['rowId'] = rowId;
3581
+ }
3582
+ if (typeof data !== 'undefined') {
3583
+ payload['data'] = data;
3584
+ }
3585
+ if (typeof permissions !== 'undefined') {
3586
+ payload['permissions'] = permissions;
3587
+ }
3588
+ const uri = new URL(this.client.config.endpoint + apiPath);
3589
+ return this.client.call('post', uri, {
3590
+ 'content-type': 'application/json',
3591
+ }, payload);
3592
+ }
3593
+ getRow(paramsOrFirst, ...rest) {
3594
+ let params;
3595
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3596
+ params = (paramsOrFirst || {});
3597
+ }
3598
+ else {
3599
+ params = {
3600
+ databaseId: paramsOrFirst,
3601
+ tableId: rest[0],
3602
+ rowId: rest[1],
3603
+ queries: rest[2]
3604
+ };
3605
+ }
3606
+ const databaseId = params.databaseId;
3607
+ const tableId = params.tableId;
3608
+ const rowId = params.rowId;
3609
+ const queries = params.queries;
3610
+ if (typeof databaseId === 'undefined') {
3611
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3612
+ }
3613
+ if (typeof tableId === 'undefined') {
3614
+ throw new AppwriteException('Missing required parameter: "tableId"');
3615
+ }
3616
+ if (typeof rowId === 'undefined') {
3617
+ throw new AppwriteException('Missing required parameter: "rowId"');
3618
+ }
3619
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3620
+ const payload = {};
3621
+ if (typeof queries !== 'undefined') {
3622
+ payload['queries'] = queries;
3623
+ }
3624
+ const uri = new URL(this.client.config.endpoint + apiPath);
3625
+ return this.client.call('get', uri, {}, payload);
3626
+ }
3627
+ upsertRow(paramsOrFirst, ...rest) {
3628
+ let params;
3629
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3630
+ params = (paramsOrFirst || {});
3631
+ }
3632
+ else {
3633
+ params = {
3634
+ databaseId: paramsOrFirst,
3635
+ tableId: rest[0],
3636
+ rowId: rest[1],
3637
+ data: rest[2],
3638
+ permissions: rest[3]
3639
+ };
3640
+ }
3641
+ const databaseId = params.databaseId;
3642
+ const tableId = params.tableId;
3643
+ const rowId = params.rowId;
3644
+ const data = params.data;
3645
+ const permissions = params.permissions;
3646
+ if (typeof databaseId === 'undefined') {
3647
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3648
+ }
3649
+ if (typeof tableId === 'undefined') {
3650
+ throw new AppwriteException('Missing required parameter: "tableId"');
3651
+ }
3652
+ if (typeof rowId === 'undefined') {
3653
+ throw new AppwriteException('Missing required parameter: "rowId"');
3654
+ }
3655
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3656
+ const payload = {};
3657
+ if (typeof data !== 'undefined') {
3658
+ payload['data'] = data;
3659
+ }
3660
+ if (typeof permissions !== 'undefined') {
3661
+ payload['permissions'] = permissions;
3662
+ }
3663
+ const uri = new URL(this.client.config.endpoint + apiPath);
3664
+ return this.client.call('put', uri, {
3665
+ 'content-type': 'application/json',
3666
+ }, payload);
3667
+ }
3668
+ updateRow(paramsOrFirst, ...rest) {
3669
+ let params;
3670
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3671
+ params = (paramsOrFirst || {});
3672
+ }
3673
+ else {
3674
+ params = {
3675
+ databaseId: paramsOrFirst,
3676
+ tableId: rest[0],
3677
+ rowId: rest[1],
3678
+ data: rest[2],
3679
+ permissions: rest[3]
3680
+ };
3681
+ }
3682
+ const databaseId = params.databaseId;
3683
+ const tableId = params.tableId;
3684
+ const rowId = params.rowId;
3685
+ const data = params.data;
3686
+ const permissions = params.permissions;
3687
+ if (typeof databaseId === 'undefined') {
3688
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3689
+ }
3690
+ if (typeof tableId === 'undefined') {
3691
+ throw new AppwriteException('Missing required parameter: "tableId"');
3692
+ }
3693
+ if (typeof rowId === 'undefined') {
3694
+ throw new AppwriteException('Missing required parameter: "rowId"');
3695
+ }
3696
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3697
+ const payload = {};
3698
+ if (typeof data !== 'undefined') {
3699
+ payload['data'] = data;
3700
+ }
3701
+ if (typeof permissions !== 'undefined') {
3702
+ payload['permissions'] = permissions;
3703
+ }
3704
+ const uri = new URL(this.client.config.endpoint + apiPath);
3705
+ return this.client.call('patch', uri, {
3706
+ 'content-type': 'application/json',
3707
+ }, payload);
3708
+ }
3709
+ deleteRow(paramsOrFirst, ...rest) {
3710
+ let params;
3711
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3712
+ params = (paramsOrFirst || {});
3713
+ }
3714
+ else {
3715
+ params = {
3716
+ databaseId: paramsOrFirst,
3717
+ tableId: rest[0],
3718
+ rowId: rest[1]
3719
+ };
3720
+ }
3721
+ const databaseId = params.databaseId;
3722
+ const tableId = params.tableId;
3723
+ const rowId = params.rowId;
3724
+ if (typeof databaseId === 'undefined') {
3725
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3726
+ }
3727
+ if (typeof tableId === 'undefined') {
3728
+ throw new AppwriteException('Missing required parameter: "tableId"');
3729
+ }
3730
+ if (typeof rowId === 'undefined') {
3731
+ throw new AppwriteException('Missing required parameter: "rowId"');
3732
+ }
3733
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3734
+ const payload = {};
3735
+ const uri = new URL(this.client.config.endpoint + apiPath);
3736
+ return this.client.call('delete', uri, {
3737
+ 'content-type': 'application/json',
3738
+ }, payload);
3739
+ }
3740
+ decrementRowColumn(paramsOrFirst, ...rest) {
3741
+ let params;
3742
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3743
+ params = (paramsOrFirst || {});
3744
+ }
3745
+ else {
3746
+ params = {
3747
+ databaseId: paramsOrFirst,
3748
+ tableId: rest[0],
3749
+ rowId: rest[1],
3750
+ column: rest[2],
3751
+ value: rest[3],
3752
+ min: rest[4]
3753
+ };
3754
+ }
3755
+ const databaseId = params.databaseId;
3756
+ const tableId = params.tableId;
3757
+ const rowId = params.rowId;
3758
+ const column = params.column;
3759
+ const value = params.value;
3760
+ const min = params.min;
3761
+ if (typeof databaseId === 'undefined') {
3762
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3763
+ }
3764
+ if (typeof tableId === 'undefined') {
3765
+ throw new AppwriteException('Missing required parameter: "tableId"');
3766
+ }
3767
+ if (typeof rowId === 'undefined') {
3768
+ throw new AppwriteException('Missing required parameter: "rowId"');
3769
+ }
3770
+ if (typeof column === 'undefined') {
3771
+ throw new AppwriteException('Missing required parameter: "column"');
3772
+ }
3773
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3774
+ const payload = {};
3775
+ if (typeof value !== 'undefined') {
3776
+ payload['value'] = value;
3777
+ }
3778
+ if (typeof min !== 'undefined') {
3779
+ payload['min'] = min;
3780
+ }
3781
+ const uri = new URL(this.client.config.endpoint + apiPath);
3782
+ return this.client.call('patch', uri, {
3783
+ 'content-type': 'application/json',
3784
+ }, payload);
3785
+ }
3786
+ incrementRowColumn(paramsOrFirst, ...rest) {
3787
+ let params;
3788
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3789
+ params = (paramsOrFirst || {});
3790
+ }
3791
+ else {
3792
+ params = {
3793
+ databaseId: paramsOrFirst,
3794
+ tableId: rest[0],
3795
+ rowId: rest[1],
3796
+ column: rest[2],
3797
+ value: rest[3],
3798
+ max: rest[4]
3799
+ };
3800
+ }
3801
+ const databaseId = params.databaseId;
3802
+ const tableId = params.tableId;
3803
+ const rowId = params.rowId;
3804
+ const column = params.column;
3805
+ const value = params.value;
3806
+ const max = params.max;
3807
+ if (typeof databaseId === 'undefined') {
3808
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3809
+ }
3810
+ if (typeof tableId === 'undefined') {
3811
+ throw new AppwriteException('Missing required parameter: "tableId"');
3812
+ }
3813
+ if (typeof rowId === 'undefined') {
3814
+ throw new AppwriteException('Missing required parameter: "rowId"');
3815
+ }
3816
+ if (typeof column === 'undefined') {
3817
+ throw new AppwriteException('Missing required parameter: "column"');
3818
+ }
3819
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3820
+ const payload = {};
3821
+ if (typeof value !== 'undefined') {
3822
+ payload['value'] = value;
3823
+ }
3824
+ if (typeof max !== 'undefined') {
3825
+ payload['max'] = max;
3826
+ }
3827
+ const uri = new URL(this.client.config.endpoint + apiPath);
3828
+ return this.client.call('patch', uri, {
3829
+ 'content-type': 'application/json',
3830
+ }, payload);
3831
+ }
3832
+ }
3833
+
3834
+ class Teams extends Service {
3835
+ constructor(client) {
3836
+ super(client);
3837
+ }
3838
+ list(paramsOrFirst, ...rest) {
3839
+ let params;
3840
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3841
+ params = (paramsOrFirst || {});
3842
+ }
3843
+ else {
3844
+ params = {
3845
+ queries: paramsOrFirst,
3846
+ search: rest[0]
3847
+ };
3848
+ }
3849
+ const queries = params.queries;
3850
+ const search = params.search;
3321
3851
  const apiPath = '/teams';
3322
3852
  const payload = {};
3323
3853
  if (typeof queries !== 'undefined') {
@@ -3329,18 +3859,21 @@ class Teams extends Service {
3329
3859
  const uri = new URL(this.client.config.endpoint + apiPath);
3330
3860
  return this.client.call('get', uri, {}, payload);
3331
3861
  }
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) {
3862
+ create(paramsOrFirst, ...rest) {
3863
+ let params;
3864
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3865
+ params = (paramsOrFirst || {});
3866
+ }
3867
+ else {
3868
+ params = {
3869
+ teamId: paramsOrFirst,
3870
+ name: rest[0],
3871
+ roles: rest[1]
3872
+ };
3873
+ }
3874
+ const teamId = params.teamId;
3875
+ const name = params.name;
3876
+ const roles = params.roles;
3344
3877
  if (typeof teamId === 'undefined') {
3345
3878
  throw new AppwriteException('Missing required parameter: "teamId"');
3346
3879
  }
@@ -3363,14 +3896,17 @@ class Teams extends Service {
3363
3896
  'content-type': 'application/json',
3364
3897
  }, payload);
3365
3898
  }
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) {
3899
+ get(paramsOrFirst) {
3900
+ let params;
3901
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3902
+ params = (paramsOrFirst || {});
3903
+ }
3904
+ else {
3905
+ params = {
3906
+ teamId: paramsOrFirst
3907
+ };
3908
+ }
3909
+ const teamId = params.teamId;
3374
3910
  if (typeof teamId === 'undefined') {
3375
3911
  throw new AppwriteException('Missing required parameter: "teamId"');
3376
3912
  }
@@ -3379,15 +3915,19 @@ class Teams extends Service {
3379
3915
  const uri = new URL(this.client.config.endpoint + apiPath);
3380
3916
  return this.client.call('get', uri, {}, payload);
3381
3917
  }
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) {
3918
+ updateName(paramsOrFirst, ...rest) {
3919
+ let params;
3920
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3921
+ params = (paramsOrFirst || {});
3922
+ }
3923
+ else {
3924
+ params = {
3925
+ teamId: paramsOrFirst,
3926
+ name: rest[0]
3927
+ };
3928
+ }
3929
+ const teamId = params.teamId;
3930
+ const name = params.name;
3391
3931
  if (typeof teamId === 'undefined') {
3392
3932
  throw new AppwriteException('Missing required parameter: "teamId"');
3393
3933
  }
@@ -3404,15 +3944,17 @@ class Teams extends Service {
3404
3944
  'content-type': 'application/json',
3405
3945
  }, payload);
3406
3946
  }
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) {
3947
+ delete(paramsOrFirst) {
3948
+ let params;
3949
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3950
+ params = (paramsOrFirst || {});
3951
+ }
3952
+ else {
3953
+ params = {
3954
+ teamId: paramsOrFirst
3955
+ };
3956
+ }
3957
+ const teamId = params.teamId;
3416
3958
  if (typeof teamId === 'undefined') {
3417
3959
  throw new AppwriteException('Missing required parameter: "teamId"');
3418
3960
  }
@@ -3423,18 +3965,21 @@ class Teams extends Service {
3423
3965
  'content-type': 'application/json',
3424
3966
  }, payload);
3425
3967
  }
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) {
3968
+ listMemberships(paramsOrFirst, ...rest) {
3969
+ let params;
3970
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3971
+ params = (paramsOrFirst || {});
3972
+ }
3973
+ else {
3974
+ params = {
3975
+ teamId: paramsOrFirst,
3976
+ queries: rest[0],
3977
+ search: rest[1]
3978
+ };
3979
+ }
3980
+ const teamId = params.teamId;
3981
+ const queries = params.queries;
3982
+ const search = params.search;
3438
3983
  if (typeof teamId === 'undefined') {
3439
3984
  throw new AppwriteException('Missing required parameter: "teamId"');
3440
3985
  }
@@ -3449,40 +3994,29 @@ class Teams extends Service {
3449
3994
  const uri = new URL(this.client.config.endpoint + apiPath);
3450
3995
  return this.client.call('get', uri, {}, payload);
3451
3996
  }
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) {
3997
+ createMembership(paramsOrFirst, ...rest) {
3998
+ let params;
3999
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4000
+ params = (paramsOrFirst || {});
4001
+ }
4002
+ else {
4003
+ params = {
4004
+ teamId: paramsOrFirst,
4005
+ roles: rest[0],
4006
+ email: rest[1],
4007
+ userId: rest[2],
4008
+ phone: rest[3],
4009
+ url: rest[4],
4010
+ name: rest[5]
4011
+ };
4012
+ }
4013
+ const teamId = params.teamId;
4014
+ const roles = params.roles;
4015
+ const email = params.email;
4016
+ const userId = params.userId;
4017
+ const phone = params.phone;
4018
+ const url = params.url;
4019
+ const name = params.name;
3486
4020
  if (typeof teamId === 'undefined') {
3487
4021
  throw new AppwriteException('Missing required parameter: "teamId"');
3488
4022
  }
@@ -3514,17 +4048,19 @@ class Teams extends Service {
3514
4048
  'content-type': 'application/json',
3515
4049
  }, payload);
3516
4050
  }
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) {
4051
+ getMembership(paramsOrFirst, ...rest) {
4052
+ let params;
4053
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4054
+ params = (paramsOrFirst || {});
4055
+ }
4056
+ else {
4057
+ params = {
4058
+ teamId: paramsOrFirst,
4059
+ membershipId: rest[0]
4060
+ };
4061
+ }
4062
+ const teamId = params.teamId;
4063
+ const membershipId = params.membershipId;
3528
4064
  if (typeof teamId === 'undefined') {
3529
4065
  throw new AppwriteException('Missing required parameter: "teamId"');
3530
4066
  }
@@ -3536,19 +4072,21 @@ class Teams extends Service {
3536
4072
  const uri = new URL(this.client.config.endpoint + apiPath);
3537
4073
  return this.client.call('get', uri, {}, payload);
3538
4074
  }
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) {
4075
+ updateMembership(paramsOrFirst, ...rest) {
4076
+ let params;
4077
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4078
+ params = (paramsOrFirst || {});
4079
+ }
4080
+ else {
4081
+ params = {
4082
+ teamId: paramsOrFirst,
4083
+ membershipId: rest[0],
4084
+ roles: rest[1]
4085
+ };
4086
+ }
4087
+ const teamId = params.teamId;
4088
+ const membershipId = params.membershipId;
4089
+ const roles = params.roles;
3552
4090
  if (typeof teamId === 'undefined') {
3553
4091
  throw new AppwriteException('Missing required parameter: "teamId"');
3554
4092
  }
@@ -3568,17 +4106,19 @@ class Teams extends Service {
3568
4106
  'content-type': 'application/json',
3569
4107
  }, payload);
3570
4108
  }
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) {
4109
+ deleteMembership(paramsOrFirst, ...rest) {
4110
+ let params;
4111
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4112
+ params = (paramsOrFirst || {});
4113
+ }
4114
+ else {
4115
+ params = {
4116
+ teamId: paramsOrFirst,
4117
+ membershipId: rest[0]
4118
+ };
4119
+ }
4120
+ const teamId = params.teamId;
4121
+ const membershipId = params.membershipId;
3582
4122
  if (typeof teamId === 'undefined') {
3583
4123
  throw new AppwriteException('Missing required parameter: "teamId"');
3584
4124
  }
@@ -3592,23 +4132,23 @@ class Teams extends Service {
3592
4132
  'content-type': 'application/json',
3593
4133
  }, payload);
3594
4134
  }
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) {
4135
+ updateMembershipStatus(paramsOrFirst, ...rest) {
4136
+ let params;
4137
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4138
+ params = (paramsOrFirst || {});
4139
+ }
4140
+ else {
4141
+ params = {
4142
+ teamId: paramsOrFirst,
4143
+ membershipId: rest[0],
4144
+ userId: rest[1],
4145
+ secret: rest[2]
4146
+ };
4147
+ }
4148
+ const teamId = params.teamId;
4149
+ const membershipId = params.membershipId;
4150
+ const userId = params.userId;
4151
+ const secret = params.secret;
3612
4152
  if (typeof teamId === 'undefined') {
3613
4153
  throw new AppwriteException('Missing required parameter: "teamId"');
3614
4154
  }
@@ -3634,16 +4174,17 @@ class Teams extends Service {
3634
4174
  'content-type': 'application/json',
3635
4175
  }, payload);
3636
4176
  }
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) {
4177
+ getPrefs(paramsOrFirst) {
4178
+ let params;
4179
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4180
+ params = (paramsOrFirst || {});
4181
+ }
4182
+ else {
4183
+ params = {
4184
+ teamId: paramsOrFirst
4185
+ };
4186
+ }
4187
+ const teamId = params.teamId;
3647
4188
  if (typeof teamId === 'undefined') {
3648
4189
  throw new AppwriteException('Missing required parameter: "teamId"');
3649
4190
  }
@@ -3652,17 +4193,19 @@ class Teams extends Service {
3652
4193
  const uri = new URL(this.client.config.endpoint + apiPath);
3653
4194
  return this.client.call('get', uri, {}, payload);
3654
4195
  }
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) {
4196
+ updatePrefs(paramsOrFirst, ...rest) {
4197
+ let params;
4198
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4199
+ params = (paramsOrFirst || {});
4200
+ }
4201
+ else {
4202
+ params = {
4203
+ teamId: paramsOrFirst,
4204
+ prefs: rest[0]
4205
+ };
4206
+ }
4207
+ const teamId = params.teamId;
4208
+ const prefs = params.prefs;
3666
4209
  if (typeof teamId === 'undefined') {
3667
4210
  throw new AppwriteException('Missing required parameter: "teamId"');
3668
4211
  }
@@ -3721,7 +4264,84 @@ Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, document
3721
4264
  Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
3722
4265
  Query.limit = (limit) => new Query("limit", undefined, limit).toString();
3723
4266
  Query.offset = (offset) => new Query("offset", undefined, offset).toString();
4267
+ /**
4268
+ * Filter resources where attribute contains the specified value.
4269
+ *
4270
+ * @param {string} attribute
4271
+ * @param {string | string[]} value
4272
+ * @returns {string}
4273
+ */
3724
4274
  Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
4275
+ /**
4276
+ * Filter resources where attribute does not contain the specified value.
4277
+ *
4278
+ * @param {string} attribute
4279
+ * @param {string | string[]} value
4280
+ * @returns {string}
4281
+ */
4282
+ Query.notContains = (attribute, value) => new Query("notContains", attribute, value).toString();
4283
+ /**
4284
+ * Filter resources by searching attribute for value (inverse of search).
4285
+ * A fulltext index on attribute is required for this query to work.
4286
+ *
4287
+ * @param {string} attribute
4288
+ * @param {string} value
4289
+ * @returns {string}
4290
+ */
4291
+ Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value).toString();
4292
+ /**
4293
+ * Filter resources where attribute is not between start and end (exclusive).
4294
+ *
4295
+ * @param {string} attribute
4296
+ * @param {string | number} start
4297
+ * @param {string | number} end
4298
+ * @returns {string}
4299
+ */
4300
+ Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
4301
+ /**
4302
+ * Filter resources where attribute does not start with value.
4303
+ *
4304
+ * @param {string} attribute
4305
+ * @param {string} value
4306
+ * @returns {string}
4307
+ */
4308
+ Query.notStartsWith = (attribute, value) => new Query("notStartsWith", attribute, value).toString();
4309
+ /**
4310
+ * Filter resources where attribute does not end with value.
4311
+ *
4312
+ * @param {string} attribute
4313
+ * @param {string} value
4314
+ * @returns {string}
4315
+ */
4316
+ Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, value).toString();
4317
+ /**
4318
+ * Filter resources where document was created before date.
4319
+ *
4320
+ * @param {string} value
4321
+ * @returns {string}
4322
+ */
4323
+ Query.createdBefore = (value) => new Query("createdBefore", undefined, value).toString();
4324
+ /**
4325
+ * Filter resources where document was created after date.
4326
+ *
4327
+ * @param {string} value
4328
+ * @returns {string}
4329
+ */
4330
+ Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toString();
4331
+ /**
4332
+ * Filter resources where document was updated before date.
4333
+ *
4334
+ * @param {string} value
4335
+ * @returns {string}
4336
+ */
4337
+ Query.updatedBefore = (value) => new Query("updatedBefore", undefined, value).toString();
4338
+ /**
4339
+ * Filter resources where document was updated after date.
4340
+ *
4341
+ * @param {string} value
4342
+ * @returns {string}
4343
+ */
4344
+ Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toString();
3725
4345
  Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
3726
4346
  Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
3727
4347
 
@@ -4205,5 +4825,6 @@ exports.Permission = Permission;
4205
4825
  exports.Query = Query;
4206
4826
  exports.Role = Role;
4207
4827
  exports.Storage = Storage;
4828
+ exports.TablesDB = TablesDB;
4208
4829
  exports.Teams = Teams;
4209
4830
  //# sourceMappingURL=sdk.js.map