react-native-appwrite 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1854 -1121
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1854 -1122
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-password-session.md +4 -4
  7. package/docs/examples/account/create-email-token.md +5 -5
  8. package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
  9. package/docs/examples/account/create-mfa-authenticator.md +3 -3
  10. package/docs/examples/account/create-mfa-challenge.md +3 -3
  11. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  12. package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
  13. package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
  14. package/docs/examples/account/create-phone-token.md +4 -4
  15. package/docs/examples/account/create-push-target.md +5 -5
  16. package/docs/examples/account/create-recovery.md +4 -4
  17. package/docs/examples/account/create-session.md +4 -4
  18. package/docs/examples/account/create-verification.md +3 -3
  19. package/docs/examples/account/create.md +6 -6
  20. package/docs/examples/account/delete-identity.md +3 -3
  21. package/docs/examples/account/delete-mfa-authenticator.md +3 -3
  22. package/docs/examples/account/delete-push-target.md +3 -3
  23. package/docs/examples/account/delete-session.md +3 -3
  24. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  25. package/docs/examples/account/get-session.md +3 -3
  26. package/docs/examples/account/list-identities.md +3 -3
  27. package/docs/examples/account/list-logs.md +3 -3
  28. package/docs/examples/account/list-mfa-factors.md +1 -1
  29. package/docs/examples/account/update-email.md +4 -4
  30. package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
  31. package/docs/examples/account/update-mfa-authenticator.md +4 -4
  32. package/docs/examples/account/update-mfa-challenge.md +4 -4
  33. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  34. package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
  35. package/docs/examples/account/update-name.md +3 -3
  36. package/docs/examples/account/update-password.md +4 -4
  37. package/docs/examples/account/update-phone-session.md +4 -4
  38. package/docs/examples/account/update-phone-verification.md +4 -4
  39. package/docs/examples/account/update-phone.md +4 -4
  40. package/docs/examples/account/update-prefs.md +7 -3
  41. package/docs/examples/account/update-push-target.md +4 -4
  42. package/docs/examples/account/update-recovery.md +5 -5
  43. package/docs/examples/account/update-session.md +3 -3
  44. package/docs/examples/account/update-verification.md +4 -4
  45. package/docs/examples/avatars/get-browser.md +6 -6
  46. package/docs/examples/avatars/get-credit-card.md +6 -6
  47. package/docs/examples/avatars/get-favicon.md +3 -3
  48. package/docs/examples/avatars/get-flag.md +6 -6
  49. package/docs/examples/avatars/get-image.md +5 -5
  50. package/docs/examples/avatars/get-initials.md +6 -6
  51. package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
  52. package/docs/examples/databases/create-document.md +13 -7
  53. package/docs/examples/databases/decrement-document-attribute.md +8 -8
  54. package/docs/examples/databases/delete-document.md +5 -5
  55. package/docs/examples/databases/get-document.md +6 -6
  56. package/docs/examples/databases/increment-document-attribute.md +8 -8
  57. package/docs/examples/databases/list-documents.md +5 -5
  58. package/docs/examples/databases/update-document.md +7 -7
  59. package/docs/examples/databases/upsert-document.md +7 -7
  60. package/docs/examples/functions/create-execution.md +9 -9
  61. package/docs/examples/functions/get-execution.md +4 -4
  62. package/docs/examples/functions/list-executions.md +4 -4
  63. package/docs/examples/graphql/mutation.md +3 -3
  64. package/docs/examples/graphql/query.md +3 -3
  65. package/docs/examples/messaging/create-subscriber.md +5 -5
  66. package/docs/examples/messaging/delete-subscriber.md +4 -4
  67. package/docs/examples/storage/create-file.md +6 -6
  68. package/docs/examples/storage/delete-file.md +4 -4
  69. package/docs/examples/storage/get-file-download.md +5 -5
  70. package/docs/examples/storage/get-file-preview.md +16 -16
  71. package/docs/examples/storage/get-file-view.md +5 -5
  72. package/docs/examples/storage/get-file.md +4 -4
  73. package/docs/examples/storage/list-files.md +5 -5
  74. package/docs/examples/storage/update-file.md +6 -6
  75. package/docs/examples/tablesdb/create-row.md +23 -0
  76. package/docs/examples/tablesdb/decrement-row-column.md +18 -0
  77. package/docs/examples/tablesdb/delete-row.md +15 -0
  78. package/docs/examples/tablesdb/get-row.md +16 -0
  79. package/docs/examples/tablesdb/increment-row-column.md +18 -0
  80. package/docs/examples/tablesdb/list-rows.md +15 -0
  81. package/docs/examples/tablesdb/update-row.md +17 -0
  82. package/docs/examples/tablesdb/upsert-row.md +17 -0
  83. package/docs/examples/teams/create-membership.md +9 -9
  84. package/docs/examples/teams/create.md +5 -5
  85. package/docs/examples/teams/delete-membership.md +4 -4
  86. package/docs/examples/teams/delete.md +3 -3
  87. package/docs/examples/teams/get-membership.md +4 -4
  88. package/docs/examples/teams/get-prefs.md +3 -3
  89. package/docs/examples/teams/get.md +3 -3
  90. package/docs/examples/teams/list-memberships.md +5 -5
  91. package/docs/examples/teams/list.md +4 -4
  92. package/docs/examples/teams/update-membership-status.md +6 -6
  93. package/docs/examples/teams/update-membership.md +5 -5
  94. package/docs/examples/teams/update-name.md +4 -4
  95. package/docs/examples/teams/update-prefs.md +4 -4
  96. package/package.json +1 -1
  97. package/src/client.ts +2 -2
  98. package/src/enums/credit-card.ts +1 -1
  99. package/src/enums/execution-method.ts +1 -0
  100. package/src/index.ts +1 -0
  101. package/src/models.ts +72 -27
  102. package/src/query.ts +247 -4
  103. package/src/services/account.ts +1469 -315
  104. package/src/services/avatars.ts +289 -80
  105. package/src/services/databases.ts +345 -63
  106. package/src/services/functions.ts +115 -20
  107. package/src/services/graphql.ts +52 -4
  108. package/src/services/locale.ts +8 -19
  109. package/src/services/messaging.ts +66 -7
  110. package/src/services/storage.ts +345 -76
  111. package/src/services/tables-db.ts +621 -0
  112. package/src/services/teams.ts +454 -93
  113. package/types/enums/credit-card.d.ts +1 -1
  114. package/types/enums/execution-method.d.ts +2 -1
  115. package/types/index.d.ts +1 -0
  116. package/types/models.d.ts +69 -25
  117. package/types/query.d.ts +201 -4
  118. package/types/services/account.d.ts +734 -280
  119. package/types/services/avatars.d.ts +168 -73
  120. package/types/services/databases.d.ts +199 -58
  121. package/types/services/functions.d.ts +62 -17
  122. package/types/services/graphql.d.ts +24 -2
  123. package/types/services/locale.d.ts +8 -19
  124. package/types/services/messaging.d.ts +33 -5
  125. package/types/services/storage.d.ts +201 -68
  126. package/types/services/tables-db.d.ts +245 -0
  127. package/types/services/teams.d.ts +242 -80
  128. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  129. /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
package/dist/esm/sdk.js CHANGED
@@ -78,8 +78,8 @@ class Client {
78
78
  'x-sdk-name': 'React Native',
79
79
  'x-sdk-platform': 'client',
80
80
  'x-sdk-language': 'reactnative',
81
- 'x-sdk-version': '0.11.0',
82
- 'X-Appwrite-Response-Format': '1.7.0',
81
+ 'x-sdk-version': '0.13.0',
82
+ 'X-Appwrite-Response-Format': '1.8.0',
83
83
  };
84
84
  this.realtime = {
85
85
  socket: undefined,
@@ -470,23 +470,23 @@ class Account extends Service {
470
470
  const uri = new URL(this.client.config.endpoint + apiPath);
471
471
  return this.client.call('get', uri, {}, payload);
472
472
  }
473
- /**
474
- * Use this endpoint to allow a new user to register a new account in your
475
- * project. After the user registration completes successfully, you can use
476
- * the
477
- * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
478
- * route to start verifying the user email address. To allow the new user to
479
- * login to their new account, you need to create a new [account
480
- * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
481
- *
482
- * @param {string} userId
483
- * @param {string} email
484
- * @param {string} password
485
- * @param {string} name
486
- * @throws {AppwriteException}
487
- * @returns {Promise}
488
- */
489
- create(userId, email, password, name) {
473
+ create(paramsOrFirst, ...rest) {
474
+ let params;
475
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
476
+ params = (paramsOrFirst || {});
477
+ }
478
+ else {
479
+ params = {
480
+ userId: paramsOrFirst,
481
+ email: rest[0],
482
+ password: rest[1],
483
+ name: rest[2]
484
+ };
485
+ }
486
+ const userId = params.userId;
487
+ const email = params.email;
488
+ const password = params.password;
489
+ const name = params.name;
490
490
  if (typeof userId === 'undefined') {
491
491
  throw new AppwriteException('Missing required parameter: "userId"');
492
492
  }
@@ -515,22 +515,19 @@ class Account extends Service {
515
515
  'content-type': 'application/json',
516
516
  }, payload);
517
517
  }
518
- /**
519
- * Update currently logged in user account email address. After changing user
520
- * address, the user confirmation status will get reset. A new confirmation
521
- * email is not sent automatically however you can use the send confirmation
522
- * email endpoint again to send the confirmation email. For security measures,
523
- * user password is required to complete this request.
524
- * This endpoint can also be used to convert an anonymous account to a normal
525
- * one, by passing an email address and a new password.
526
- *
527
- *
528
- * @param {string} email
529
- * @param {string} password
530
- * @throws {AppwriteException}
531
- * @returns {Promise}
532
- */
533
- updateEmail(email, password) {
518
+ updateEmail(paramsOrFirst, ...rest) {
519
+ let params;
520
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
521
+ params = (paramsOrFirst || {});
522
+ }
523
+ else {
524
+ params = {
525
+ email: paramsOrFirst,
526
+ password: rest[0]
527
+ };
528
+ }
529
+ const email = params.email;
530
+ const password = params.password;
534
531
  if (typeof email === 'undefined') {
535
532
  throw new AppwriteException('Missing required parameter: "email"');
536
533
  }
@@ -550,14 +547,17 @@ class Account extends Service {
550
547
  'content-type': 'application/json',
551
548
  }, payload);
552
549
  }
553
- /**
554
- * Get the list of identities for the currently logged in user.
555
- *
556
- * @param {string[]} queries
557
- * @throws {AppwriteException}
558
- * @returns {Promise}
559
- */
560
- listIdentities(queries) {
550
+ listIdentities(paramsOrFirst) {
551
+ let params;
552
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
553
+ params = (paramsOrFirst || {});
554
+ }
555
+ else {
556
+ params = {
557
+ queries: paramsOrFirst
558
+ };
559
+ }
560
+ const queries = params.queries;
561
561
  const apiPath = '/account/identities';
562
562
  const payload = {};
563
563
  if (typeof queries !== 'undefined') {
@@ -566,14 +566,17 @@ class Account extends Service {
566
566
  const uri = new URL(this.client.config.endpoint + apiPath);
567
567
  return this.client.call('get', uri, {}, payload);
568
568
  }
569
- /**
570
- * Delete an identity by its unique ID.
571
- *
572
- * @param {string} identityId
573
- * @throws {AppwriteException}
574
- * @returns {Promise}
575
- */
576
- deleteIdentity(identityId) {
569
+ deleteIdentity(paramsOrFirst) {
570
+ let params;
571
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
572
+ params = (paramsOrFirst || {});
573
+ }
574
+ else {
575
+ params = {
576
+ identityId: paramsOrFirst
577
+ };
578
+ }
579
+ const identityId = params.identityId;
577
580
  if (typeof identityId === 'undefined') {
578
581
  throw new AppwriteException('Missing required parameter: "identityId"');
579
582
  }
@@ -585,11 +588,7 @@ class Account extends Service {
585
588
  }, payload);
586
589
  }
587
590
  /**
588
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
589
- * to authenticate on behalf of the current user when working with the
590
- * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
591
- * from its creation and will be invalid if the user will logout in that time
592
- * frame.
591
+ * 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.
593
592
  *
594
593
  * @throws {AppwriteException}
595
594
  * @returns {Promise}
@@ -602,15 +601,17 @@ class Account extends Service {
602
601
  'content-type': 'application/json',
603
602
  }, payload);
604
603
  }
605
- /**
606
- * Get the list of latest security activity logs for the currently logged in
607
- * user. Each log returns user IP address, location and date and time of log.
608
- *
609
- * @param {string[]} queries
610
- * @throws {AppwriteException}
611
- * @returns {Promise}
612
- */
613
- listLogs(queries) {
604
+ listLogs(paramsOrFirst) {
605
+ let params;
606
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
607
+ params = (paramsOrFirst || {});
608
+ }
609
+ else {
610
+ params = {
611
+ queries: paramsOrFirst
612
+ };
613
+ }
614
+ const queries = params.queries;
614
615
  const apiPath = '/account/logs';
615
616
  const payload = {};
616
617
  if (typeof queries !== 'undefined') {
@@ -619,14 +620,17 @@ class Account extends Service {
619
620
  const uri = new URL(this.client.config.endpoint + apiPath);
620
621
  return this.client.call('get', uri, {}, payload);
621
622
  }
622
- /**
623
- * Enable or disable MFA on an account.
624
- *
625
- * @param {boolean} mfa
626
- * @throws {AppwriteException}
627
- * @returns {Promise}
628
- */
629
- updateMFA(mfa) {
623
+ updateMFA(paramsOrFirst) {
624
+ let params;
625
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
626
+ params = (paramsOrFirst || {});
627
+ }
628
+ else {
629
+ params = {
630
+ mfa: paramsOrFirst
631
+ };
632
+ }
633
+ const mfa = params.mfa;
630
634
  if (typeof mfa === 'undefined') {
631
635
  throw new AppwriteException('Missing required parameter: "mfa"');
632
636
  }
@@ -640,17 +644,17 @@ class Account extends Service {
640
644
  'content-type': 'application/json',
641
645
  }, payload);
642
646
  }
643
- /**
644
- * Add an authenticator app to be used as an MFA factor. Verify the
645
- * authenticator using the [verify
646
- * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
647
- * method.
648
- *
649
- * @param {AuthenticatorType} type
650
- * @throws {AppwriteException}
651
- * @returns {Promise}
652
- */
653
- createMfaAuthenticator(type) {
647
+ createMfaAuthenticator(paramsOrFirst) {
648
+ let params;
649
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
650
+ params = (paramsOrFirst || {});
651
+ }
652
+ else {
653
+ params = {
654
+ type: paramsOrFirst
655
+ };
656
+ }
657
+ const type = params.type;
654
658
  if (typeof type === 'undefined') {
655
659
  throw new AppwriteException('Missing required parameter: "type"');
656
660
  }
@@ -661,17 +665,40 @@ class Account extends Service {
661
665
  'content-type': 'application/json',
662
666
  }, payload);
663
667
  }
664
- /**
665
- * Verify an authenticator app after adding it using the [add
666
- * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
667
- * method.
668
- *
669
- * @param {AuthenticatorType} type
670
- * @param {string} otp
671
- * @throws {AppwriteException}
672
- * @returns {Promise}
673
- */
674
- updateMfaAuthenticator(type, otp) {
668
+ createMFAAuthenticator(paramsOrFirst) {
669
+ let params;
670
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
671
+ params = (paramsOrFirst || {});
672
+ }
673
+ else {
674
+ params = {
675
+ type: paramsOrFirst
676
+ };
677
+ }
678
+ const type = params.type;
679
+ if (typeof type === 'undefined') {
680
+ throw new AppwriteException('Missing required parameter: "type"');
681
+ }
682
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
683
+ const payload = {};
684
+ const uri = new URL(this.client.config.endpoint + apiPath);
685
+ return this.client.call('post', uri, {
686
+ 'content-type': 'application/json',
687
+ }, payload);
688
+ }
689
+ updateMfaAuthenticator(paramsOrFirst, ...rest) {
690
+ let params;
691
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
692
+ params = (paramsOrFirst || {});
693
+ }
694
+ else {
695
+ params = {
696
+ type: paramsOrFirst,
697
+ otp: rest[0]
698
+ };
699
+ }
700
+ const type = params.type;
701
+ const otp = params.otp;
675
702
  if (typeof type === 'undefined') {
676
703
  throw new AppwriteException('Missing required parameter: "type"');
677
704
  }
@@ -688,14 +715,46 @@ class Account extends Service {
688
715
  'content-type': 'application/json',
689
716
  }, payload);
690
717
  }
691
- /**
692
- * Delete an authenticator for a user by ID.
693
- *
694
- * @param {AuthenticatorType} type
695
- * @throws {AppwriteException}
696
- * @returns {Promise}
697
- */
698
- deleteMfaAuthenticator(type) {
718
+ updateMFAAuthenticator(paramsOrFirst, ...rest) {
719
+ let params;
720
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
721
+ params = (paramsOrFirst || {});
722
+ }
723
+ else {
724
+ params = {
725
+ type: paramsOrFirst,
726
+ otp: rest[0]
727
+ };
728
+ }
729
+ const type = params.type;
730
+ const otp = params.otp;
731
+ if (typeof type === 'undefined') {
732
+ throw new AppwriteException('Missing required parameter: "type"');
733
+ }
734
+ if (typeof otp === 'undefined') {
735
+ throw new AppwriteException('Missing required parameter: "otp"');
736
+ }
737
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
738
+ const payload = {};
739
+ if (typeof otp !== 'undefined') {
740
+ payload['otp'] = otp;
741
+ }
742
+ const uri = new URL(this.client.config.endpoint + apiPath);
743
+ return this.client.call('put', uri, {
744
+ 'content-type': 'application/json',
745
+ }, payload);
746
+ }
747
+ deleteMfaAuthenticator(paramsOrFirst) {
748
+ let params;
749
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
750
+ params = (paramsOrFirst || {});
751
+ }
752
+ else {
753
+ params = {
754
+ type: paramsOrFirst
755
+ };
756
+ }
757
+ const type = params.type;
699
758
  if (typeof type === 'undefined') {
700
759
  throw new AppwriteException('Missing required parameter: "type"');
701
760
  }
@@ -706,16 +765,38 @@ class Account extends Service {
706
765
  'content-type': 'application/json',
707
766
  }, payload);
708
767
  }
709
- /**
710
- * Begin the process of MFA verification after sign-in. Finish the flow with
711
- * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
712
- * method.
713
- *
714
- * @param {AuthenticationFactor} factor
715
- * @throws {AppwriteException}
716
- * @returns {Promise}
717
- */
718
- createMfaChallenge(factor) {
768
+ deleteMFAAuthenticator(paramsOrFirst) {
769
+ let params;
770
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
771
+ params = (paramsOrFirst || {});
772
+ }
773
+ else {
774
+ params = {
775
+ type: paramsOrFirst
776
+ };
777
+ }
778
+ const type = params.type;
779
+ if (typeof type === 'undefined') {
780
+ throw new AppwriteException('Missing required parameter: "type"');
781
+ }
782
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
783
+ const payload = {};
784
+ const uri = new URL(this.client.config.endpoint + apiPath);
785
+ return this.client.call('delete', uri, {
786
+ 'content-type': 'application/json',
787
+ }, payload);
788
+ }
789
+ createMfaChallenge(paramsOrFirst) {
790
+ let params;
791
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
792
+ params = (paramsOrFirst || {});
793
+ }
794
+ else {
795
+ params = {
796
+ factor: paramsOrFirst
797
+ };
798
+ }
799
+ const factor = params.factor;
719
800
  if (typeof factor === 'undefined') {
720
801
  throw new AppwriteException('Missing required parameter: "factor"');
721
802
  }
@@ -729,19 +810,75 @@ class Account extends Service {
729
810
  'content-type': 'application/json',
730
811
  }, payload);
731
812
  }
732
- /**
733
- * Complete the MFA challenge by providing the one-time password. Finish the
734
- * process of MFA verification by providing the one-time password. To begin
735
- * the flow, use
736
- * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
737
- * method.
738
- *
739
- * @param {string} challengeId
740
- * @param {string} otp
741
- * @throws {AppwriteException}
742
- * @returns {Promise}
743
- */
744
- updateMfaChallenge(challengeId, otp) {
813
+ createMFAChallenge(paramsOrFirst) {
814
+ let params;
815
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
816
+ params = (paramsOrFirst || {});
817
+ }
818
+ else {
819
+ params = {
820
+ factor: paramsOrFirst
821
+ };
822
+ }
823
+ const factor = params.factor;
824
+ if (typeof factor === 'undefined') {
825
+ throw new AppwriteException('Missing required parameter: "factor"');
826
+ }
827
+ const apiPath = '/account/mfa/challenge';
828
+ const payload = {};
829
+ if (typeof factor !== 'undefined') {
830
+ payload['factor'] = factor;
831
+ }
832
+ const uri = new URL(this.client.config.endpoint + apiPath);
833
+ return this.client.call('post', uri, {
834
+ 'content-type': 'application/json',
835
+ }, payload);
836
+ }
837
+ updateMfaChallenge(paramsOrFirst, ...rest) {
838
+ let params;
839
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
840
+ params = (paramsOrFirst || {});
841
+ }
842
+ else {
843
+ params = {
844
+ challengeId: paramsOrFirst,
845
+ otp: rest[0]
846
+ };
847
+ }
848
+ const challengeId = params.challengeId;
849
+ const otp = params.otp;
850
+ if (typeof challengeId === 'undefined') {
851
+ throw new AppwriteException('Missing required parameter: "challengeId"');
852
+ }
853
+ if (typeof otp === 'undefined') {
854
+ throw new AppwriteException('Missing required parameter: "otp"');
855
+ }
856
+ const apiPath = '/account/mfa/challenge';
857
+ const payload = {};
858
+ if (typeof challengeId !== 'undefined') {
859
+ payload['challengeId'] = challengeId;
860
+ }
861
+ if (typeof otp !== 'undefined') {
862
+ payload['otp'] = otp;
863
+ }
864
+ const uri = new URL(this.client.config.endpoint + apiPath);
865
+ return this.client.call('put', uri, {
866
+ 'content-type': 'application/json',
867
+ }, payload);
868
+ }
869
+ updateMFAChallenge(paramsOrFirst, ...rest) {
870
+ let params;
871
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
872
+ params = (paramsOrFirst || {});
873
+ }
874
+ else {
875
+ params = {
876
+ challengeId: paramsOrFirst,
877
+ otp: rest[0]
878
+ };
879
+ }
880
+ const challengeId = params.challengeId;
881
+ const otp = params.otp;
745
882
  if (typeof challengeId === 'undefined') {
746
883
  throw new AppwriteException('Missing required parameter: "challengeId"');
747
884
  }
@@ -766,6 +903,7 @@ class Account extends Service {
766
903
  *
767
904
  * @throws {AppwriteException}
768
905
  * @returns {Promise}
906
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
769
907
  */
770
908
  listMfaFactors() {
771
909
  const apiPath = '/account/mfa/factors';
@@ -774,13 +912,23 @@ class Account extends Service {
774
912
  return this.client.call('get', uri, {}, payload);
775
913
  }
776
914
  /**
777
- * Get recovery codes that can be used as backup for MFA flow. Before getting
778
- * codes, they must be generated using
779
- * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
780
- * method. An OTP challenge is required to read recovery codes.
915
+ * List the factors available on the account to be used as a MFA challange.
916
+ *
917
+ * @throws {AppwriteException}
918
+ * @returns {Promise}
919
+ */
920
+ listMFAFactors() {
921
+ const apiPath = '/account/mfa/factors';
922
+ const payload = {};
923
+ const uri = new URL(this.client.config.endpoint + apiPath);
924
+ return this.client.call('get', uri, {}, payload);
925
+ }
926
+ /**
927
+ * 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.
781
928
  *
782
929
  * @throws {AppwriteException}
783
930
  * @returns {Promise}
931
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
784
932
  */
785
933
  getMfaRecoveryCodes() {
786
934
  const apiPath = '/account/mfa/recovery-codes';
@@ -789,14 +937,23 @@ class Account extends Service {
789
937
  return this.client.call('get', uri, {}, payload);
790
938
  }
791
939
  /**
792
- * Generate recovery codes as backup for MFA flow. It's recommended to
793
- * generate and show then immediately after user successfully adds their
794
- * authehticator. Recovery codes can be used as a MFA verification type in
795
- * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
796
- * method.
940
+ * 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.
941
+ *
942
+ * @throws {AppwriteException}
943
+ * @returns {Promise}
944
+ */
945
+ getMFARecoveryCodes() {
946
+ const apiPath = '/account/mfa/recovery-codes';
947
+ const payload = {};
948
+ const uri = new URL(this.client.config.endpoint + apiPath);
949
+ return this.client.call('get', uri, {}, payload);
950
+ }
951
+ /**
952
+ * 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.
797
953
  *
798
954
  * @throws {AppwriteException}
799
955
  * @returns {Promise}
956
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
800
957
  */
801
958
  createMfaRecoveryCodes() {
802
959
  const apiPath = '/account/mfa/recovery-codes';
@@ -807,13 +964,25 @@ class Account extends Service {
807
964
  }, payload);
808
965
  }
809
966
  /**
810
- * Regenerate recovery codes that can be used as backup for MFA flow. Before
811
- * regenerating codes, they must be first generated using
812
- * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
813
- * method. An OTP challenge is required to regenreate recovery codes.
967
+ * 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.
968
+ *
969
+ * @throws {AppwriteException}
970
+ * @returns {Promise}
971
+ */
972
+ createMFARecoveryCodes() {
973
+ const apiPath = '/account/mfa/recovery-codes';
974
+ const payload = {};
975
+ const uri = new URL(this.client.config.endpoint + apiPath);
976
+ return this.client.call('post', uri, {
977
+ 'content-type': 'application/json',
978
+ }, payload);
979
+ }
980
+ /**
981
+ * 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.
814
982
  *
815
983
  * @throws {AppwriteException}
816
984
  * @returns {Promise}
985
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
817
986
  */
818
987
  updateMfaRecoveryCodes() {
819
988
  const apiPath = '/account/mfa/recovery-codes';
@@ -824,13 +993,30 @@ class Account extends Service {
824
993
  }, payload);
825
994
  }
826
995
  /**
827
- * Update currently logged in user account name.
996
+ * 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.
828
997
  *
829
- * @param {string} name
830
998
  * @throws {AppwriteException}
831
999
  * @returns {Promise}
832
1000
  */
833
- updateName(name) {
1001
+ updateMFARecoveryCodes() {
1002
+ const apiPath = '/account/mfa/recovery-codes';
1003
+ const payload = {};
1004
+ const uri = new URL(this.client.config.endpoint + apiPath);
1005
+ return this.client.call('patch', uri, {
1006
+ 'content-type': 'application/json',
1007
+ }, payload);
1008
+ }
1009
+ updateName(paramsOrFirst) {
1010
+ let params;
1011
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1012
+ params = (paramsOrFirst || {});
1013
+ }
1014
+ else {
1015
+ params = {
1016
+ name: paramsOrFirst
1017
+ };
1018
+ }
1019
+ const name = params.name;
834
1020
  if (typeof name === 'undefined') {
835
1021
  throw new AppwriteException('Missing required parameter: "name"');
836
1022
  }
@@ -844,17 +1030,19 @@ class Account extends Service {
844
1030
  'content-type': 'application/json',
845
1031
  }, payload);
846
1032
  }
847
- /**
848
- * Update currently logged in user password. For validation, user is required
849
- * to pass in the new password, and the old password. For users created with
850
- * OAuth, Team Invites and Magic URL, oldPassword is optional.
851
- *
852
- * @param {string} password
853
- * @param {string} oldPassword
854
- * @throws {AppwriteException}
855
- * @returns {Promise}
856
- */
857
- updatePassword(password, oldPassword) {
1033
+ updatePassword(paramsOrFirst, ...rest) {
1034
+ let params;
1035
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1036
+ params = (paramsOrFirst || {});
1037
+ }
1038
+ else {
1039
+ params = {
1040
+ password: paramsOrFirst,
1041
+ oldPassword: rest[0]
1042
+ };
1043
+ }
1044
+ const password = params.password;
1045
+ const oldPassword = params.oldPassword;
858
1046
  if (typeof password === 'undefined') {
859
1047
  throw new AppwriteException('Missing required parameter: "password"');
860
1048
  }
@@ -871,19 +1059,19 @@ class Account extends Service {
871
1059
  'content-type': 'application/json',
872
1060
  }, payload);
873
1061
  }
874
- /**
875
- * Update the currently logged in user's phone number. After updating the
876
- * phone number, the phone verification status will be reset. A confirmation
877
- * SMS is not sent automatically, however you can use the [POST
878
- * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
879
- * endpoint to send a confirmation SMS.
880
- *
881
- * @param {string} phone
882
- * @param {string} password
883
- * @throws {AppwriteException}
884
- * @returns {Promise}
885
- */
886
- updatePhone(phone, password) {
1062
+ updatePhone(paramsOrFirst, ...rest) {
1063
+ let params;
1064
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1065
+ params = (paramsOrFirst || {});
1066
+ }
1067
+ else {
1068
+ params = {
1069
+ phone: paramsOrFirst,
1070
+ password: rest[0]
1071
+ };
1072
+ }
1073
+ const phone = params.phone;
1074
+ const password = params.password;
887
1075
  if (typeof phone === 'undefined') {
888
1076
  throw new AppwriteException('Missing required parameter: "phone"');
889
1077
  }
@@ -915,16 +1103,17 @@ class Account extends Service {
915
1103
  const uri = new URL(this.client.config.endpoint + apiPath);
916
1104
  return this.client.call('get', uri, {}, payload);
917
1105
  }
918
- /**
919
- * Update currently logged in user account preferences. The object you pass is
920
- * stored as is, and replaces any previous value. The maximum allowed prefs
921
- * size is 64kB and throws error if exceeded.
922
- *
923
- * @param {object} prefs
924
- * @throws {AppwriteException}
925
- * @returns {Promise}
926
- */
927
- updatePrefs(prefs) {
1106
+ updatePrefs(paramsOrFirst) {
1107
+ let params;
1108
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst)) {
1109
+ params = (paramsOrFirst || {});
1110
+ }
1111
+ else {
1112
+ params = {
1113
+ prefs: paramsOrFirst
1114
+ };
1115
+ }
1116
+ const prefs = params.prefs;
928
1117
  if (typeof prefs === 'undefined') {
929
1118
  throw new AppwriteException('Missing required parameter: "prefs"');
930
1119
  }
@@ -938,22 +1127,19 @@ class Account extends Service {
938
1127
  'content-type': 'application/json',
939
1128
  }, payload);
940
1129
  }
941
- /**
942
- * Sends the user an email with a temporary secret key for password reset.
943
- * When the user clicks the confirmation link he is redirected back to your
944
- * app password reset URL with the secret key and email address values
945
- * attached to the URL query string. Use the query string params to submit a
946
- * request to the [PUT
947
- * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
948
- * endpoint to complete the process. The verification link sent to the user's
949
- * email address is valid for 1 hour.
950
- *
951
- * @param {string} email
952
- * @param {string} url
953
- * @throws {AppwriteException}
954
- * @returns {Promise}
955
- */
956
- createRecovery(email, url) {
1130
+ createRecovery(paramsOrFirst, ...rest) {
1131
+ let params;
1132
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1133
+ params = (paramsOrFirst || {});
1134
+ }
1135
+ else {
1136
+ params = {
1137
+ email: paramsOrFirst,
1138
+ url: rest[0]
1139
+ };
1140
+ }
1141
+ const email = params.email;
1142
+ const url = params.url;
957
1143
  if (typeof email === 'undefined') {
958
1144
  throw new AppwriteException('Missing required parameter: "email"');
959
1145
  }
@@ -973,26 +1159,22 @@ class Account extends Service {
973
1159
  'content-type': 'application/json',
974
1160
  }, payload);
975
1161
  }
976
- /**
977
- * Use this endpoint to complete the user account password reset. Both the
978
- * **userId** and **secret** arguments will be passed as query parameters to
979
- * the redirect URL you have provided when sending your request to the [POST
980
- * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
981
- * endpoint.
982
- *
983
- * Please note that in order to avoid a [Redirect
984
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
985
- * the only valid redirect URLs are the ones from domains you have set when
986
- * adding your platforms in the console interface.
987
- *
988
- * @param {string} userId
989
- * @param {string} secret
990
- * @param {string} password
991
- * @throws {AppwriteException}
992
- * @returns {Promise}
993
- */
994
- updateRecovery(userId, secret, password) {
995
- if (typeof userId === 'undefined') {
1162
+ updateRecovery(paramsOrFirst, ...rest) {
1163
+ let params;
1164
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1165
+ params = (paramsOrFirst || {});
1166
+ }
1167
+ else {
1168
+ params = {
1169
+ userId: paramsOrFirst,
1170
+ secret: rest[0],
1171
+ password: rest[1]
1172
+ };
1173
+ }
1174
+ const userId = params.userId;
1175
+ const secret = params.secret;
1176
+ const password = params.password;
1177
+ if (typeof userId === 'undefined') {
996
1178
  throw new AppwriteException('Missing required parameter: "userId"');
997
1179
  }
998
1180
  if (typeof secret === 'undefined') {
@@ -1018,8 +1200,7 @@ class Account extends Service {
1018
1200
  }, payload);
1019
1201
  }
1020
1202
  /**
1021
- * Get the list of active sessions across different devices for the currently
1022
- * logged in user.
1203
+ * Get the list of active sessions across different devices for the currently logged in user.
1023
1204
  *
1024
1205
  * @throws {AppwriteException}
1025
1206
  * @returns {Promise}
@@ -1031,8 +1212,7 @@ class Account extends Service {
1031
1212
  return this.client.call('get', uri, {}, payload);
1032
1213
  }
1033
1214
  /**
1034
- * Delete all sessions from the user account and remove any sessions cookies
1035
- * from the end client.
1215
+ * Delete all sessions from the user account and remove any sessions cookies from the end client.
1036
1216
  *
1037
1217
  * @throws {AppwriteException}
1038
1218
  * @returns {Promise}
@@ -1046,13 +1226,7 @@ class Account extends Service {
1046
1226
  }, payload);
1047
1227
  }
1048
1228
  /**
1049
- * Use this endpoint to allow a new user to register an anonymous account in
1050
- * your project. This route will also create a new session for the user. To
1051
- * allow the new user to convert an anonymous account to a normal account, you
1052
- * need to update its [email and
1053
- * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
1054
- * or create an [OAuth2
1055
- * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
1229
+ * 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).
1056
1230
  *
1057
1231
  * @throws {AppwriteException}
1058
1232
  * @returns {Promise}
@@ -1065,20 +1239,19 @@ class Account extends Service {
1065
1239
  'content-type': 'application/json',
1066
1240
  }, payload);
1067
1241
  }
1068
- /**
1069
- * Allow the user to login into their account by providing a valid email and
1070
- * password combination. This route will create a new session for the user.
1071
- *
1072
- * A user is limited to 10 active sessions at a time by default. [Learn more
1073
- * about session
1074
- * limits](https://appwrite.io/docs/authentication-security#limits).
1075
- *
1076
- * @param {string} email
1077
- * @param {string} password
1078
- * @throws {AppwriteException}
1079
- * @returns {Promise}
1080
- */
1081
- createEmailPasswordSession(email, password) {
1242
+ createEmailPasswordSession(paramsOrFirst, ...rest) {
1243
+ let params;
1244
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1245
+ params = (paramsOrFirst || {});
1246
+ }
1247
+ else {
1248
+ params = {
1249
+ email: paramsOrFirst,
1250
+ password: rest[0]
1251
+ };
1252
+ }
1253
+ const email = params.email;
1254
+ const password = params.password;
1082
1255
  if (typeof email === 'undefined') {
1083
1256
  throw new AppwriteException('Missing required parameter: "email"');
1084
1257
  }
@@ -1098,17 +1271,19 @@ class Account extends Service {
1098
1271
  'content-type': 'application/json',
1099
1272
  }, payload);
1100
1273
  }
1101
- /**
1102
- * Use this endpoint to create a session from token. Provide the **userId**
1103
- * and **secret** parameters from the successful response of authentication
1104
- * flows initiated by token creation. For example, magic URL and phone login.
1105
- *
1106
- * @param {string} userId
1107
- * @param {string} secret
1108
- * @throws {AppwriteException}
1109
- * @returns {Promise}
1110
- */
1111
- updateMagicURLSession(userId, secret) {
1274
+ updateMagicURLSession(paramsOrFirst, ...rest) {
1275
+ let params;
1276
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1277
+ params = (paramsOrFirst || {});
1278
+ }
1279
+ else {
1280
+ params = {
1281
+ userId: paramsOrFirst,
1282
+ secret: rest[0]
1283
+ };
1284
+ }
1285
+ const userId = params.userId;
1286
+ const secret = params.secret;
1112
1287
  if (typeof userId === 'undefined') {
1113
1288
  throw new AppwriteException('Missing required parameter: "userId"');
1114
1289
  }
@@ -1128,32 +1303,23 @@ class Account extends Service {
1128
1303
  'content-type': 'application/json',
1129
1304
  }, payload);
1130
1305
  }
1131
- /**
1132
- * Allow the user to login to their account using the OAuth2 provider of their
1133
- * choice. Each OAuth2 provider should be enabled from the Appwrite console
1134
- * first. Use the success and failure arguments to provide a redirect URL's
1135
- * back to your app when login is completed.
1136
- *
1137
- * If there is already an active session, the new session will be attached to
1138
- * the logged-in account. If there are no active sessions, the server will
1139
- * attempt to look for a user with the same email address as the email
1140
- * received from the OAuth2 provider and attach the new session to the
1141
- * existing user. If no matching user is found - the server will create a new
1142
- * user.
1143
- *
1144
- * A user is limited to 10 active sessions at a time by default. [Learn more
1145
- * about session
1146
- * limits](https://appwrite.io/docs/authentication-security#limits).
1147
- *
1148
- *
1149
- * @param {OAuthProvider} provider
1150
- * @param {string} success
1151
- * @param {string} failure
1152
- * @param {string[]} scopes
1153
- * @throws {AppwriteException}
1154
- * @returns {void|string}
1155
- */
1156
- createOAuth2Session(provider, success, failure, scopes) {
1306
+ createOAuth2Session(paramsOrFirst, ...rest) {
1307
+ let params;
1308
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
1309
+ params = (paramsOrFirst || {});
1310
+ }
1311
+ else {
1312
+ params = {
1313
+ provider: paramsOrFirst,
1314
+ success: rest[0],
1315
+ failure: rest[1],
1316
+ scopes: rest[2]
1317
+ };
1318
+ }
1319
+ const provider = params.provider;
1320
+ const success = params.success;
1321
+ const failure = params.failure;
1322
+ const scopes = params.scopes;
1157
1323
  if (typeof provider === 'undefined') {
1158
1324
  throw new AppwriteException('Missing required parameter: "provider"');
1159
1325
  }
@@ -1175,17 +1341,19 @@ class Account extends Service {
1175
1341
  }
1176
1342
  return uri;
1177
1343
  }
1178
- /**
1179
- * Use this endpoint to create a session from token. Provide the **userId**
1180
- * and **secret** parameters from the successful response of authentication
1181
- * flows initiated by token creation. For example, magic URL and phone login.
1182
- *
1183
- * @param {string} userId
1184
- * @param {string} secret
1185
- * @throws {AppwriteException}
1186
- * @returns {Promise}
1187
- */
1188
- updatePhoneSession(userId, secret) {
1344
+ updatePhoneSession(paramsOrFirst, ...rest) {
1345
+ let params;
1346
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1347
+ params = (paramsOrFirst || {});
1348
+ }
1349
+ else {
1350
+ params = {
1351
+ userId: paramsOrFirst,
1352
+ secret: rest[0]
1353
+ };
1354
+ }
1355
+ const userId = params.userId;
1356
+ const secret = params.secret;
1189
1357
  if (typeof userId === 'undefined') {
1190
1358
  throw new AppwriteException('Missing required parameter: "userId"');
1191
1359
  }
@@ -1205,17 +1373,19 @@ class Account extends Service {
1205
1373
  'content-type': 'application/json',
1206
1374
  }, payload);
1207
1375
  }
1208
- /**
1209
- * Use this endpoint to create a session from token. Provide the **userId**
1210
- * and **secret** parameters from the successful response of authentication
1211
- * flows initiated by token creation. For example, magic URL and phone login.
1212
- *
1213
- * @param {string} userId
1214
- * @param {string} secret
1215
- * @throws {AppwriteException}
1216
- * @returns {Promise}
1217
- */
1218
- createSession(userId, secret) {
1376
+ createSession(paramsOrFirst, ...rest) {
1377
+ let params;
1378
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1379
+ params = (paramsOrFirst || {});
1380
+ }
1381
+ else {
1382
+ params = {
1383
+ userId: paramsOrFirst,
1384
+ secret: rest[0]
1385
+ };
1386
+ }
1387
+ const userId = params.userId;
1388
+ const secret = params.secret;
1219
1389
  if (typeof userId === 'undefined') {
1220
1390
  throw new AppwriteException('Missing required parameter: "userId"');
1221
1391
  }
@@ -1235,15 +1405,17 @@ class Account extends Service {
1235
1405
  'content-type': 'application/json',
1236
1406
  }, payload);
1237
1407
  }
1238
- /**
1239
- * Use this endpoint to get a logged in user's session using a Session ID.
1240
- * Inputting 'current' will return the current session being used.
1241
- *
1242
- * @param {string} sessionId
1243
- * @throws {AppwriteException}
1244
- * @returns {Promise}
1245
- */
1246
- getSession(sessionId) {
1408
+ getSession(paramsOrFirst) {
1409
+ let params;
1410
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1411
+ params = (paramsOrFirst || {});
1412
+ }
1413
+ else {
1414
+ params = {
1415
+ sessionId: paramsOrFirst
1416
+ };
1417
+ }
1418
+ const sessionId = params.sessionId;
1247
1419
  if (typeof sessionId === 'undefined') {
1248
1420
  throw new AppwriteException('Missing required parameter: "sessionId"');
1249
1421
  }
@@ -1252,16 +1424,17 @@ class Account extends Service {
1252
1424
  const uri = new URL(this.client.config.endpoint + apiPath);
1253
1425
  return this.client.call('get', uri, {}, payload);
1254
1426
  }
1255
- /**
1256
- * Use this endpoint to extend a session's length. Extending a session is
1257
- * useful when session expiry is short. If the session was created using an
1258
- * OAuth provider, this endpoint refreshes the access token from the provider.
1259
- *
1260
- * @param {string} sessionId
1261
- * @throws {AppwriteException}
1262
- * @returns {Promise}
1263
- */
1264
- updateSession(sessionId) {
1427
+ updateSession(paramsOrFirst) {
1428
+ let params;
1429
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1430
+ params = (paramsOrFirst || {});
1431
+ }
1432
+ else {
1433
+ params = {
1434
+ sessionId: paramsOrFirst
1435
+ };
1436
+ }
1437
+ const sessionId = params.sessionId;
1265
1438
  if (typeof sessionId === 'undefined') {
1266
1439
  throw new AppwriteException('Missing required parameter: "sessionId"');
1267
1440
  }
@@ -1272,18 +1445,17 @@ class Account extends Service {
1272
1445
  'content-type': 'application/json',
1273
1446
  }, payload);
1274
1447
  }
1275
- /**
1276
- * Logout the user. Use 'current' as the session ID to logout on this device,
1277
- * use a session ID to logout on another device. If you're looking to logout
1278
- * the user on all devices, use [Delete
1279
- * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
1280
- * instead.
1281
- *
1282
- * @param {string} sessionId
1283
- * @throws {AppwriteException}
1284
- * @returns {Promise}
1285
- */
1286
- deleteSession(sessionId) {
1448
+ deleteSession(paramsOrFirst) {
1449
+ let params;
1450
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1451
+ params = (paramsOrFirst || {});
1452
+ }
1453
+ else {
1454
+ params = {
1455
+ sessionId: paramsOrFirst
1456
+ };
1457
+ }
1458
+ const sessionId = params.sessionId;
1287
1459
  if (typeof sessionId === 'undefined') {
1288
1460
  throw new AppwriteException('Missing required parameter: "sessionId"');
1289
1461
  }
@@ -1295,9 +1467,7 @@ class Account extends Service {
1295
1467
  }, payload);
1296
1468
  }
1297
1469
  /**
1298
- * Block the currently logged in user account. Behind the scene, the user
1299
- * record is not deleted but permanently blocked from any access. To
1300
- * completely delete a user, use the Users API instead.
1470
+ * 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.
1301
1471
  *
1302
1472
  * @throws {AppwriteException}
1303
1473
  * @returns {Promise}
@@ -1310,20 +1480,21 @@ class Account extends Service {
1310
1480
  'content-type': 'application/json',
1311
1481
  }, payload);
1312
1482
  }
1313
- /**
1314
- * Use this endpoint to register a device for push notifications. Provide a
1315
- * target ID (custom or generated using ID.unique()), a device identifier
1316
- * (usually a device token), and optionally specify which provider should send
1317
- * notifications to this target. The target is automatically linked to the
1318
- * current session and includes device information like brand and model.
1319
- *
1320
- * @param {string} targetId
1321
- * @param {string} identifier
1322
- * @param {string} providerId
1323
- * @throws {AppwriteException}
1324
- * @returns {Promise}
1325
- */
1326
- createPushTarget(targetId, identifier, providerId) {
1483
+ createPushTarget(paramsOrFirst, ...rest) {
1484
+ let params;
1485
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1486
+ params = (paramsOrFirst || {});
1487
+ }
1488
+ else {
1489
+ params = {
1490
+ targetId: paramsOrFirst,
1491
+ identifier: rest[0],
1492
+ providerId: rest[1]
1493
+ };
1494
+ }
1495
+ const targetId = params.targetId;
1496
+ const identifier = params.identifier;
1497
+ const providerId = params.providerId;
1327
1498
  if (typeof targetId === 'undefined') {
1328
1499
  throw new AppwriteException('Missing required parameter: "targetId"');
1329
1500
  }
@@ -1346,19 +1517,19 @@ class Account extends Service {
1346
1517
  'content-type': 'application/json',
1347
1518
  }, payload);
1348
1519
  }
1349
- /**
1350
- * Update the currently logged in user's push notification target. You can
1351
- * modify the target's identifier (device token) and provider ID (token,
1352
- * email, phone etc.). The target must exist and belong to the current user.
1353
- * If you change the provider ID, notifications will be sent through the new
1354
- * messaging provider instead.
1355
- *
1356
- * @param {string} targetId
1357
- * @param {string} identifier
1358
- * @throws {AppwriteException}
1359
- * @returns {Promise}
1360
- */
1361
- updatePushTarget(targetId, identifier) {
1520
+ updatePushTarget(paramsOrFirst, ...rest) {
1521
+ let params;
1522
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1523
+ params = (paramsOrFirst || {});
1524
+ }
1525
+ else {
1526
+ params = {
1527
+ targetId: paramsOrFirst,
1528
+ identifier: rest[0]
1529
+ };
1530
+ }
1531
+ const targetId = params.targetId;
1532
+ const identifier = params.identifier;
1362
1533
  if (typeof targetId === 'undefined') {
1363
1534
  throw new AppwriteException('Missing required parameter: "targetId"');
1364
1535
  }
@@ -1375,16 +1546,17 @@ class Account extends Service {
1375
1546
  'content-type': 'application/json',
1376
1547
  }, payload);
1377
1548
  }
1378
- /**
1379
- * Delete a push notification target for the currently logged in user. After
1380
- * deletion, the device will no longer receive push notifications. The target
1381
- * must exist and belong to the current user.
1382
- *
1383
- * @param {string} targetId
1384
- * @throws {AppwriteException}
1385
- * @returns {Promise}
1386
- */
1387
- deletePushTarget(targetId) {
1549
+ deletePushTarget(paramsOrFirst) {
1550
+ let params;
1551
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1552
+ params = (paramsOrFirst || {});
1553
+ }
1554
+ else {
1555
+ params = {
1556
+ targetId: paramsOrFirst
1557
+ };
1558
+ }
1559
+ const targetId = params.targetId;
1388
1560
  if (typeof targetId === 'undefined') {
1389
1561
  throw new AppwriteException('Missing required parameter: "targetId"');
1390
1562
  }
@@ -1395,25 +1567,21 @@ class Account extends Service {
1395
1567
  'content-type': 'application/json',
1396
1568
  }, payload);
1397
1569
  }
1398
- /**
1399
- * Sends the user an email with a secret key for creating a session. If the
1400
- * provided user ID has not be registered, a new user will be created. Use the
1401
- * returned user ID and secret and submit a request to the [POST
1402
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1403
- * endpoint to complete the login process. The secret sent to the user's email
1404
- * is valid for 15 minutes.
1405
- *
1406
- * A user is limited to 10 active sessions at a time by default. [Learn more
1407
- * about session
1408
- * limits](https://appwrite.io/docs/authentication-security#limits).
1409
- *
1410
- * @param {string} userId
1411
- * @param {string} email
1412
- * @param {boolean} phrase
1413
- * @throws {AppwriteException}
1414
- * @returns {Promise}
1415
- */
1416
- createEmailToken(userId, email, phrase) {
1570
+ createEmailToken(paramsOrFirst, ...rest) {
1571
+ let params;
1572
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1573
+ params = (paramsOrFirst || {});
1574
+ }
1575
+ else {
1576
+ params = {
1577
+ userId: paramsOrFirst,
1578
+ email: rest[0],
1579
+ phrase: rest[1]
1580
+ };
1581
+ }
1582
+ const userId = params.userId;
1583
+ const email = params.email;
1584
+ const phrase = params.phrase;
1417
1585
  if (typeof userId === 'undefined') {
1418
1586
  throw new AppwriteException('Missing required parameter: "userId"');
1419
1587
  }
@@ -1436,30 +1604,23 @@ class Account extends Service {
1436
1604
  'content-type': 'application/json',
1437
1605
  }, payload);
1438
1606
  }
1439
- /**
1440
- * Sends the user an email with a secret key for creating a session. If the
1441
- * provided user ID has not been registered, a new user will be created. When
1442
- * the user clicks the link in the email, the user is redirected back to the
1443
- * URL you provided with the secret key and userId values attached to the URL
1444
- * query string. Use the query string parameters to submit a request to the
1445
- * [POST
1446
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1447
- * endpoint to complete the login process. The link sent to the user's email
1448
- * address is valid for 1 hour.
1449
- *
1450
- * A user is limited to 10 active sessions at a time by default. [Learn more
1451
- * about session
1452
- * limits](https://appwrite.io/docs/authentication-security#limits).
1453
- *
1454
- *
1455
- * @param {string} userId
1456
- * @param {string} email
1457
- * @param {string} url
1458
- * @param {boolean} phrase
1459
- * @throws {AppwriteException}
1460
- * @returns {Promise}
1461
- */
1462
- createMagicURLToken(userId, email, url, phrase) {
1607
+ createMagicURLToken(paramsOrFirst, ...rest) {
1608
+ let params;
1609
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1610
+ params = (paramsOrFirst || {});
1611
+ }
1612
+ else {
1613
+ params = {
1614
+ userId: paramsOrFirst,
1615
+ email: rest[0],
1616
+ url: rest[1],
1617
+ phrase: rest[2]
1618
+ };
1619
+ }
1620
+ const userId = params.userId;
1621
+ const email = params.email;
1622
+ const url = params.url;
1623
+ const phrase = params.phrase;
1463
1624
  if (typeof userId === 'undefined') {
1464
1625
  throw new AppwriteException('Missing required parameter: "userId"');
1465
1626
  }
@@ -1485,30 +1646,23 @@ class Account extends Service {
1485
1646
  'content-type': 'application/json',
1486
1647
  }, payload);
1487
1648
  }
1488
- /**
1489
- * Allow the user to login to their account using the OAuth2 provider of their
1490
- * choice. Each OAuth2 provider should be enabled from the Appwrite console
1491
- * first. Use the success and failure arguments to provide a redirect URL's
1492
- * back to your app when login is completed.
1493
- *
1494
- * If authentication succeeds, `userId` and `secret` of a token will be
1495
- * appended to the success URL as query parameters. These can be used to
1496
- * create a new session using the [Create
1497
- * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1498
- * endpoint.
1499
- *
1500
- * A user is limited to 10 active sessions at a time by default. [Learn more
1501
- * about session
1502
- * limits](https://appwrite.io/docs/authentication-security#limits).
1503
- *
1504
- * @param {OAuthProvider} provider
1505
- * @param {string} success
1506
- * @param {string} failure
1507
- * @param {string[]} scopes
1508
- * @throws {AppwriteException}
1509
- * @returns {void|string}
1510
- */
1511
- createOAuth2Token(provider, success, failure, scopes) {
1649
+ createOAuth2Token(paramsOrFirst, ...rest) {
1650
+ let params;
1651
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
1652
+ params = (paramsOrFirst || {});
1653
+ }
1654
+ else {
1655
+ params = {
1656
+ provider: paramsOrFirst,
1657
+ success: rest[0],
1658
+ failure: rest[1],
1659
+ scopes: rest[2]
1660
+ };
1661
+ }
1662
+ const provider = params.provider;
1663
+ const success = params.success;
1664
+ const failure = params.failure;
1665
+ const scopes = params.scopes;
1512
1666
  if (typeof provider === 'undefined') {
1513
1667
  throw new AppwriteException('Missing required parameter: "provider"');
1514
1668
  }
@@ -1530,24 +1684,19 @@ class Account extends Service {
1530
1684
  }
1531
1685
  return uri;
1532
1686
  }
1533
- /**
1534
- * Sends the user an SMS with a secret key for creating a session. If the
1535
- * provided user ID has not be registered, a new user will be created. Use the
1536
- * returned user ID and secret and submit a request to the [POST
1537
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1538
- * endpoint to complete the login process. The secret sent to the user's phone
1539
- * is valid for 15 minutes.
1540
- *
1541
- * A user is limited to 10 active sessions at a time by default. [Learn more
1542
- * about session
1543
- * limits](https://appwrite.io/docs/authentication-security#limits).
1544
- *
1545
- * @param {string} userId
1546
- * @param {string} phone
1547
- * @throws {AppwriteException}
1548
- * @returns {Promise}
1549
- */
1550
- createPhoneToken(userId, phone) {
1687
+ createPhoneToken(paramsOrFirst, ...rest) {
1688
+ let params;
1689
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1690
+ params = (paramsOrFirst || {});
1691
+ }
1692
+ else {
1693
+ params = {
1694
+ userId: paramsOrFirst,
1695
+ phone: rest[0]
1696
+ };
1697
+ }
1698
+ const userId = params.userId;
1699
+ const phone = params.phone;
1551
1700
  if (typeof userId === 'undefined') {
1552
1701
  throw new AppwriteException('Missing required parameter: "userId"');
1553
1702
  }
@@ -1567,28 +1716,17 @@ class Account extends Service {
1567
1716
  'content-type': 'application/json',
1568
1717
  }, payload);
1569
1718
  }
1570
- /**
1571
- * Use this endpoint to send a verification message to your user email address
1572
- * to confirm they are the valid owners of that address. Both the **userId**
1573
- * and **secret** arguments will be passed as query parameters to the URL you
1574
- * have provided to be attached to the verification email. The provided URL
1575
- * should redirect the user back to your app and allow you to complete the
1576
- * verification process by verifying both the **userId** and **secret**
1577
- * parameters. Learn more about how to [complete the verification
1578
- * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
1579
- * The verification link sent to the user's email address is valid for 7 days.
1580
- *
1581
- * Please note that in order to avoid a [Redirect
1582
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
1583
- * the only valid redirect URLs are the ones from domains you have set when
1584
- * adding your platforms in the console interface.
1585
- *
1586
- *
1587
- * @param {string} url
1588
- * @throws {AppwriteException}
1589
- * @returns {Promise}
1590
- */
1591
- createVerification(url) {
1719
+ createVerification(paramsOrFirst) {
1720
+ let params;
1721
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1722
+ params = (paramsOrFirst || {});
1723
+ }
1724
+ else {
1725
+ params = {
1726
+ url: paramsOrFirst
1727
+ };
1728
+ }
1729
+ const url = params.url;
1592
1730
  if (typeof url === 'undefined') {
1593
1731
  throw new AppwriteException('Missing required parameter: "url"');
1594
1732
  }
@@ -1602,18 +1740,19 @@ class Account extends Service {
1602
1740
  'content-type': 'application/json',
1603
1741
  }, payload);
1604
1742
  }
1605
- /**
1606
- * Use this endpoint to complete the user email verification process. Use both
1607
- * the **userId** and **secret** parameters that were attached to your app URL
1608
- * to verify the user email ownership. If confirmed this route will return a
1609
- * 200 status code.
1610
- *
1611
- * @param {string} userId
1612
- * @param {string} secret
1613
- * @throws {AppwriteException}
1614
- * @returns {Promise}
1615
- */
1616
- updateVerification(userId, secret) {
1743
+ updateVerification(paramsOrFirst, ...rest) {
1744
+ let params;
1745
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1746
+ params = (paramsOrFirst || {});
1747
+ }
1748
+ else {
1749
+ params = {
1750
+ userId: paramsOrFirst,
1751
+ secret: rest[0]
1752
+ };
1753
+ }
1754
+ const userId = params.userId;
1755
+ const secret = params.secret;
1617
1756
  if (typeof userId === 'undefined') {
1618
1757
  throw new AppwriteException('Missing required parameter: "userId"');
1619
1758
  }
@@ -1634,14 +1773,7 @@ class Account extends Service {
1634
1773
  }, payload);
1635
1774
  }
1636
1775
  /**
1637
- * Use this endpoint to send a verification SMS to the currently logged in
1638
- * user. This endpoint is meant for use after updating a user's phone number
1639
- * using the
1640
- * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
1641
- * endpoint. Learn more about how to [complete the verification
1642
- * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
1643
- * The verification code sent to the user's phone number is valid for 15
1644
- * minutes.
1776
+ * 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.
1645
1777
  *
1646
1778
  * @throws {AppwriteException}
1647
1779
  * @returns {Promise}
@@ -1654,18 +1786,19 @@ class Account extends Service {
1654
1786
  'content-type': 'application/json',
1655
1787
  }, payload);
1656
1788
  }
1657
- /**
1658
- * Use this endpoint to complete the user phone verification process. Use the
1659
- * **userId** and **secret** that were sent to your user's phone number to
1660
- * verify the user email ownership. If confirmed this route will return a 200
1661
- * status code.
1662
- *
1663
- * @param {string} userId
1664
- * @param {string} secret
1665
- * @throws {AppwriteException}
1666
- * @returns {Promise}
1667
- */
1668
- updatePhoneVerification(userId, secret) {
1789
+ updatePhoneVerification(paramsOrFirst, ...rest) {
1790
+ let params;
1791
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1792
+ params = (paramsOrFirst || {});
1793
+ }
1794
+ else {
1795
+ params = {
1796
+ userId: paramsOrFirst,
1797
+ secret: rest[0]
1798
+ };
1799
+ }
1800
+ const userId = params.userId;
1801
+ const secret = params.secret;
1669
1802
  if (typeof userId === 'undefined') {
1670
1803
  throw new AppwriteException('Missing required parameter: "userId"');
1671
1804
  }
@@ -1691,26 +1824,23 @@ class Avatars extends Service {
1691
1824
  constructor(client) {
1692
1825
  super(client);
1693
1826
  }
1694
- /**
1695
- * You can use this endpoint to show different browser icons to your users.
1696
- * The code argument receives the browser code as it appears in your user [GET
1697
- * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
1698
- * endpoint. Use width, height and quality arguments to change the output
1699
- * settings.
1700
- *
1701
- * When one dimension is specified and the other is 0, the image is scaled
1702
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1703
- * image at source quality. If dimensions are not specified, the default size
1704
- * of image returned is 100x100px.
1705
- *
1706
- * @param {Browser} code
1707
- * @param {number} width
1708
- * @param {number} height
1709
- * @param {number} quality
1710
- * @throws {AppwriteException}
1711
- * @returns {ArrayBuffer}
1712
- */
1713
- getBrowser(code, width, height, quality) {
1827
+ getBrowser(paramsOrFirst, ...rest) {
1828
+ let params;
1829
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
1830
+ params = (paramsOrFirst || {});
1831
+ }
1832
+ else {
1833
+ params = {
1834
+ code: paramsOrFirst,
1835
+ width: rest[0],
1836
+ height: rest[1],
1837
+ quality: rest[2]
1838
+ };
1839
+ }
1840
+ const code = params.code;
1841
+ const width = params.width;
1842
+ const height = params.height;
1843
+ const quality = params.quality;
1714
1844
  if (typeof code === 'undefined') {
1715
1845
  throw new AppwriteException('Missing required parameter: "code"');
1716
1846
  }
@@ -1732,25 +1862,23 @@ class Avatars extends Service {
1732
1862
  }
1733
1863
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1734
1864
  }
1735
- /**
1736
- * The credit card endpoint will return you the icon of the credit card
1737
- * provider you need. Use width, height and quality arguments to change the
1738
- * output settings.
1739
- *
1740
- * When one dimension is specified and the other is 0, the image is scaled
1741
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1742
- * image at source quality. If dimensions are not specified, the default size
1743
- * of image returned is 100x100px.
1744
- *
1745
- *
1746
- * @param {CreditCard} code
1747
- * @param {number} width
1748
- * @param {number} height
1749
- * @param {number} quality
1750
- * @throws {AppwriteException}
1751
- * @returns {ArrayBuffer}
1752
- */
1753
- getCreditCard(code, width, height, quality) {
1865
+ getCreditCard(paramsOrFirst, ...rest) {
1866
+ let params;
1867
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
1868
+ params = (paramsOrFirst || {});
1869
+ }
1870
+ else {
1871
+ params = {
1872
+ code: paramsOrFirst,
1873
+ width: rest[0],
1874
+ height: rest[1],
1875
+ quality: rest[2]
1876
+ };
1877
+ }
1878
+ const code = params.code;
1879
+ const width = params.width;
1880
+ const height = params.height;
1881
+ const quality = params.quality;
1754
1882
  if (typeof code === 'undefined') {
1755
1883
  throw new AppwriteException('Missing required parameter: "code"');
1756
1884
  }
@@ -1772,17 +1900,17 @@ class Avatars extends Service {
1772
1900
  }
1773
1901
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1774
1902
  }
1775
- /**
1776
- * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
1777
- * website URL.
1778
- *
1779
- * This endpoint does not follow HTTP redirects.
1780
- *
1781
- * @param {string} url
1782
- * @throws {AppwriteException}
1783
- * @returns {ArrayBuffer}
1784
- */
1785
- getFavicon(url) {
1903
+ getFavicon(paramsOrFirst) {
1904
+ let params;
1905
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1906
+ params = (paramsOrFirst || {});
1907
+ }
1908
+ else {
1909
+ params = {
1910
+ url: paramsOrFirst
1911
+ };
1912
+ }
1913
+ const url = params.url;
1786
1914
  if (typeof url === 'undefined') {
1787
1915
  throw new AppwriteException('Missing required parameter: "url"');
1788
1916
  }
@@ -1798,26 +1926,23 @@ class Avatars extends Service {
1798
1926
  }
1799
1927
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1800
1928
  }
1801
- /**
1802
- * You can use this endpoint to show different country flags icons to your
1803
- * users. The code argument receives the 2 letter country code. Use width,
1804
- * height and quality arguments to change the output settings. Country codes
1805
- * follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
1806
- *
1807
- * When one dimension is specified and the other is 0, the image is scaled
1808
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1809
- * image at source quality. If dimensions are not specified, the default size
1810
- * of image returned is 100x100px.
1811
- *
1812
- *
1813
- * @param {Flag} code
1814
- * @param {number} width
1815
- * @param {number} height
1816
- * @param {number} quality
1817
- * @throws {AppwriteException}
1818
- * @returns {ArrayBuffer}
1819
- */
1820
- getFlag(code, width, height, quality) {
1929
+ getFlag(paramsOrFirst, ...rest) {
1930
+ let params;
1931
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
1932
+ params = (paramsOrFirst || {});
1933
+ }
1934
+ else {
1935
+ params = {
1936
+ code: paramsOrFirst,
1937
+ width: rest[0],
1938
+ height: rest[1],
1939
+ quality: rest[2]
1940
+ };
1941
+ }
1942
+ const code = params.code;
1943
+ const width = params.width;
1944
+ const height = params.height;
1945
+ const quality = params.quality;
1821
1946
  if (typeof code === 'undefined') {
1822
1947
  throw new AppwriteException('Missing required parameter: "code"');
1823
1948
  }
@@ -1839,26 +1964,21 @@ class Avatars extends Service {
1839
1964
  }
1840
1965
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1841
1966
  }
1842
- /**
1843
- * Use this endpoint to fetch a remote image URL and crop it to any image size
1844
- * you want. This endpoint is very useful if you need to crop and display
1845
- * remote images in your app or in case you want to make sure a 3rd party
1846
- * image is properly served using a TLS protocol.
1847
- *
1848
- * When one dimension is specified and the other is 0, the image is scaled
1849
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1850
- * image at source quality. If dimensions are not specified, the default size
1851
- * of image returned is 400x400px.
1852
- *
1853
- * This endpoint does not follow HTTP redirects.
1854
- *
1855
- * @param {string} url
1856
- * @param {number} width
1857
- * @param {number} height
1858
- * @throws {AppwriteException}
1859
- * @returns {ArrayBuffer}
1860
- */
1861
- getImage(url, width, height) {
1967
+ getImage(paramsOrFirst, ...rest) {
1968
+ let params;
1969
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1970
+ params = (paramsOrFirst || {});
1971
+ }
1972
+ else {
1973
+ params = {
1974
+ url: paramsOrFirst,
1975
+ width: rest[0],
1976
+ height: rest[1]
1977
+ };
1978
+ }
1979
+ const url = params.url;
1980
+ const width = params.width;
1981
+ const height = params.height;
1862
1982
  if (typeof url === 'undefined') {
1863
1983
  throw new AppwriteException('Missing required parameter: "url"');
1864
1984
  }
@@ -1880,32 +2000,23 @@ class Avatars extends Service {
1880
2000
  }
1881
2001
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1882
2002
  }
1883
- /**
1884
- * Use this endpoint to show your user initials avatar icon on your website or
1885
- * app. By default, this route will try to print your logged-in user name or
1886
- * email initials. You can also overwrite the user name if you pass the 'name'
1887
- * parameter. If no name is given and no user is logged, an empty avatar will
1888
- * be returned.
1889
- *
1890
- * You can use the color and background params to change the avatar colors. By
1891
- * default, a random theme will be selected. The random theme will persist for
1892
- * the user's initials when reloading the same theme will always return for
1893
- * the same initials.
1894
- *
1895
- * When one dimension is specified and the other is 0, the image is scaled
1896
- * with preserved aspect ratio. If both dimensions are 0, the API provides an
1897
- * image at source quality. If dimensions are not specified, the default size
1898
- * of image returned is 100x100px.
1899
- *
1900
- *
1901
- * @param {string} name
1902
- * @param {number} width
1903
- * @param {number} height
1904
- * @param {string} background
1905
- * @throws {AppwriteException}
1906
- * @returns {ArrayBuffer}
1907
- */
1908
- getInitials(name, width, height, background) {
2003
+ getInitials(paramsOrFirst, ...rest) {
2004
+ let params;
2005
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2006
+ params = (paramsOrFirst || {});
2007
+ }
2008
+ else {
2009
+ params = {
2010
+ name: paramsOrFirst,
2011
+ width: rest[0],
2012
+ height: rest[1],
2013
+ background: rest[2]
2014
+ };
2015
+ }
2016
+ const name = params.name;
2017
+ const width = params.width;
2018
+ const height = params.height;
2019
+ const background = params.background;
1909
2020
  const apiPath = '/avatars/initials';
1910
2021
  const payload = {};
1911
2022
  if (typeof name !== 'undefined') {
@@ -1927,19 +2038,23 @@ class Avatars extends Service {
1927
2038
  }
1928
2039
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
1929
2040
  }
1930
- /**
1931
- * Converts a given plain text to a QR code image. You can use the query
1932
- * parameters to change the size and style of the resulting image.
1933
- *
1934
- *
1935
- * @param {string} text
1936
- * @param {number} size
1937
- * @param {number} margin
1938
- * @param {boolean} download
1939
- * @throws {AppwriteException}
1940
- * @returns {ArrayBuffer}
1941
- */
1942
- getQR(text, size, margin, download) {
2041
+ getQR(paramsOrFirst, ...rest) {
2042
+ let params;
2043
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2044
+ params = (paramsOrFirst || {});
2045
+ }
2046
+ else {
2047
+ params = {
2048
+ text: paramsOrFirst,
2049
+ size: rest[0],
2050
+ margin: rest[1],
2051
+ download: rest[2]
2052
+ };
2053
+ }
2054
+ const text = params.text;
2055
+ const size = params.size;
2056
+ const margin = params.margin;
2057
+ const download = params.download;
1943
2058
  if (typeof text === 'undefined') {
1944
2059
  throw new AppwriteException('Missing required parameter: "text"');
1945
2060
  }
@@ -2225,17 +2340,21 @@ class Databases extends Service {
2225
2340
  constructor(client) {
2226
2341
  super(client);
2227
2342
  }
2228
- /**
2229
- * Get a list of all the user's documents in a given collection. You can use
2230
- * the query params to filter your results.
2231
- *
2232
- * @param {string} databaseId
2233
- * @param {string} collectionId
2234
- * @param {string[]} queries
2235
- * @throws {AppwriteException}
2236
- * @returns {Promise}
2237
- */
2238
- listDocuments(databaseId, collectionId, queries) {
2343
+ listDocuments(paramsOrFirst, ...rest) {
2344
+ let params;
2345
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2346
+ params = (paramsOrFirst || {});
2347
+ }
2348
+ else {
2349
+ params = {
2350
+ databaseId: paramsOrFirst,
2351
+ collectionId: rest[0],
2352
+ queries: rest[1]
2353
+ };
2354
+ }
2355
+ const databaseId = params.databaseId;
2356
+ const collectionId = params.collectionId;
2357
+ const queries = params.queries;
2239
2358
  if (typeof databaseId === 'undefined') {
2240
2359
  throw new AppwriteException('Missing required parameter: "databaseId"');
2241
2360
  }
@@ -2250,21 +2369,25 @@ class Databases extends Service {
2250
2369
  const uri = new URL(this.client.config.endpoint + apiPath);
2251
2370
  return this.client.call('get', uri, {}, payload);
2252
2371
  }
2253
- /**
2254
- * Create a new Document. Before using this route, you should create a new
2255
- * collection resource using either a [server
2256
- * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
2257
- * API or directly from your database console.
2258
- *
2259
- * @param {string} databaseId
2260
- * @param {string} collectionId
2261
- * @param {string} documentId
2262
- * @param {object} data
2263
- * @param {string[]} permissions
2264
- * @throws {AppwriteException}
2265
- * @returns {Promise}
2266
- */
2267
- createDocument(databaseId, collectionId, documentId, data, permissions) {
2372
+ createDocument(paramsOrFirst, ...rest) {
2373
+ let params;
2374
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2375
+ params = (paramsOrFirst || {});
2376
+ }
2377
+ else {
2378
+ params = {
2379
+ databaseId: paramsOrFirst,
2380
+ collectionId: rest[0],
2381
+ documentId: rest[1],
2382
+ data: rest[2],
2383
+ permissions: rest[3]
2384
+ };
2385
+ }
2386
+ const databaseId = params.databaseId;
2387
+ const collectionId = params.collectionId;
2388
+ const documentId = params.documentId;
2389
+ const data = params.data;
2390
+ const permissions = params.permissions;
2268
2391
  if (typeof databaseId === 'undefined') {
2269
2392
  throw new AppwriteException('Missing required parameter: "databaseId"');
2270
2393
  }
@@ -2293,18 +2416,23 @@ class Databases extends Service {
2293
2416
  'content-type': 'application/json',
2294
2417
  }, payload);
2295
2418
  }
2296
- /**
2297
- * Get a document by its unique ID. This endpoint response returns a JSON
2298
- * object with the document data.
2299
- *
2300
- * @param {string} databaseId
2301
- * @param {string} collectionId
2302
- * @param {string} documentId
2303
- * @param {string[]} queries
2304
- * @throws {AppwriteException}
2305
- * @returns {Promise}
2306
- */
2307
- getDocument(databaseId, collectionId, documentId, queries) {
2419
+ getDocument(paramsOrFirst, ...rest) {
2420
+ let params;
2421
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2422
+ params = (paramsOrFirst || {});
2423
+ }
2424
+ else {
2425
+ params = {
2426
+ databaseId: paramsOrFirst,
2427
+ collectionId: rest[0],
2428
+ documentId: rest[1],
2429
+ queries: rest[2]
2430
+ };
2431
+ }
2432
+ const databaseId = params.databaseId;
2433
+ const collectionId = params.collectionId;
2434
+ const documentId = params.documentId;
2435
+ const queries = params.queries;
2308
2436
  if (typeof databaseId === 'undefined') {
2309
2437
  throw new AppwriteException('Missing required parameter: "databaseId"');
2310
2438
  }
@@ -2322,25 +2450,25 @@ class Databases extends Service {
2322
2450
  const uri = new URL(this.client.config.endpoint + apiPath);
2323
2451
  return this.client.call('get', uri, {}, payload);
2324
2452
  }
2325
- /**
2326
- * **WARNING: Experimental Feature** - This endpoint is experimental and not
2327
- * yet officially supported. It may be subject to breaking changes or removal
2328
- * in future versions.
2329
- *
2330
- * Create or update a Document. Before using this route, you should create a
2331
- * new collection resource using either a [server
2332
- * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
2333
- * API or directly from your database console.
2334
- *
2335
- * @param {string} databaseId
2336
- * @param {string} collectionId
2337
- * @param {string} documentId
2338
- * @param {object} data
2339
- * @param {string[]} permissions
2340
- * @throws {AppwriteException}
2341
- * @returns {Promise}
2342
- */
2343
- upsertDocument(databaseId, collectionId, documentId, data, permissions) {
2453
+ upsertDocument(paramsOrFirst, ...rest) {
2454
+ let params;
2455
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2456
+ params = (paramsOrFirst || {});
2457
+ }
2458
+ else {
2459
+ params = {
2460
+ databaseId: paramsOrFirst,
2461
+ collectionId: rest[0],
2462
+ documentId: rest[1],
2463
+ data: rest[2],
2464
+ permissions: rest[3]
2465
+ };
2466
+ }
2467
+ const databaseId = params.databaseId;
2468
+ const collectionId = params.collectionId;
2469
+ const documentId = params.documentId;
2470
+ const data = params.data;
2471
+ const permissions = params.permissions;
2344
2472
  if (typeof databaseId === 'undefined') {
2345
2473
  throw new AppwriteException('Missing required parameter: "databaseId"');
2346
2474
  }
@@ -2366,19 +2494,25 @@ class Databases extends Service {
2366
2494
  'content-type': 'application/json',
2367
2495
  }, payload);
2368
2496
  }
2369
- /**
2370
- * Update a document by its unique ID. Using the patch method you can pass
2371
- * only specific fields that will get updated.
2372
- *
2373
- * @param {string} databaseId
2374
- * @param {string} collectionId
2375
- * @param {string} documentId
2376
- * @param {object} data
2377
- * @param {string[]} permissions
2378
- * @throws {AppwriteException}
2379
- * @returns {Promise}
2380
- */
2381
- updateDocument(databaseId, collectionId, documentId, data, permissions) {
2497
+ updateDocument(paramsOrFirst, ...rest) {
2498
+ let params;
2499
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2500
+ params = (paramsOrFirst || {});
2501
+ }
2502
+ else {
2503
+ params = {
2504
+ databaseId: paramsOrFirst,
2505
+ collectionId: rest[0],
2506
+ documentId: rest[1],
2507
+ data: rest[2],
2508
+ permissions: rest[3]
2509
+ };
2510
+ }
2511
+ const databaseId = params.databaseId;
2512
+ const collectionId = params.collectionId;
2513
+ const documentId = params.documentId;
2514
+ const data = params.data;
2515
+ const permissions = params.permissions;
2382
2516
  if (typeof databaseId === 'undefined') {
2383
2517
  throw new AppwriteException('Missing required parameter: "databaseId"');
2384
2518
  }
@@ -2401,16 +2535,21 @@ class Databases extends Service {
2401
2535
  'content-type': 'application/json',
2402
2536
  }, payload);
2403
2537
  }
2404
- /**
2405
- * Delete a document by its unique ID.
2406
- *
2407
- * @param {string} databaseId
2408
- * @param {string} collectionId
2409
- * @param {string} documentId
2410
- * @throws {AppwriteException}
2411
- * @returns {Promise}
2412
- */
2413
- deleteDocument(databaseId, collectionId, documentId) {
2538
+ deleteDocument(paramsOrFirst, ...rest) {
2539
+ let params;
2540
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2541
+ params = (paramsOrFirst || {});
2542
+ }
2543
+ else {
2544
+ params = {
2545
+ databaseId: paramsOrFirst,
2546
+ collectionId: rest[0],
2547
+ documentId: rest[1]
2548
+ };
2549
+ }
2550
+ const databaseId = params.databaseId;
2551
+ const collectionId = params.collectionId;
2552
+ const documentId = params.documentId;
2414
2553
  if (typeof databaseId === 'undefined') {
2415
2554
  throw new AppwriteException('Missing required parameter: "databaseId"');
2416
2555
  }
@@ -2427,19 +2566,27 @@ class Databases extends Service {
2427
2566
  'content-type': 'application/json',
2428
2567
  }, payload);
2429
2568
  }
2430
- /**
2431
- * Decrement a specific attribute of a document by a given value.
2432
- *
2433
- * @param {string} databaseId
2434
- * @param {string} collectionId
2435
- * @param {string} documentId
2436
- * @param {string} attribute
2437
- * @param {number} value
2438
- * @param {number} min
2439
- * @throws {AppwriteException}
2440
- * @returns {Promise}
2441
- */
2442
- decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min) {
2569
+ decrementDocumentAttribute(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
+ attribute: rest[2],
2580
+ value: rest[3],
2581
+ min: rest[4]
2582
+ };
2583
+ }
2584
+ const databaseId = params.databaseId;
2585
+ const collectionId = params.collectionId;
2586
+ const documentId = params.documentId;
2587
+ const attribute = params.attribute;
2588
+ const value = params.value;
2589
+ const min = params.min;
2443
2590
  if (typeof databaseId === 'undefined') {
2444
2591
  throw new AppwriteException('Missing required parameter: "databaseId"');
2445
2592
  }
@@ -2465,19 +2612,27 @@ class Databases extends Service {
2465
2612
  'content-type': 'application/json',
2466
2613
  }, payload);
2467
2614
  }
2468
- /**
2469
- * Increment a specific attribute of a document by a given value.
2470
- *
2471
- * @param {string} databaseId
2472
- * @param {string} collectionId
2473
- * @param {string} documentId
2474
- * @param {string} attribute
2475
- * @param {number} value
2476
- * @param {number} max
2477
- * @throws {AppwriteException}
2478
- * @returns {Promise}
2479
- */
2480
- incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max) {
2615
+ incrementDocumentAttribute(paramsOrFirst, ...rest) {
2616
+ let params;
2617
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2618
+ params = (paramsOrFirst || {});
2619
+ }
2620
+ else {
2621
+ params = {
2622
+ databaseId: paramsOrFirst,
2623
+ collectionId: rest[0],
2624
+ documentId: rest[1],
2625
+ attribute: rest[2],
2626
+ value: rest[3],
2627
+ max: rest[4]
2628
+ };
2629
+ }
2630
+ const databaseId = params.databaseId;
2631
+ const collectionId = params.collectionId;
2632
+ const documentId = params.documentId;
2633
+ const attribute = params.attribute;
2634
+ const value = params.value;
2635
+ const max = params.max;
2481
2636
  if (typeof databaseId === 'undefined') {
2482
2637
  throw new AppwriteException('Missing required parameter: "databaseId"');
2483
2638
  }
@@ -2509,16 +2664,19 @@ class Functions extends Service {
2509
2664
  constructor(client) {
2510
2665
  super(client);
2511
2666
  }
2512
- /**
2513
- * Get a list of all the current user function execution logs. You can use the
2514
- * query params to filter your results.
2515
- *
2516
- * @param {string} functionId
2517
- * @param {string[]} queries
2518
- * @throws {AppwriteException}
2519
- * @returns {Promise}
2520
- */
2521
- listExecutions(functionId, queries) {
2667
+ listExecutions(paramsOrFirst, ...rest) {
2668
+ let params;
2669
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2670
+ params = (paramsOrFirst || {});
2671
+ }
2672
+ else {
2673
+ params = {
2674
+ functionId: paramsOrFirst,
2675
+ queries: rest[0]
2676
+ };
2677
+ }
2678
+ const functionId = params.functionId;
2679
+ const queries = params.queries;
2522
2680
  if (typeof functionId === 'undefined') {
2523
2681
  throw new AppwriteException('Missing required parameter: "functionId"');
2524
2682
  }
@@ -2530,23 +2688,29 @@ class Functions extends Service {
2530
2688
  const uri = new URL(this.client.config.endpoint + apiPath);
2531
2689
  return this.client.call('get', uri, {}, payload);
2532
2690
  }
2533
- /**
2534
- * Trigger a function execution. The returned object will return you the
2535
- * current execution status. You can ping the `Get Execution` endpoint to get
2536
- * updates on the current execution status. Once this endpoint is called, your
2537
- * function execution process will start asynchronously.
2538
- *
2539
- * @param {string} functionId
2540
- * @param {string} body
2541
- * @param {boolean} async
2542
- * @param {string} xpath
2543
- * @param {ExecutionMethod} method
2544
- * @param {object} headers
2545
- * @param {string} scheduledAt
2546
- * @throws {AppwriteException}
2547
- * @returns {Promise}
2548
- */
2549
- createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
2691
+ createExecution(paramsOrFirst, ...rest) {
2692
+ let params;
2693
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2694
+ params = (paramsOrFirst || {});
2695
+ }
2696
+ else {
2697
+ params = {
2698
+ functionId: paramsOrFirst,
2699
+ body: rest[0],
2700
+ async: rest[1],
2701
+ xpath: rest[2],
2702
+ method: rest[3],
2703
+ headers: rest[4],
2704
+ scheduledAt: rest[5]
2705
+ };
2706
+ }
2707
+ const functionId = params.functionId;
2708
+ const body = params.body;
2709
+ const async = params.async;
2710
+ const xpath = params.xpath;
2711
+ const method = params.method;
2712
+ const headers = params.headers;
2713
+ const scheduledAt = params.scheduledAt;
2550
2714
  if (typeof functionId === 'undefined') {
2551
2715
  throw new AppwriteException('Missing required parameter: "functionId"');
2552
2716
  }
@@ -2575,15 +2739,19 @@ class Functions extends Service {
2575
2739
  'content-type': 'application/json',
2576
2740
  }, payload);
2577
2741
  }
2578
- /**
2579
- * Get a function execution log by its unique ID.
2580
- *
2581
- * @param {string} functionId
2582
- * @param {string} executionId
2583
- * @throws {AppwriteException}
2584
- * @returns {Promise}
2585
- */
2586
- getExecution(functionId, executionId) {
2742
+ getExecution(paramsOrFirst, ...rest) {
2743
+ let params;
2744
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2745
+ params = (paramsOrFirst || {});
2746
+ }
2747
+ else {
2748
+ params = {
2749
+ functionId: paramsOrFirst,
2750
+ executionId: rest[0]
2751
+ };
2752
+ }
2753
+ const functionId = params.functionId;
2754
+ const executionId = params.executionId;
2587
2755
  if (typeof functionId === 'undefined') {
2588
2756
  throw new AppwriteException('Missing required parameter: "functionId"');
2589
2757
  }
@@ -2601,14 +2769,17 @@ class Graphql extends Service {
2601
2769
  constructor(client) {
2602
2770
  super(client);
2603
2771
  }
2604
- /**
2605
- * Execute a GraphQL mutation.
2606
- *
2607
- * @param {object} query
2608
- * @throws {AppwriteException}
2609
- * @returns {Promise}
2610
- */
2611
- query(query) {
2772
+ query(paramsOrFirst) {
2773
+ let params;
2774
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2775
+ params = (paramsOrFirst || {});
2776
+ }
2777
+ else {
2778
+ params = {
2779
+ query: paramsOrFirst
2780
+ };
2781
+ }
2782
+ const query = params.query;
2612
2783
  if (typeof query === 'undefined') {
2613
2784
  throw new AppwriteException('Missing required parameter: "query"');
2614
2785
  }
@@ -2623,14 +2794,17 @@ class Graphql extends Service {
2623
2794
  'content-type': 'application/json',
2624
2795
  }, payload);
2625
2796
  }
2626
- /**
2627
- * Execute a GraphQL mutation.
2628
- *
2629
- * @param {object} query
2630
- * @throws {AppwriteException}
2631
- * @returns {Promise}
2632
- */
2633
- mutation(query) {
2797
+ mutation(paramsOrFirst) {
2798
+ let params;
2799
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2800
+ params = (paramsOrFirst || {});
2801
+ }
2802
+ else {
2803
+ params = {
2804
+ query: paramsOrFirst
2805
+ };
2806
+ }
2807
+ const query = params.query;
2634
2808
  if (typeof query === 'undefined') {
2635
2809
  throw new AppwriteException('Missing required parameter: "query"');
2636
2810
  }
@@ -2652,10 +2826,7 @@ class Locale extends Service {
2652
2826
  super(client);
2653
2827
  }
2654
2828
  /**
2655
- * Get the current user location based on IP. Returns an object with user
2656
- * country code, country name, continent name, continent code, ip address and
2657
- * suggested currency. You can use the locale header to get the data in a
2658
- * supported language.
2829
+ * 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.
2659
2830
  *
2660
2831
  * ([IP Geolocation by DB-IP](https://db-ip.com))
2661
2832
  *
@@ -2669,8 +2840,7 @@ class Locale extends Service {
2669
2840
  return this.client.call('get', uri, {}, payload);
2670
2841
  }
2671
2842
  /**
2672
- * List of all locale codes in [ISO
2673
- * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2843
+ * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2674
2844
  *
2675
2845
  * @throws {AppwriteException}
2676
2846
  * @returns {Promise}
@@ -2682,8 +2852,7 @@ class Locale extends Service {
2682
2852
  return this.client.call('get', uri, {}, payload);
2683
2853
  }
2684
2854
  /**
2685
- * List of all continents. You can use the locale header to get the data in a
2686
- * supported language.
2855
+ * List of all continents. You can use the locale header to get the data in a supported language.
2687
2856
  *
2688
2857
  * @throws {AppwriteException}
2689
2858
  * @returns {Promise}
@@ -2695,8 +2864,7 @@ class Locale extends Service {
2695
2864
  return this.client.call('get', uri, {}, payload);
2696
2865
  }
2697
2866
  /**
2698
- * List of all countries. You can use the locale header to get the data in a
2699
- * supported language.
2867
+ * List of all countries. You can use the locale header to get the data in a supported language.
2700
2868
  *
2701
2869
  * @throws {AppwriteException}
2702
2870
  * @returns {Promise}
@@ -2708,8 +2876,7 @@ class Locale extends Service {
2708
2876
  return this.client.call('get', uri, {}, payload);
2709
2877
  }
2710
2878
  /**
2711
- * List of all countries that are currently members of the EU. You can use the
2712
- * locale header to get the data in a supported language.
2879
+ * 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.
2713
2880
  *
2714
2881
  * @throws {AppwriteException}
2715
2882
  * @returns {Promise}
@@ -2721,8 +2888,7 @@ class Locale extends Service {
2721
2888
  return this.client.call('get', uri, {}, payload);
2722
2889
  }
2723
2890
  /**
2724
- * List of all countries phone codes. You can use the locale header to get the
2725
- * data in a supported language.
2891
+ * List of all countries phone codes. You can use the locale header to get the data in a supported language.
2726
2892
  *
2727
2893
  * @throws {AppwriteException}
2728
2894
  * @returns {Promise}
@@ -2734,9 +2900,7 @@ class Locale extends Service {
2734
2900
  return this.client.call('get', uri, {}, payload);
2735
2901
  }
2736
2902
  /**
2737
- * List of all currencies, including currency symbol, name, plural, and
2738
- * decimal digits for all major and minor currencies. You can use the locale
2739
- * header to get the data in a supported language.
2903
+ * 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.
2740
2904
  *
2741
2905
  * @throws {AppwriteException}
2742
2906
  * @returns {Promise}
@@ -2748,8 +2912,7 @@ class Locale extends Service {
2748
2912
  return this.client.call('get', uri, {}, payload);
2749
2913
  }
2750
2914
  /**
2751
- * List of all languages classified by ISO 639-1 including 2-letter code, name
2752
- * in English, and name in the respective language.
2915
+ * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
2753
2916
  *
2754
2917
  * @throws {AppwriteException}
2755
2918
  * @returns {Promise}
@@ -2766,16 +2929,21 @@ class Messaging extends Service {
2766
2929
  constructor(client) {
2767
2930
  super(client);
2768
2931
  }
2769
- /**
2770
- * Create a new subscriber.
2771
- *
2772
- * @param {string} topicId
2773
- * @param {string} subscriberId
2774
- * @param {string} targetId
2775
- * @throws {AppwriteException}
2776
- * @returns {Promise}
2777
- */
2778
- createSubscriber(topicId, subscriberId, targetId) {
2932
+ createSubscriber(paramsOrFirst, ...rest) {
2933
+ let params;
2934
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2935
+ params = (paramsOrFirst || {});
2936
+ }
2937
+ else {
2938
+ params = {
2939
+ topicId: paramsOrFirst,
2940
+ subscriberId: rest[0],
2941
+ targetId: rest[1]
2942
+ };
2943
+ }
2944
+ const topicId = params.topicId;
2945
+ const subscriberId = params.subscriberId;
2946
+ const targetId = params.targetId;
2779
2947
  if (typeof topicId === 'undefined') {
2780
2948
  throw new AppwriteException('Missing required parameter: "topicId"');
2781
2949
  }
@@ -2798,15 +2966,19 @@ class Messaging extends Service {
2798
2966
  'content-type': 'application/json',
2799
2967
  }, payload);
2800
2968
  }
2801
- /**
2802
- * Delete a subscriber by its unique ID.
2803
- *
2804
- * @param {string} topicId
2805
- * @param {string} subscriberId
2806
- * @throws {AppwriteException}
2807
- * @returns {Promise}
2808
- */
2809
- deleteSubscriber(topicId, subscriberId) {
2969
+ deleteSubscriber(paramsOrFirst, ...rest) {
2970
+ let params;
2971
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2972
+ params = (paramsOrFirst || {});
2973
+ }
2974
+ else {
2975
+ params = {
2976
+ topicId: paramsOrFirst,
2977
+ subscriberId: rest[0]
2978
+ };
2979
+ }
2980
+ const topicId = params.topicId;
2981
+ const subscriberId = params.subscriberId;
2810
2982
  if (typeof topicId === 'undefined') {
2811
2983
  throw new AppwriteException('Missing required parameter: "topicId"');
2812
2984
  }
@@ -2826,17 +2998,21 @@ class Storage extends Service {
2826
2998
  constructor(client) {
2827
2999
  super(client);
2828
3000
  }
2829
- /**
2830
- * Get a list of all the user files. You can use the query params to filter
2831
- * your results.
2832
- *
2833
- * @param {string} bucketId
2834
- * @param {string[]} queries
2835
- * @param {string} search
2836
- * @throws {AppwriteException}
2837
- * @returns {Promise}
2838
- */
2839
- listFiles(bucketId, queries, search) {
3001
+ listFiles(paramsOrFirst, ...rest) {
3002
+ let params;
3003
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3004
+ params = (paramsOrFirst || {});
3005
+ }
3006
+ else {
3007
+ params = {
3008
+ bucketId: paramsOrFirst,
3009
+ queries: rest[0],
3010
+ search: rest[1]
3011
+ };
3012
+ }
3013
+ const bucketId = params.bucketId;
3014
+ const queries = params.queries;
3015
+ const search = params.search;
2840
3016
  if (typeof bucketId === 'undefined') {
2841
3017
  throw new AppwriteException('Missing required parameter: "bucketId"');
2842
3018
  }
@@ -2851,35 +3027,27 @@ class Storage extends Service {
2851
3027
  const uri = new URL(this.client.config.endpoint + apiPath);
2852
3028
  return this.client.call('get', uri, {}, payload);
2853
3029
  }
2854
- /**
2855
- * Create a new file. Before using this route, you should create a new bucket
2856
- * resource using either a [server
2857
- * integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
2858
- * API or directly from your Appwrite console.
2859
- *
2860
- * Larger files should be uploaded using multiple requests with the
2861
- * [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
2862
- * header to send a partial request with a maximum supported chunk of `5MB`.
2863
- * The `content-range` header values should always be in bytes.
2864
- *
2865
- * When the first request is sent, the server will return the **File** object,
2866
- * and the subsequent part request must include the file's **id** in
2867
- * `x-appwrite-id` header to allow the server to know that the partial upload
2868
- * is for the existing file and not for a new one.
2869
- *
2870
- * If you're creating a new file using one of the Appwrite SDKs, all the
2871
- * chunking logic will be managed by the SDK internally.
2872
- *
2873
- *
2874
- * @param {string} bucketId
2875
- * @param {string} fileId
2876
- * @param {{name: string, type: string, size: number, uri: string}} file
2877
- * @param {string[]} permissions
2878
- * @throws {AppwriteException}
2879
- * @returns {Promise}
2880
- */
2881
- createFile(bucketId_1, fileId_1, file_1, permissions_1) {
2882
- return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
3030
+ createFile(paramsOrFirst, ...rest) {
3031
+ return __awaiter(this, void 0, void 0, function* () {
3032
+ let params;
3033
+ let onProgress;
3034
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3035
+ params = (paramsOrFirst || {});
3036
+ onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
3037
+ }
3038
+ else {
3039
+ params = {
3040
+ bucketId: paramsOrFirst,
3041
+ fileId: rest[0],
3042
+ file: rest[1],
3043
+ permissions: rest[2]
3044
+ };
3045
+ onProgress = rest[3];
3046
+ }
3047
+ const bucketId = params.bucketId;
3048
+ const fileId = params.fileId;
3049
+ const file = params.file;
3050
+ const permissions = params.permissions;
2883
3051
  if (typeof bucketId === 'undefined') {
2884
3052
  throw new AppwriteException('Missing required parameter: "bucketId"');
2885
3053
  }
@@ -2951,16 +3119,19 @@ class Storage extends Service {
2951
3119
  return response;
2952
3120
  });
2953
3121
  }
2954
- /**
2955
- * Get a file by its unique ID. This endpoint response returns a JSON object
2956
- * with the file metadata.
2957
- *
2958
- * @param {string} bucketId
2959
- * @param {string} fileId
2960
- * @throws {AppwriteException}
2961
- * @returns {Promise}
2962
- */
2963
- getFile(bucketId, fileId) {
3122
+ getFile(paramsOrFirst, ...rest) {
3123
+ let params;
3124
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3125
+ params = (paramsOrFirst || {});
3126
+ }
3127
+ else {
3128
+ params = {
3129
+ bucketId: paramsOrFirst,
3130
+ fileId: rest[0]
3131
+ };
3132
+ }
3133
+ const bucketId = params.bucketId;
3134
+ const fileId = params.fileId;
2964
3135
  if (typeof bucketId === 'undefined') {
2965
3136
  throw new AppwriteException('Missing required parameter: "bucketId"');
2966
3137
  }
@@ -2972,18 +3143,23 @@ class Storage extends Service {
2972
3143
  const uri = new URL(this.client.config.endpoint + apiPath);
2973
3144
  return this.client.call('get', uri, {}, payload);
2974
3145
  }
2975
- /**
2976
- * Update a file by its unique ID. Only users with write permissions have
2977
- * access to update this resource.
2978
- *
2979
- * @param {string} bucketId
2980
- * @param {string} fileId
2981
- * @param {string} name
2982
- * @param {string[]} permissions
2983
- * @throws {AppwriteException}
2984
- * @returns {Promise}
2985
- */
2986
- updateFile(bucketId, fileId, name, permissions) {
3146
+ updateFile(paramsOrFirst, ...rest) {
3147
+ let params;
3148
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3149
+ params = (paramsOrFirst || {});
3150
+ }
3151
+ else {
3152
+ params = {
3153
+ bucketId: paramsOrFirst,
3154
+ fileId: rest[0],
3155
+ name: rest[1],
3156
+ permissions: rest[2]
3157
+ };
3158
+ }
3159
+ const bucketId = params.bucketId;
3160
+ const fileId = params.fileId;
3161
+ const name = params.name;
3162
+ const permissions = params.permissions;
2987
3163
  if (typeof bucketId === 'undefined') {
2988
3164
  throw new AppwriteException('Missing required parameter: "bucketId"');
2989
3165
  }
@@ -3003,16 +3179,19 @@ class Storage extends Service {
3003
3179
  'content-type': 'application/json',
3004
3180
  }, payload);
3005
3181
  }
3006
- /**
3007
- * Delete a file by its unique ID. Only users with write permissions have
3008
- * access to delete this resource.
3009
- *
3010
- * @param {string} bucketId
3011
- * @param {string} fileId
3012
- * @throws {AppwriteException}
3013
- * @returns {Promise}
3014
- */
3015
- deleteFile(bucketId, fileId) {
3182
+ deleteFile(paramsOrFirst, ...rest) {
3183
+ let params;
3184
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3185
+ params = (paramsOrFirst || {});
3186
+ }
3187
+ else {
3188
+ params = {
3189
+ bucketId: paramsOrFirst,
3190
+ fileId: rest[0]
3191
+ };
3192
+ }
3193
+ const bucketId = params.bucketId;
3194
+ const fileId = params.fileId;
3016
3195
  if (typeof bucketId === 'undefined') {
3017
3196
  throw new AppwriteException('Missing required parameter: "bucketId"');
3018
3197
  }
@@ -3026,18 +3205,21 @@ class Storage extends Service {
3026
3205
  'content-type': 'application/json',
3027
3206
  }, payload);
3028
3207
  }
3029
- /**
3030
- * Get a file content by its unique ID. The endpoint response return with a
3031
- * 'Content-Disposition: attachment' header that tells the browser to start
3032
- * downloading the file to user downloads directory.
3033
- *
3034
- * @param {string} bucketId
3035
- * @param {string} fileId
3036
- * @param {string} token
3037
- * @throws {AppwriteException}
3038
- * @returns {ArrayBuffer}
3039
- */
3040
- getFileDownload(bucketId, fileId, token) {
3208
+ getFileDownload(paramsOrFirst, ...rest) {
3209
+ let params;
3210
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3211
+ params = (paramsOrFirst || {});
3212
+ }
3213
+ else {
3214
+ params = {
3215
+ bucketId: paramsOrFirst,
3216
+ fileId: rest[0],
3217
+ token: rest[1]
3218
+ };
3219
+ }
3220
+ const bucketId = params.bucketId;
3221
+ const fileId = params.fileId;
3222
+ const token = params.token;
3041
3223
  if (typeof bucketId === 'undefined') {
3042
3224
  throw new AppwriteException('Missing required parameter: "bucketId"');
3043
3225
  }
@@ -3056,31 +3238,43 @@ class Storage extends Service {
3056
3238
  }
3057
3239
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3058
3240
  }
3059
- /**
3060
- * Get a file preview image. Currently, this method supports preview for image
3061
- * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
3062
- * and spreadsheets, will return the file icon image. You can also pass query
3063
- * string arguments for cutting and resizing your preview image. Preview is
3064
- * supported only for image files smaller than 10MB.
3065
- *
3066
- * @param {string} bucketId
3067
- * @param {string} fileId
3068
- * @param {number} width
3069
- * @param {number} height
3070
- * @param {ImageGravity} gravity
3071
- * @param {number} quality
3072
- * @param {number} borderWidth
3073
- * @param {string} borderColor
3074
- * @param {number} borderRadius
3075
- * @param {number} opacity
3076
- * @param {number} rotation
3077
- * @param {string} background
3078
- * @param {ImageFormat} output
3079
- * @param {string} token
3080
- * @throws {AppwriteException}
3081
- * @returns {ArrayBuffer}
3082
- */
3083
- getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) {
3241
+ getFilePreview(paramsOrFirst, ...rest) {
3242
+ let params;
3243
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3244
+ params = (paramsOrFirst || {});
3245
+ }
3246
+ else {
3247
+ params = {
3248
+ bucketId: paramsOrFirst,
3249
+ fileId: rest[0],
3250
+ width: rest[1],
3251
+ height: rest[2],
3252
+ gravity: rest[3],
3253
+ quality: rest[4],
3254
+ borderWidth: rest[5],
3255
+ borderColor: rest[6],
3256
+ borderRadius: rest[7],
3257
+ opacity: rest[8],
3258
+ rotation: rest[9],
3259
+ background: rest[10],
3260
+ output: rest[11],
3261
+ token: rest[12]
3262
+ };
3263
+ }
3264
+ const bucketId = params.bucketId;
3265
+ const fileId = params.fileId;
3266
+ const width = params.width;
3267
+ const height = params.height;
3268
+ const gravity = params.gravity;
3269
+ const quality = params.quality;
3270
+ const borderWidth = params.borderWidth;
3271
+ const borderColor = params.borderColor;
3272
+ const borderRadius = params.borderRadius;
3273
+ const opacity = params.opacity;
3274
+ const rotation = params.rotation;
3275
+ const background = params.background;
3276
+ const output = params.output;
3277
+ const token = params.token;
3084
3278
  if (typeof bucketId === 'undefined') {
3085
3279
  throw new AppwriteException('Missing required parameter: "bucketId"');
3086
3280
  }
@@ -3132,18 +3326,21 @@ class Storage extends Service {
3132
3326
  }
3133
3327
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3134
3328
  }
3135
- /**
3136
- * Get a file content by its unique ID. This endpoint is similar to the
3137
- * download method but returns with no 'Content-Disposition: attachment'
3138
- * header.
3139
- *
3140
- * @param {string} bucketId
3141
- * @param {string} fileId
3142
- * @param {string} token
3143
- * @throws {AppwriteException}
3144
- * @returns {ArrayBuffer}
3145
- */
3146
- getFileView(bucketId, fileId, token) {
3329
+ getFileView(paramsOrFirst, ...rest) {
3330
+ let params;
3331
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3332
+ params = (paramsOrFirst || {});
3333
+ }
3334
+ else {
3335
+ params = {
3336
+ bucketId: paramsOrFirst,
3337
+ fileId: rest[0],
3338
+ token: rest[1]
3339
+ };
3340
+ }
3341
+ const bucketId = params.bucketId;
3342
+ const fileId = params.fileId;
3343
+ const token = params.token;
3147
3344
  if (typeof bucketId === 'undefined') {
3148
3345
  throw new AppwriteException('Missing required parameter: "bucketId"');
3149
3346
  }
@@ -3282,20 +3479,344 @@ class Storage extends Service {
3282
3479
  }
3283
3480
  }
3284
3481
 
3285
- class Teams extends Service {
3482
+ class TablesDB extends Service {
3286
3483
  constructor(client) {
3287
3484
  super(client);
3288
3485
  }
3289
- /**
3290
- * Get a list of all the teams in which the current user is a member. You can
3291
- * use the parameters to filter your results.
3292
- *
3293
- * @param {string[]} queries
3294
- * @param {string} search
3295
- * @throws {AppwriteException}
3296
- * @returns {Promise}
3297
- */
3298
- list(queries, search) {
3486
+ listRows(paramsOrFirst, ...rest) {
3487
+ let params;
3488
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3489
+ params = (paramsOrFirst || {});
3490
+ }
3491
+ else {
3492
+ params = {
3493
+ databaseId: paramsOrFirst,
3494
+ tableId: rest[0],
3495
+ queries: rest[1]
3496
+ };
3497
+ }
3498
+ const databaseId = params.databaseId;
3499
+ const tableId = params.tableId;
3500
+ const queries = params.queries;
3501
+ if (typeof databaseId === 'undefined') {
3502
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3503
+ }
3504
+ if (typeof tableId === 'undefined') {
3505
+ throw new AppwriteException('Missing required parameter: "tableId"');
3506
+ }
3507
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3508
+ const payload = {};
3509
+ if (typeof queries !== 'undefined') {
3510
+ payload['queries'] = queries;
3511
+ }
3512
+ const uri = new URL(this.client.config.endpoint + apiPath);
3513
+ return this.client.call('get', uri, {}, payload);
3514
+ }
3515
+ createRow(paramsOrFirst, ...rest) {
3516
+ let params;
3517
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3518
+ params = (paramsOrFirst || {});
3519
+ }
3520
+ else {
3521
+ params = {
3522
+ databaseId: paramsOrFirst,
3523
+ tableId: rest[0],
3524
+ rowId: rest[1],
3525
+ data: rest[2],
3526
+ permissions: rest[3]
3527
+ };
3528
+ }
3529
+ const databaseId = params.databaseId;
3530
+ const tableId = params.tableId;
3531
+ const rowId = params.rowId;
3532
+ const data = params.data;
3533
+ const permissions = params.permissions;
3534
+ if (typeof databaseId === 'undefined') {
3535
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3536
+ }
3537
+ if (typeof tableId === 'undefined') {
3538
+ throw new AppwriteException('Missing required parameter: "tableId"');
3539
+ }
3540
+ if (typeof rowId === 'undefined') {
3541
+ throw new AppwriteException('Missing required parameter: "rowId"');
3542
+ }
3543
+ if (typeof data === 'undefined') {
3544
+ throw new AppwriteException('Missing required parameter: "data"');
3545
+ }
3546
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3547
+ const payload = {};
3548
+ if (typeof rowId !== 'undefined') {
3549
+ payload['rowId'] = rowId;
3550
+ }
3551
+ if (typeof data !== 'undefined') {
3552
+ payload['data'] = data;
3553
+ }
3554
+ if (typeof permissions !== 'undefined') {
3555
+ payload['permissions'] = permissions;
3556
+ }
3557
+ const uri = new URL(this.client.config.endpoint + apiPath);
3558
+ return this.client.call('post', uri, {
3559
+ 'content-type': 'application/json',
3560
+ }, payload);
3561
+ }
3562
+ getRow(paramsOrFirst, ...rest) {
3563
+ let params;
3564
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3565
+ params = (paramsOrFirst || {});
3566
+ }
3567
+ else {
3568
+ params = {
3569
+ databaseId: paramsOrFirst,
3570
+ tableId: rest[0],
3571
+ rowId: rest[1],
3572
+ queries: rest[2]
3573
+ };
3574
+ }
3575
+ const databaseId = params.databaseId;
3576
+ const tableId = params.tableId;
3577
+ const rowId = params.rowId;
3578
+ const queries = params.queries;
3579
+ if (typeof databaseId === 'undefined') {
3580
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3581
+ }
3582
+ if (typeof tableId === 'undefined') {
3583
+ throw new AppwriteException('Missing required parameter: "tableId"');
3584
+ }
3585
+ if (typeof rowId === 'undefined') {
3586
+ throw new AppwriteException('Missing required parameter: "rowId"');
3587
+ }
3588
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3589
+ const payload = {};
3590
+ if (typeof queries !== 'undefined') {
3591
+ payload['queries'] = queries;
3592
+ }
3593
+ const uri = new URL(this.client.config.endpoint + apiPath);
3594
+ return this.client.call('get', uri, {}, payload);
3595
+ }
3596
+ upsertRow(paramsOrFirst, ...rest) {
3597
+ let params;
3598
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3599
+ params = (paramsOrFirst || {});
3600
+ }
3601
+ else {
3602
+ params = {
3603
+ databaseId: paramsOrFirst,
3604
+ tableId: rest[0],
3605
+ rowId: rest[1],
3606
+ data: rest[2],
3607
+ permissions: rest[3]
3608
+ };
3609
+ }
3610
+ const databaseId = params.databaseId;
3611
+ const tableId = params.tableId;
3612
+ const rowId = params.rowId;
3613
+ const data = params.data;
3614
+ const permissions = params.permissions;
3615
+ if (typeof databaseId === 'undefined') {
3616
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3617
+ }
3618
+ if (typeof tableId === 'undefined') {
3619
+ throw new AppwriteException('Missing required parameter: "tableId"');
3620
+ }
3621
+ if (typeof rowId === 'undefined') {
3622
+ throw new AppwriteException('Missing required parameter: "rowId"');
3623
+ }
3624
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3625
+ const payload = {};
3626
+ if (typeof data !== 'undefined') {
3627
+ payload['data'] = data;
3628
+ }
3629
+ if (typeof permissions !== 'undefined') {
3630
+ payload['permissions'] = permissions;
3631
+ }
3632
+ const uri = new URL(this.client.config.endpoint + apiPath);
3633
+ return this.client.call('put', uri, {
3634
+ 'content-type': 'application/json',
3635
+ }, payload);
3636
+ }
3637
+ updateRow(paramsOrFirst, ...rest) {
3638
+ let params;
3639
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3640
+ params = (paramsOrFirst || {});
3641
+ }
3642
+ else {
3643
+ params = {
3644
+ databaseId: paramsOrFirst,
3645
+ tableId: rest[0],
3646
+ rowId: rest[1],
3647
+ data: rest[2],
3648
+ permissions: rest[3]
3649
+ };
3650
+ }
3651
+ const databaseId = params.databaseId;
3652
+ const tableId = params.tableId;
3653
+ const rowId = params.rowId;
3654
+ const data = params.data;
3655
+ const permissions = params.permissions;
3656
+ if (typeof databaseId === 'undefined') {
3657
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3658
+ }
3659
+ if (typeof tableId === 'undefined') {
3660
+ throw new AppwriteException('Missing required parameter: "tableId"');
3661
+ }
3662
+ if (typeof rowId === 'undefined') {
3663
+ throw new AppwriteException('Missing required parameter: "rowId"');
3664
+ }
3665
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3666
+ const payload = {};
3667
+ if (typeof data !== 'undefined') {
3668
+ payload['data'] = data;
3669
+ }
3670
+ if (typeof permissions !== 'undefined') {
3671
+ payload['permissions'] = permissions;
3672
+ }
3673
+ const uri = new URL(this.client.config.endpoint + apiPath);
3674
+ return this.client.call('patch', uri, {
3675
+ 'content-type': 'application/json',
3676
+ }, payload);
3677
+ }
3678
+ deleteRow(paramsOrFirst, ...rest) {
3679
+ let params;
3680
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3681
+ params = (paramsOrFirst || {});
3682
+ }
3683
+ else {
3684
+ params = {
3685
+ databaseId: paramsOrFirst,
3686
+ tableId: rest[0],
3687
+ rowId: rest[1]
3688
+ };
3689
+ }
3690
+ const databaseId = params.databaseId;
3691
+ const tableId = params.tableId;
3692
+ const rowId = params.rowId;
3693
+ if (typeof databaseId === 'undefined') {
3694
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3695
+ }
3696
+ if (typeof tableId === 'undefined') {
3697
+ throw new AppwriteException('Missing required parameter: "tableId"');
3698
+ }
3699
+ if (typeof rowId === 'undefined') {
3700
+ throw new AppwriteException('Missing required parameter: "rowId"');
3701
+ }
3702
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3703
+ const payload = {};
3704
+ const uri = new URL(this.client.config.endpoint + apiPath);
3705
+ return this.client.call('delete', uri, {
3706
+ 'content-type': 'application/json',
3707
+ }, payload);
3708
+ }
3709
+ decrementRowColumn(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
+ column: rest[2],
3720
+ value: rest[3],
3721
+ min: rest[4]
3722
+ };
3723
+ }
3724
+ const databaseId = params.databaseId;
3725
+ const tableId = params.tableId;
3726
+ const rowId = params.rowId;
3727
+ const column = params.column;
3728
+ const value = params.value;
3729
+ const min = params.min;
3730
+ if (typeof databaseId === 'undefined') {
3731
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3732
+ }
3733
+ if (typeof tableId === 'undefined') {
3734
+ throw new AppwriteException('Missing required parameter: "tableId"');
3735
+ }
3736
+ if (typeof rowId === 'undefined') {
3737
+ throw new AppwriteException('Missing required parameter: "rowId"');
3738
+ }
3739
+ if (typeof column === 'undefined') {
3740
+ throw new AppwriteException('Missing required parameter: "column"');
3741
+ }
3742
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3743
+ const payload = {};
3744
+ if (typeof value !== 'undefined') {
3745
+ payload['value'] = value;
3746
+ }
3747
+ if (typeof min !== 'undefined') {
3748
+ payload['min'] = min;
3749
+ }
3750
+ const uri = new URL(this.client.config.endpoint + apiPath);
3751
+ return this.client.call('patch', uri, {
3752
+ 'content-type': 'application/json',
3753
+ }, payload);
3754
+ }
3755
+ incrementRowColumn(paramsOrFirst, ...rest) {
3756
+ let params;
3757
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3758
+ params = (paramsOrFirst || {});
3759
+ }
3760
+ else {
3761
+ params = {
3762
+ databaseId: paramsOrFirst,
3763
+ tableId: rest[0],
3764
+ rowId: rest[1],
3765
+ column: rest[2],
3766
+ value: rest[3],
3767
+ max: rest[4]
3768
+ };
3769
+ }
3770
+ const databaseId = params.databaseId;
3771
+ const tableId = params.tableId;
3772
+ const rowId = params.rowId;
3773
+ const column = params.column;
3774
+ const value = params.value;
3775
+ const max = params.max;
3776
+ if (typeof databaseId === 'undefined') {
3777
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3778
+ }
3779
+ if (typeof tableId === 'undefined') {
3780
+ throw new AppwriteException('Missing required parameter: "tableId"');
3781
+ }
3782
+ if (typeof rowId === 'undefined') {
3783
+ throw new AppwriteException('Missing required parameter: "rowId"');
3784
+ }
3785
+ if (typeof column === 'undefined') {
3786
+ throw new AppwriteException('Missing required parameter: "column"');
3787
+ }
3788
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3789
+ const payload = {};
3790
+ if (typeof value !== 'undefined') {
3791
+ payload['value'] = value;
3792
+ }
3793
+ if (typeof max !== 'undefined') {
3794
+ payload['max'] = max;
3795
+ }
3796
+ const uri = new URL(this.client.config.endpoint + apiPath);
3797
+ return this.client.call('patch', uri, {
3798
+ 'content-type': 'application/json',
3799
+ }, payload);
3800
+ }
3801
+ }
3802
+
3803
+ class Teams extends Service {
3804
+ constructor(client) {
3805
+ super(client);
3806
+ }
3807
+ list(paramsOrFirst, ...rest) {
3808
+ let params;
3809
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3810
+ params = (paramsOrFirst || {});
3811
+ }
3812
+ else {
3813
+ params = {
3814
+ queries: paramsOrFirst,
3815
+ search: rest[0]
3816
+ };
3817
+ }
3818
+ const queries = params.queries;
3819
+ const search = params.search;
3299
3820
  const apiPath = '/teams';
3300
3821
  const payload = {};
3301
3822
  if (typeof queries !== 'undefined') {
@@ -3307,18 +3828,21 @@ class Teams extends Service {
3307
3828
  const uri = new URL(this.client.config.endpoint + apiPath);
3308
3829
  return this.client.call('get', uri, {}, payload);
3309
3830
  }
3310
- /**
3311
- * Create a new team. The user who creates the team will automatically be
3312
- * assigned as the owner of the team. Only the users with the owner role can
3313
- * invite new members, add new owners and delete or update the team.
3314
- *
3315
- * @param {string} teamId
3316
- * @param {string} name
3317
- * @param {string[]} roles
3318
- * @throws {AppwriteException}
3319
- * @returns {Promise}
3320
- */
3321
- create(teamId, name, roles) {
3831
+ create(paramsOrFirst, ...rest) {
3832
+ let params;
3833
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3834
+ params = (paramsOrFirst || {});
3835
+ }
3836
+ else {
3837
+ params = {
3838
+ teamId: paramsOrFirst,
3839
+ name: rest[0],
3840
+ roles: rest[1]
3841
+ };
3842
+ }
3843
+ const teamId = params.teamId;
3844
+ const name = params.name;
3845
+ const roles = params.roles;
3322
3846
  if (typeof teamId === 'undefined') {
3323
3847
  throw new AppwriteException('Missing required parameter: "teamId"');
3324
3848
  }
@@ -3341,14 +3865,17 @@ class Teams extends Service {
3341
3865
  'content-type': 'application/json',
3342
3866
  }, payload);
3343
3867
  }
3344
- /**
3345
- * Get a team by its ID. All team members have read access for this resource.
3346
- *
3347
- * @param {string} teamId
3348
- * @throws {AppwriteException}
3349
- * @returns {Promise}
3350
- */
3351
- get(teamId) {
3868
+ get(paramsOrFirst) {
3869
+ let params;
3870
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3871
+ params = (paramsOrFirst || {});
3872
+ }
3873
+ else {
3874
+ params = {
3875
+ teamId: paramsOrFirst
3876
+ };
3877
+ }
3878
+ const teamId = params.teamId;
3352
3879
  if (typeof teamId === 'undefined') {
3353
3880
  throw new AppwriteException('Missing required parameter: "teamId"');
3354
3881
  }
@@ -3357,15 +3884,19 @@ class Teams extends Service {
3357
3884
  const uri = new URL(this.client.config.endpoint + apiPath);
3358
3885
  return this.client.call('get', uri, {}, payload);
3359
3886
  }
3360
- /**
3361
- * Update the team's name by its unique ID.
3362
- *
3363
- * @param {string} teamId
3364
- * @param {string} name
3365
- * @throws {AppwriteException}
3366
- * @returns {Promise}
3367
- */
3368
- updateName(teamId, name) {
3887
+ updateName(paramsOrFirst, ...rest) {
3888
+ let params;
3889
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3890
+ params = (paramsOrFirst || {});
3891
+ }
3892
+ else {
3893
+ params = {
3894
+ teamId: paramsOrFirst,
3895
+ name: rest[0]
3896
+ };
3897
+ }
3898
+ const teamId = params.teamId;
3899
+ const name = params.name;
3369
3900
  if (typeof teamId === 'undefined') {
3370
3901
  throw new AppwriteException('Missing required parameter: "teamId"');
3371
3902
  }
@@ -3382,15 +3913,17 @@ class Teams extends Service {
3382
3913
  'content-type': 'application/json',
3383
3914
  }, payload);
3384
3915
  }
3385
- /**
3386
- * Delete a team using its ID. Only team members with the owner role can
3387
- * delete the team.
3388
- *
3389
- * @param {string} teamId
3390
- * @throws {AppwriteException}
3391
- * @returns {Promise}
3392
- */
3393
- delete(teamId) {
3916
+ delete(paramsOrFirst) {
3917
+ let params;
3918
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3919
+ params = (paramsOrFirst || {});
3920
+ }
3921
+ else {
3922
+ params = {
3923
+ teamId: paramsOrFirst
3924
+ };
3925
+ }
3926
+ const teamId = params.teamId;
3394
3927
  if (typeof teamId === 'undefined') {
3395
3928
  throw new AppwriteException('Missing required parameter: "teamId"');
3396
3929
  }
@@ -3401,18 +3934,21 @@ class Teams extends Service {
3401
3934
  'content-type': 'application/json',
3402
3935
  }, payload);
3403
3936
  }
3404
- /**
3405
- * Use this endpoint to list a team's members using the team's ID. All team
3406
- * members have read access to this endpoint. Hide sensitive attributes from
3407
- * the response by toggling membership privacy in the Console.
3408
- *
3409
- * @param {string} teamId
3410
- * @param {string[]} queries
3411
- * @param {string} search
3412
- * @throws {AppwriteException}
3413
- * @returns {Promise}
3414
- */
3415
- listMemberships(teamId, queries, search) {
3937
+ listMemberships(paramsOrFirst, ...rest) {
3938
+ let params;
3939
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3940
+ params = (paramsOrFirst || {});
3941
+ }
3942
+ else {
3943
+ params = {
3944
+ teamId: paramsOrFirst,
3945
+ queries: rest[0],
3946
+ search: rest[1]
3947
+ };
3948
+ }
3949
+ const teamId = params.teamId;
3950
+ const queries = params.queries;
3951
+ const search = params.search;
3416
3952
  if (typeof teamId === 'undefined') {
3417
3953
  throw new AppwriteException('Missing required parameter: "teamId"');
3418
3954
  }
@@ -3427,40 +3963,29 @@ class Teams extends Service {
3427
3963
  const uri = new URL(this.client.config.endpoint + apiPath);
3428
3964
  return this.client.call('get', uri, {}, payload);
3429
3965
  }
3430
- /**
3431
- * Invite a new member to join your team. Provide an ID for existing users, or
3432
- * invite unregistered users using an email or phone number. If initiated from
3433
- * a Client SDK, Appwrite will send an email or sms with a link to join the
3434
- * team to the invited user, and an account will be created for them if one
3435
- * doesn't exist. If initiated from a Server SDK, the new member will be added
3436
- * automatically to the team.
3437
- *
3438
- * You only need to provide one of a user ID, email, or phone number. Appwrite
3439
- * will prioritize accepting the user ID > email > phone number if you provide
3440
- * more than one of these parameters.
3441
- *
3442
- * Use the `url` parameter to redirect the user from the invitation email to
3443
- * your app. After the user is redirected, use the [Update Team Membership
3444
- * Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus)
3445
- * endpoint to allow the user to accept the invitation to the team.
3446
- *
3447
- * Please note that to avoid a [Redirect
3448
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
3449
- * Appwrite will accept the only redirect URLs under the domains you have
3450
- * added as a platform on the Appwrite Console.
3451
- *
3452
- *
3453
- * @param {string} teamId
3454
- * @param {string[]} roles
3455
- * @param {string} email
3456
- * @param {string} userId
3457
- * @param {string} phone
3458
- * @param {string} url
3459
- * @param {string} name
3460
- * @throws {AppwriteException}
3461
- * @returns {Promise}
3462
- */
3463
- createMembership(teamId, roles, email, userId, phone, url, name) {
3966
+ createMembership(paramsOrFirst, ...rest) {
3967
+ let params;
3968
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3969
+ params = (paramsOrFirst || {});
3970
+ }
3971
+ else {
3972
+ params = {
3973
+ teamId: paramsOrFirst,
3974
+ roles: rest[0],
3975
+ email: rest[1],
3976
+ userId: rest[2],
3977
+ phone: rest[3],
3978
+ url: rest[4],
3979
+ name: rest[5]
3980
+ };
3981
+ }
3982
+ const teamId = params.teamId;
3983
+ const roles = params.roles;
3984
+ const email = params.email;
3985
+ const userId = params.userId;
3986
+ const phone = params.phone;
3987
+ const url = params.url;
3988
+ const name = params.name;
3464
3989
  if (typeof teamId === 'undefined') {
3465
3990
  throw new AppwriteException('Missing required parameter: "teamId"');
3466
3991
  }
@@ -3492,17 +4017,19 @@ class Teams extends Service {
3492
4017
  'content-type': 'application/json',
3493
4018
  }, payload);
3494
4019
  }
3495
- /**
3496
- * Get a team member by the membership unique id. All team members have read
3497
- * access for this resource. Hide sensitive attributes from the response by
3498
- * toggling membership privacy in the Console.
3499
- *
3500
- * @param {string} teamId
3501
- * @param {string} membershipId
3502
- * @throws {AppwriteException}
3503
- * @returns {Promise}
3504
- */
3505
- getMembership(teamId, membershipId) {
4020
+ getMembership(paramsOrFirst, ...rest) {
4021
+ let params;
4022
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4023
+ params = (paramsOrFirst || {});
4024
+ }
4025
+ else {
4026
+ params = {
4027
+ teamId: paramsOrFirst,
4028
+ membershipId: rest[0]
4029
+ };
4030
+ }
4031
+ const teamId = params.teamId;
4032
+ const membershipId = params.membershipId;
3506
4033
  if (typeof teamId === 'undefined') {
3507
4034
  throw new AppwriteException('Missing required parameter: "teamId"');
3508
4035
  }
@@ -3514,19 +4041,21 @@ class Teams extends Service {
3514
4041
  const uri = new URL(this.client.config.endpoint + apiPath);
3515
4042
  return this.client.call('get', uri, {}, payload);
3516
4043
  }
3517
- /**
3518
- * Modify the roles of a team member. Only team members with the owner role
3519
- * have access to this endpoint. Learn more about [roles and
3520
- * permissions](https://appwrite.io/docs/permissions).
3521
- *
3522
- *
3523
- * @param {string} teamId
3524
- * @param {string} membershipId
3525
- * @param {string[]} roles
3526
- * @throws {AppwriteException}
3527
- * @returns {Promise}
3528
- */
3529
- updateMembership(teamId, membershipId, roles) {
4044
+ updateMembership(paramsOrFirst, ...rest) {
4045
+ let params;
4046
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4047
+ params = (paramsOrFirst || {});
4048
+ }
4049
+ else {
4050
+ params = {
4051
+ teamId: paramsOrFirst,
4052
+ membershipId: rest[0],
4053
+ roles: rest[1]
4054
+ };
4055
+ }
4056
+ const teamId = params.teamId;
4057
+ const membershipId = params.membershipId;
4058
+ const roles = params.roles;
3530
4059
  if (typeof teamId === 'undefined') {
3531
4060
  throw new AppwriteException('Missing required parameter: "teamId"');
3532
4061
  }
@@ -3546,17 +4075,19 @@ class Teams extends Service {
3546
4075
  'content-type': 'application/json',
3547
4076
  }, payload);
3548
4077
  }
3549
- /**
3550
- * This endpoint allows a user to leave a team or for a team owner to delete
3551
- * the membership of any other team member. You can also use this endpoint to
3552
- * delete a user membership even if it is not accepted.
3553
- *
3554
- * @param {string} teamId
3555
- * @param {string} membershipId
3556
- * @throws {AppwriteException}
3557
- * @returns {Promise}
3558
- */
3559
- deleteMembership(teamId, membershipId) {
4078
+ deleteMembership(paramsOrFirst, ...rest) {
4079
+ let params;
4080
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4081
+ params = (paramsOrFirst || {});
4082
+ }
4083
+ else {
4084
+ params = {
4085
+ teamId: paramsOrFirst,
4086
+ membershipId: rest[0]
4087
+ };
4088
+ }
4089
+ const teamId = params.teamId;
4090
+ const membershipId = params.membershipId;
3560
4091
  if (typeof teamId === 'undefined') {
3561
4092
  throw new AppwriteException('Missing required parameter: "teamId"');
3562
4093
  }
@@ -3570,23 +4101,23 @@ class Teams extends Service {
3570
4101
  'content-type': 'application/json',
3571
4102
  }, payload);
3572
4103
  }
3573
- /**
3574
- * Use this endpoint to allow a user to accept an invitation to join a team
3575
- * after being redirected back to your app from the invitation email received
3576
- * by the user.
3577
- *
3578
- * If the request is successful, a session for the user is automatically
3579
- * created.
3580
- *
3581
- *
3582
- * @param {string} teamId
3583
- * @param {string} membershipId
3584
- * @param {string} userId
3585
- * @param {string} secret
3586
- * @throws {AppwriteException}
3587
- * @returns {Promise}
3588
- */
3589
- updateMembershipStatus(teamId, membershipId, userId, secret) {
4104
+ updateMembershipStatus(paramsOrFirst, ...rest) {
4105
+ let params;
4106
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4107
+ params = (paramsOrFirst || {});
4108
+ }
4109
+ else {
4110
+ params = {
4111
+ teamId: paramsOrFirst,
4112
+ membershipId: rest[0],
4113
+ userId: rest[1],
4114
+ secret: rest[2]
4115
+ };
4116
+ }
4117
+ const teamId = params.teamId;
4118
+ const membershipId = params.membershipId;
4119
+ const userId = params.userId;
4120
+ const secret = params.secret;
3590
4121
  if (typeof teamId === 'undefined') {
3591
4122
  throw new AppwriteException('Missing required parameter: "teamId"');
3592
4123
  }
@@ -3612,16 +4143,17 @@ class Teams extends Service {
3612
4143
  'content-type': 'application/json',
3613
4144
  }, payload);
3614
4145
  }
3615
- /**
3616
- * Get the team's shared preferences by its unique ID. If a preference doesn't
3617
- * need to be shared by all team members, prefer storing them in [user
3618
- * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
3619
- *
3620
- * @param {string} teamId
3621
- * @throws {AppwriteException}
3622
- * @returns {Promise}
3623
- */
3624
- getPrefs(teamId) {
4146
+ getPrefs(paramsOrFirst) {
4147
+ let params;
4148
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4149
+ params = (paramsOrFirst || {});
4150
+ }
4151
+ else {
4152
+ params = {
4153
+ teamId: paramsOrFirst
4154
+ };
4155
+ }
4156
+ const teamId = params.teamId;
3625
4157
  if (typeof teamId === 'undefined') {
3626
4158
  throw new AppwriteException('Missing required parameter: "teamId"');
3627
4159
  }
@@ -3630,17 +4162,19 @@ class Teams extends Service {
3630
4162
  const uri = new URL(this.client.config.endpoint + apiPath);
3631
4163
  return this.client.call('get', uri, {}, payload);
3632
4164
  }
3633
- /**
3634
- * Update the team's preferences by its unique ID. The object you pass is
3635
- * stored as is and replaces any previous value. The maximum allowed prefs
3636
- * size is 64kB and throws an error if exceeded.
3637
- *
3638
- * @param {string} teamId
3639
- * @param {object} prefs
3640
- * @throws {AppwriteException}
3641
- * @returns {Promise}
3642
- */
3643
- updatePrefs(teamId, prefs) {
4165
+ updatePrefs(paramsOrFirst, ...rest) {
4166
+ let params;
4167
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4168
+ params = (paramsOrFirst || {});
4169
+ }
4170
+ else {
4171
+ params = {
4172
+ teamId: paramsOrFirst,
4173
+ prefs: rest[0]
4174
+ };
4175
+ }
4176
+ const teamId = params.teamId;
4177
+ const prefs = params.prefs;
3644
4178
  if (typeof teamId === 'undefined') {
3645
4179
  throw new AppwriteException('Missing required parameter: "teamId"');
3646
4180
  }
@@ -3699,9 +4233,206 @@ Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, document
3699
4233
  Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
3700
4234
  Query.limit = (limit) => new Query("limit", undefined, limit).toString();
3701
4235
  Query.offset = (offset) => new Query("offset", undefined, offset).toString();
4236
+ /**
4237
+ * Filter resources where attribute contains the specified value.
4238
+ *
4239
+ * @param {string} attribute
4240
+ * @param {string | string[]} value
4241
+ * @returns {string}
4242
+ */
3702
4243
  Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
4244
+ /**
4245
+ * Filter resources where attribute does not contain the specified value.
4246
+ *
4247
+ * @param {string} attribute
4248
+ * @param {string | string[]} value
4249
+ * @returns {string}
4250
+ */
4251
+ Query.notContains = (attribute, value) => new Query("notContains", attribute, value).toString();
4252
+ /**
4253
+ * Filter resources by searching attribute for value (inverse of search).
4254
+ * A fulltext index on attribute is required for this query to work.
4255
+ *
4256
+ * @param {string} attribute
4257
+ * @param {string} value
4258
+ * @returns {string}
4259
+ */
4260
+ Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value).toString();
4261
+ /**
4262
+ * Filter resources where attribute is not between start and end (exclusive).
4263
+ *
4264
+ * @param {string} attribute
4265
+ * @param {string | number} start
4266
+ * @param {string | number} end
4267
+ * @returns {string}
4268
+ */
4269
+ Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
4270
+ /**
4271
+ * Filter resources where attribute does not start with value.
4272
+ *
4273
+ * @param {string} attribute
4274
+ * @param {string} value
4275
+ * @returns {string}
4276
+ */
4277
+ Query.notStartsWith = (attribute, value) => new Query("notStartsWith", attribute, value).toString();
4278
+ /**
4279
+ * Filter resources where attribute does not end with value.
4280
+ *
4281
+ * @param {string} attribute
4282
+ * @param {string} value
4283
+ * @returns {string}
4284
+ */
4285
+ Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, value).toString();
4286
+ /**
4287
+ * Filter resources where document was created before date.
4288
+ *
4289
+ * @param {string} value
4290
+ * @returns {string}
4291
+ */
4292
+ Query.createdBefore = (value) => new Query("createdBefore", undefined, value).toString();
4293
+ /**
4294
+ * Filter resources where document was created after date.
4295
+ *
4296
+ * @param {string} value
4297
+ * @returns {string}
4298
+ */
4299
+ Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toString();
4300
+ /**
4301
+ * Filter resources where document was created between dates.
4302
+ *
4303
+ * @param {string} start
4304
+ * @param {string} end
4305
+ * @returns {string}
4306
+ */
4307
+ Query.createdBetween = (start, end) => new Query("createdBetween", undefined, [start, end]).toString();
4308
+ /**
4309
+ * Filter resources where document was updated before date.
4310
+ *
4311
+ * @param {string} value
4312
+ * @returns {string}
4313
+ */
4314
+ Query.updatedBefore = (value) => new Query("updatedBefore", undefined, value).toString();
4315
+ /**
4316
+ * Filter resources where document was updated after date.
4317
+ *
4318
+ * @param {string} value
4319
+ * @returns {string}
4320
+ */
4321
+ Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toString();
4322
+ /**
4323
+ * Filter resources where document was updated between dates.
4324
+ *
4325
+ * @param {string} start
4326
+ * @param {string} end
4327
+ * @returns {string}
4328
+ */
4329
+ Query.updatedBetween = (start, end) => new Query("updatedBetween", undefined, [start, end]).toString();
3703
4330
  Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
3704
4331
  Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
4332
+ /**
4333
+ * Filter resources where attribute is at a specific distance from the given coordinates.
4334
+ *
4335
+ * @param {string} attribute
4336
+ * @param {any[]} values
4337
+ * @param {number} distance
4338
+ * @param {boolean} meters
4339
+ * @returns {string}
4340
+ */
4341
+ Query.distanceEqual = (attribute, values, distance, meters = true) => new Query("distanceEqual", attribute, [[values, distance, meters]]).toString();
4342
+ /**
4343
+ * Filter resources where attribute is not at a specific distance from the given coordinates.
4344
+ *
4345
+ * @param {string} attribute
4346
+ * @param {any[]} values
4347
+ * @param {number} distance
4348
+ * @param {boolean} meters
4349
+ * @returns {string}
4350
+ */
4351
+ Query.distanceNotEqual = (attribute, values, distance, meters = true) => new Query("distanceNotEqual", attribute, [[values, distance, meters]]).toString();
4352
+ /**
4353
+ * Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
4354
+ *
4355
+ * @param {string} attribute
4356
+ * @param {any[]} values
4357
+ * @param {number} distance
4358
+ * @param {boolean} meters
4359
+ * @returns {string}
4360
+ */
4361
+ Query.distanceGreaterThan = (attribute, values, distance, meters = true) => new Query("distanceGreaterThan", attribute, [[values, distance, meters]]).toString();
4362
+ /**
4363
+ * Filter resources where attribute is at a distance less than the specified value from the given coordinates.
4364
+ *
4365
+ * @param {string} attribute
4366
+ * @param {any[]} values
4367
+ * @param {number} distance
4368
+ * @param {boolean} meters
4369
+ * @returns {string}
4370
+ */
4371
+ Query.distanceLessThan = (attribute, values, distance, meters = true) => new Query("distanceLessThan", attribute, [[values, distance, meters]]).toString();
4372
+ /**
4373
+ * Filter resources where attribute intersects with the given geometry.
4374
+ *
4375
+ * @param {string} attribute
4376
+ * @param {any[]} values
4377
+ * @returns {string}
4378
+ */
4379
+ Query.intersects = (attribute, values) => new Query("intersects", attribute, [values]).toString();
4380
+ /**
4381
+ * Filter resources where attribute does not intersect with the given geometry.
4382
+ *
4383
+ * @param {string} attribute
4384
+ * @param {any[]} values
4385
+ * @returns {string}
4386
+ */
4387
+ Query.notIntersects = (attribute, values) => new Query("notIntersects", attribute, [values]).toString();
4388
+ /**
4389
+ * Filter resources where attribute crosses the given geometry.
4390
+ *
4391
+ * @param {string} attribute
4392
+ * @param {any[]} values
4393
+ * @returns {string}
4394
+ */
4395
+ Query.crosses = (attribute, values) => new Query("crosses", attribute, [values]).toString();
4396
+ /**
4397
+ * Filter resources where attribute does not cross the given geometry.
4398
+ *
4399
+ * @param {string} attribute
4400
+ * @param {any[]} values
4401
+ * @returns {string}
4402
+ */
4403
+ Query.notCrosses = (attribute, values) => new Query("notCrosses", attribute, [values]).toString();
4404
+ /**
4405
+ * Filter resources where attribute overlaps with the given geometry.
4406
+ *
4407
+ * @param {string} attribute
4408
+ * @param {any[]} values
4409
+ * @returns {string}
4410
+ */
4411
+ Query.overlaps = (attribute, values) => new Query("overlaps", attribute, [values]).toString();
4412
+ /**
4413
+ * Filter resources where attribute does not overlap with the given geometry.
4414
+ *
4415
+ * @param {string} attribute
4416
+ * @param {any[]} values
4417
+ * @returns {string}
4418
+ */
4419
+ Query.notOverlaps = (attribute, values) => new Query("notOverlaps", attribute, [values]).toString();
4420
+ /**
4421
+ * Filter resources where attribute touches the given geometry.
4422
+ *
4423
+ * @param {string} attribute
4424
+ * @param {any[]} values
4425
+ * @returns {string}
4426
+ */
4427
+ Query.touches = (attribute, values) => new Query("touches", attribute, [values]).toString();
4428
+ /**
4429
+ * Filter resources where attribute does not touch the given geometry.
4430
+ *
4431
+ * @param {string} attribute
4432
+ * @param {any[]} values
4433
+ * @returns {string}
4434
+ */
4435
+ Query.notTouches = (attribute, values) => new Query("notTouches", attribute, [values]).toString();
3705
4436
 
3706
4437
  class Permission {
3707
4438
  }
@@ -3929,7 +4660,7 @@ var CreditCard;
3929
4660
  CreditCard["Mastercard"] = "mastercard";
3930
4661
  CreditCard["Naranja"] = "naranja";
3931
4662
  CreditCard["TarjetaShopping"] = "targeta-shopping";
3932
- CreditCard["UnionChinaPay"] = "union-china-pay";
4663
+ CreditCard["UnionPay"] = "unionpay";
3933
4664
  CreditCard["Visa"] = "visa";
3934
4665
  CreditCard["MIR"] = "mir";
3935
4666
  CreditCard["Maestro"] = "maestro";
@@ -4143,6 +4874,7 @@ var ExecutionMethod;
4143
4874
  ExecutionMethod["PATCH"] = "PATCH";
4144
4875
  ExecutionMethod["DELETE"] = "DELETE";
4145
4876
  ExecutionMethod["OPTIONS"] = "OPTIONS";
4877
+ ExecutionMethod["HEAD"] = "HEAD";
4146
4878
  })(ExecutionMethod || (ExecutionMethod = {}));
4147
4879
 
4148
4880
  var ImageGravity;
@@ -4169,5 +4901,5 @@ var ImageFormat;
4169
4901
  ImageFormat["Gif"] = "gif";
4170
4902
  })(ImageFormat || (ImageFormat = {}));
4171
4903
 
4172
- export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Permission, Query, Role, Storage, Teams };
4904
+ export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Permission, Query, Role, Storage, TablesDB, Teams };
4173
4905
  //# sourceMappingURL=sdk.js.map