react-native-appwrite 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1741 -1120
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1741 -1121
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-password-session.md +4 -4
  7. package/docs/examples/account/create-email-token.md +5 -5
  8. package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
  9. package/docs/examples/account/create-mfa-authenticator.md +3 -3
  10. package/docs/examples/account/create-mfa-challenge.md +3 -3
  11. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  12. package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
  13. package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
  14. package/docs/examples/account/create-phone-token.md +4 -4
  15. package/docs/examples/account/create-push-target.md +5 -5
  16. package/docs/examples/account/create-recovery.md +4 -4
  17. package/docs/examples/account/create-session.md +4 -4
  18. package/docs/examples/account/create-verification.md +3 -3
  19. package/docs/examples/account/create.md +6 -6
  20. package/docs/examples/account/delete-identity.md +3 -3
  21. package/docs/examples/account/delete-mfa-authenticator.md +3 -3
  22. package/docs/examples/account/delete-push-target.md +3 -3
  23. package/docs/examples/account/delete-session.md +3 -3
  24. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  25. package/docs/examples/account/get-session.md +3 -3
  26. package/docs/examples/account/list-identities.md +3 -3
  27. package/docs/examples/account/list-logs.md +3 -3
  28. package/docs/examples/account/list-mfa-factors.md +1 -1
  29. package/docs/examples/account/update-email.md +4 -4
  30. package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
  31. package/docs/examples/account/update-mfa-authenticator.md +4 -4
  32. package/docs/examples/account/update-mfa-challenge.md +4 -4
  33. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  34. package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
  35. package/docs/examples/account/update-name.md +3 -3
  36. package/docs/examples/account/update-password.md +4 -4
  37. package/docs/examples/account/update-phone-session.md +4 -4
  38. package/docs/examples/account/update-phone-verification.md +4 -4
  39. package/docs/examples/account/update-phone.md +4 -4
  40. package/docs/examples/account/update-prefs.md +3 -3
  41. package/docs/examples/account/update-push-target.md +4 -4
  42. package/docs/examples/account/update-recovery.md +5 -5
  43. package/docs/examples/account/update-session.md +3 -3
  44. package/docs/examples/account/update-verification.md +4 -4
  45. package/docs/examples/avatars/get-browser.md +6 -6
  46. package/docs/examples/avatars/get-credit-card.md +6 -6
  47. package/docs/examples/avatars/get-favicon.md +3 -3
  48. package/docs/examples/avatars/get-flag.md +6 -6
  49. package/docs/examples/avatars/get-image.md +5 -5
  50. package/docs/examples/avatars/get-initials.md +6 -6
  51. package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
  52. package/docs/examples/databases/create-document.md +7 -7
  53. package/docs/examples/databases/decrement-document-attribute.md +8 -8
  54. package/docs/examples/databases/delete-document.md +5 -5
  55. package/docs/examples/databases/get-document.md +6 -6
  56. package/docs/examples/databases/increment-document-attribute.md +8 -8
  57. package/docs/examples/databases/list-documents.md +5 -5
  58. package/docs/examples/databases/update-document.md +7 -7
  59. package/docs/examples/databases/upsert-document.md +7 -7
  60. package/docs/examples/functions/create-execution.md +9 -9
  61. package/docs/examples/functions/get-execution.md +4 -4
  62. package/docs/examples/functions/list-executions.md +4 -4
  63. package/docs/examples/graphql/mutation.md +3 -3
  64. package/docs/examples/graphql/query.md +3 -3
  65. package/docs/examples/messaging/create-subscriber.md +5 -5
  66. package/docs/examples/messaging/delete-subscriber.md +4 -4
  67. package/docs/examples/storage/create-file.md +6 -6
  68. package/docs/examples/storage/delete-file.md +4 -4
  69. package/docs/examples/storage/get-file-download.md +5 -5
  70. package/docs/examples/storage/get-file-preview.md +16 -16
  71. package/docs/examples/storage/get-file-view.md +5 -5
  72. package/docs/examples/storage/get-file.md +4 -4
  73. package/docs/examples/storage/list-files.md +5 -5
  74. package/docs/examples/storage/update-file.md +6 -6
  75. package/docs/examples/tablesdb/create-row.md +17 -0
  76. package/docs/examples/tablesdb/decrement-row-column.md +18 -0
  77. package/docs/examples/tablesdb/delete-row.md +15 -0
  78. package/docs/examples/tablesdb/get-row.md +16 -0
  79. package/docs/examples/tablesdb/increment-row-column.md +18 -0
  80. package/docs/examples/tablesdb/list-rows.md +15 -0
  81. package/docs/examples/tablesdb/update-row.md +17 -0
  82. package/docs/examples/tablesdb/upsert-row.md +17 -0
  83. package/docs/examples/teams/create-membership.md +9 -9
  84. package/docs/examples/teams/create.md +5 -5
  85. package/docs/examples/teams/delete-membership.md +4 -4
  86. package/docs/examples/teams/delete.md +3 -3
  87. package/docs/examples/teams/get-membership.md +4 -4
  88. package/docs/examples/teams/get-prefs.md +3 -3
  89. package/docs/examples/teams/get.md +3 -3
  90. package/docs/examples/teams/list-memberships.md +5 -5
  91. package/docs/examples/teams/list.md +4 -4
  92. package/docs/examples/teams/update-membership-status.md +6 -6
  93. package/docs/examples/teams/update-membership.md +5 -5
  94. package/docs/examples/teams/update-name.md +4 -4
  95. package/docs/examples/teams/update-prefs.md +4 -4
  96. package/package.json +1 -1
  97. package/src/client.ts +2 -2
  98. package/src/index.ts +1 -0
  99. package/src/models.ts +72 -27
  100. package/src/query.ts +95 -0
  101. package/src/services/account.ts +1469 -315
  102. package/src/services/avatars.ts +289 -80
  103. package/src/services/databases.ts +354 -63
  104. package/src/services/functions.ts +115 -20
  105. package/src/services/graphql.ts +52 -4
  106. package/src/services/locale.ts +8 -19
  107. package/src/services/messaging.ts +66 -7
  108. package/src/services/storage.ts +345 -76
  109. package/src/services/tables-db.ts +621 -0
  110. package/src/services/teams.ts +454 -93
  111. package/types/index.d.ts +1 -0
  112. package/types/models.d.ts +69 -25
  113. package/types/query.d.ts +77 -0
  114. package/types/services/account.d.ts +734 -280
  115. package/types/services/avatars.d.ts +168 -73
  116. package/types/services/databases.d.ts +199 -58
  117. package/types/services/functions.d.ts +62 -17
  118. package/types/services/graphql.d.ts +24 -2
  119. package/types/services/locale.d.ts +8 -19
  120. package/types/services/messaging.d.ts +33 -5
  121. package/types/services/storage.d.ts +201 -68
  122. package/types/services/tables-db.d.ts +245 -0
  123. package/types/services/teams.d.ts +242 -80
  124. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  125. /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
package/dist/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.12.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
  }
@@ -2277,6 +2400,9 @@ class Databases extends Service {
2277
2400
  if (typeof data === 'undefined') {
2278
2401
  throw new AppwriteException('Missing required parameter: "data"');
2279
2402
  }
2403
+ data === null || data === void 0 ? true : delete data.$sequence;
2404
+ data === null || data === void 0 ? true : delete data.$collectionId;
2405
+ data === null || data === void 0 ? true : delete data.$databaseId;
2280
2406
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2281
2407
  const payload = {};
2282
2408
  if (typeof documentId !== 'undefined') {
@@ -2293,18 +2419,23 @@ class Databases extends Service {
2293
2419
  'content-type': 'application/json',
2294
2420
  }, payload);
2295
2421
  }
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) {
2422
+ getDocument(paramsOrFirst, ...rest) {
2423
+ let params;
2424
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2425
+ params = (paramsOrFirst || {});
2426
+ }
2427
+ else {
2428
+ params = {
2429
+ databaseId: paramsOrFirst,
2430
+ collectionId: rest[0],
2431
+ documentId: rest[1],
2432
+ queries: rest[2]
2433
+ };
2434
+ }
2435
+ const databaseId = params.databaseId;
2436
+ const collectionId = params.collectionId;
2437
+ const documentId = params.documentId;
2438
+ const queries = params.queries;
2308
2439
  if (typeof databaseId === 'undefined') {
2309
2440
  throw new AppwriteException('Missing required parameter: "databaseId"');
2310
2441
  }
@@ -2322,25 +2453,25 @@ class Databases extends Service {
2322
2453
  const uri = new URL(this.client.config.endpoint + apiPath);
2323
2454
  return this.client.call('get', uri, {}, payload);
2324
2455
  }
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) {
2456
+ upsertDocument(paramsOrFirst, ...rest) {
2457
+ let params;
2458
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2459
+ params = (paramsOrFirst || {});
2460
+ }
2461
+ else {
2462
+ params = {
2463
+ databaseId: paramsOrFirst,
2464
+ collectionId: rest[0],
2465
+ documentId: rest[1],
2466
+ data: rest[2],
2467
+ permissions: rest[3]
2468
+ };
2469
+ }
2470
+ const databaseId = params.databaseId;
2471
+ const collectionId = params.collectionId;
2472
+ const documentId = params.documentId;
2473
+ const data = params.data;
2474
+ const permissions = params.permissions;
2344
2475
  if (typeof databaseId === 'undefined') {
2345
2476
  throw new AppwriteException('Missing required parameter: "databaseId"');
2346
2477
  }
@@ -2353,6 +2484,9 @@ class Databases extends Service {
2353
2484
  if (typeof data === 'undefined') {
2354
2485
  throw new AppwriteException('Missing required parameter: "data"');
2355
2486
  }
2487
+ data === null || data === void 0 ? true : delete data.$sequence;
2488
+ data === null || data === void 0 ? true : delete data.$collectionId;
2489
+ data === null || data === void 0 ? true : delete data.$databaseId;
2356
2490
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2357
2491
  const payload = {};
2358
2492
  if (typeof data !== 'undefined') {
@@ -2366,19 +2500,25 @@ class Databases extends Service {
2366
2500
  'content-type': 'application/json',
2367
2501
  }, payload);
2368
2502
  }
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) {
2503
+ updateDocument(paramsOrFirst, ...rest) {
2504
+ let params;
2505
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2506
+ params = (paramsOrFirst || {});
2507
+ }
2508
+ else {
2509
+ params = {
2510
+ databaseId: paramsOrFirst,
2511
+ collectionId: rest[0],
2512
+ documentId: rest[1],
2513
+ data: rest[2],
2514
+ permissions: rest[3]
2515
+ };
2516
+ }
2517
+ const databaseId = params.databaseId;
2518
+ const collectionId = params.collectionId;
2519
+ const documentId = params.documentId;
2520
+ const data = params.data;
2521
+ const permissions = params.permissions;
2382
2522
  if (typeof databaseId === 'undefined') {
2383
2523
  throw new AppwriteException('Missing required parameter: "databaseId"');
2384
2524
  }
@@ -2388,6 +2528,9 @@ class Databases extends Service {
2388
2528
  if (typeof documentId === 'undefined') {
2389
2529
  throw new AppwriteException('Missing required parameter: "documentId"');
2390
2530
  }
2531
+ data === null || data === void 0 ? true : delete data.$sequence;
2532
+ data === null || data === void 0 ? true : delete data.$collectionId;
2533
+ data === null || data === void 0 ? true : delete data.$databaseId;
2391
2534
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2392
2535
  const payload = {};
2393
2536
  if (typeof data !== 'undefined') {
@@ -2401,16 +2544,21 @@ class Databases extends Service {
2401
2544
  'content-type': 'application/json',
2402
2545
  }, payload);
2403
2546
  }
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) {
2547
+ deleteDocument(paramsOrFirst, ...rest) {
2548
+ let params;
2549
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2550
+ params = (paramsOrFirst || {});
2551
+ }
2552
+ else {
2553
+ params = {
2554
+ databaseId: paramsOrFirst,
2555
+ collectionId: rest[0],
2556
+ documentId: rest[1]
2557
+ };
2558
+ }
2559
+ const databaseId = params.databaseId;
2560
+ const collectionId = params.collectionId;
2561
+ const documentId = params.documentId;
2414
2562
  if (typeof databaseId === 'undefined') {
2415
2563
  throw new AppwriteException('Missing required parameter: "databaseId"');
2416
2564
  }
@@ -2427,19 +2575,27 @@ class Databases extends Service {
2427
2575
  'content-type': 'application/json',
2428
2576
  }, payload);
2429
2577
  }
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) {
2578
+ decrementDocumentAttribute(paramsOrFirst, ...rest) {
2579
+ let params;
2580
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2581
+ params = (paramsOrFirst || {});
2582
+ }
2583
+ else {
2584
+ params = {
2585
+ databaseId: paramsOrFirst,
2586
+ collectionId: rest[0],
2587
+ documentId: rest[1],
2588
+ attribute: rest[2],
2589
+ value: rest[3],
2590
+ min: rest[4]
2591
+ };
2592
+ }
2593
+ const databaseId = params.databaseId;
2594
+ const collectionId = params.collectionId;
2595
+ const documentId = params.documentId;
2596
+ const attribute = params.attribute;
2597
+ const value = params.value;
2598
+ const min = params.min;
2443
2599
  if (typeof databaseId === 'undefined') {
2444
2600
  throw new AppwriteException('Missing required parameter: "databaseId"');
2445
2601
  }
@@ -2465,19 +2621,27 @@ class Databases extends Service {
2465
2621
  'content-type': 'application/json',
2466
2622
  }, payload);
2467
2623
  }
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) {
2624
+ incrementDocumentAttribute(paramsOrFirst, ...rest) {
2625
+ let params;
2626
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2627
+ params = (paramsOrFirst || {});
2628
+ }
2629
+ else {
2630
+ params = {
2631
+ databaseId: paramsOrFirst,
2632
+ collectionId: rest[0],
2633
+ documentId: rest[1],
2634
+ attribute: rest[2],
2635
+ value: rest[3],
2636
+ max: rest[4]
2637
+ };
2638
+ }
2639
+ const databaseId = params.databaseId;
2640
+ const collectionId = params.collectionId;
2641
+ const documentId = params.documentId;
2642
+ const attribute = params.attribute;
2643
+ const value = params.value;
2644
+ const max = params.max;
2481
2645
  if (typeof databaseId === 'undefined') {
2482
2646
  throw new AppwriteException('Missing required parameter: "databaseId"');
2483
2647
  }
@@ -2509,16 +2673,19 @@ class Functions extends Service {
2509
2673
  constructor(client) {
2510
2674
  super(client);
2511
2675
  }
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) {
2676
+ listExecutions(paramsOrFirst, ...rest) {
2677
+ let params;
2678
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2679
+ params = (paramsOrFirst || {});
2680
+ }
2681
+ else {
2682
+ params = {
2683
+ functionId: paramsOrFirst,
2684
+ queries: rest[0]
2685
+ };
2686
+ }
2687
+ const functionId = params.functionId;
2688
+ const queries = params.queries;
2522
2689
  if (typeof functionId === 'undefined') {
2523
2690
  throw new AppwriteException('Missing required parameter: "functionId"');
2524
2691
  }
@@ -2530,23 +2697,29 @@ class Functions extends Service {
2530
2697
  const uri = new URL(this.client.config.endpoint + apiPath);
2531
2698
  return this.client.call('get', uri, {}, payload);
2532
2699
  }
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) {
2700
+ createExecution(paramsOrFirst, ...rest) {
2701
+ let params;
2702
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2703
+ params = (paramsOrFirst || {});
2704
+ }
2705
+ else {
2706
+ params = {
2707
+ functionId: paramsOrFirst,
2708
+ body: rest[0],
2709
+ async: rest[1],
2710
+ xpath: rest[2],
2711
+ method: rest[3],
2712
+ headers: rest[4],
2713
+ scheduledAt: rest[5]
2714
+ };
2715
+ }
2716
+ const functionId = params.functionId;
2717
+ const body = params.body;
2718
+ const async = params.async;
2719
+ const xpath = params.xpath;
2720
+ const method = params.method;
2721
+ const headers = params.headers;
2722
+ const scheduledAt = params.scheduledAt;
2550
2723
  if (typeof functionId === 'undefined') {
2551
2724
  throw new AppwriteException('Missing required parameter: "functionId"');
2552
2725
  }
@@ -2575,15 +2748,19 @@ class Functions extends Service {
2575
2748
  'content-type': 'application/json',
2576
2749
  }, payload);
2577
2750
  }
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) {
2751
+ getExecution(paramsOrFirst, ...rest) {
2752
+ let params;
2753
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2754
+ params = (paramsOrFirst || {});
2755
+ }
2756
+ else {
2757
+ params = {
2758
+ functionId: paramsOrFirst,
2759
+ executionId: rest[0]
2760
+ };
2761
+ }
2762
+ const functionId = params.functionId;
2763
+ const executionId = params.executionId;
2587
2764
  if (typeof functionId === 'undefined') {
2588
2765
  throw new AppwriteException('Missing required parameter: "functionId"');
2589
2766
  }
@@ -2601,14 +2778,17 @@ class Graphql extends Service {
2601
2778
  constructor(client) {
2602
2779
  super(client);
2603
2780
  }
2604
- /**
2605
- * Execute a GraphQL mutation.
2606
- *
2607
- * @param {object} query
2608
- * @throws {AppwriteException}
2609
- * @returns {Promise}
2610
- */
2611
- query(query) {
2781
+ query(paramsOrFirst) {
2782
+ let params;
2783
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2784
+ params = (paramsOrFirst || {});
2785
+ }
2786
+ else {
2787
+ params = {
2788
+ query: paramsOrFirst
2789
+ };
2790
+ }
2791
+ const query = params.query;
2612
2792
  if (typeof query === 'undefined') {
2613
2793
  throw new AppwriteException('Missing required parameter: "query"');
2614
2794
  }
@@ -2623,14 +2803,17 @@ class Graphql extends Service {
2623
2803
  'content-type': 'application/json',
2624
2804
  }, payload);
2625
2805
  }
2626
- /**
2627
- * Execute a GraphQL mutation.
2628
- *
2629
- * @param {object} query
2630
- * @throws {AppwriteException}
2631
- * @returns {Promise}
2632
- */
2633
- mutation(query) {
2806
+ mutation(paramsOrFirst) {
2807
+ let params;
2808
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
2809
+ params = (paramsOrFirst || {});
2810
+ }
2811
+ else {
2812
+ params = {
2813
+ query: paramsOrFirst
2814
+ };
2815
+ }
2816
+ const query = params.query;
2634
2817
  if (typeof query === 'undefined') {
2635
2818
  throw new AppwriteException('Missing required parameter: "query"');
2636
2819
  }
@@ -2652,10 +2835,7 @@ class Locale extends Service {
2652
2835
  super(client);
2653
2836
  }
2654
2837
  /**
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.
2838
+ * 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
2839
  *
2660
2840
  * ([IP Geolocation by DB-IP](https://db-ip.com))
2661
2841
  *
@@ -2669,8 +2849,7 @@ class Locale extends Service {
2669
2849
  return this.client.call('get', uri, {}, payload);
2670
2850
  }
2671
2851
  /**
2672
- * List of all locale codes in [ISO
2673
- * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2852
+ * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2674
2853
  *
2675
2854
  * @throws {AppwriteException}
2676
2855
  * @returns {Promise}
@@ -2682,8 +2861,7 @@ class Locale extends Service {
2682
2861
  return this.client.call('get', uri, {}, payload);
2683
2862
  }
2684
2863
  /**
2685
- * List of all continents. You can use the locale header to get the data in a
2686
- * supported language.
2864
+ * List of all continents. You can use the locale header to get the data in a supported language.
2687
2865
  *
2688
2866
  * @throws {AppwriteException}
2689
2867
  * @returns {Promise}
@@ -2695,8 +2873,7 @@ class Locale extends Service {
2695
2873
  return this.client.call('get', uri, {}, payload);
2696
2874
  }
2697
2875
  /**
2698
- * List of all countries. You can use the locale header to get the data in a
2699
- * supported language.
2876
+ * List of all countries. You can use the locale header to get the data in a supported language.
2700
2877
  *
2701
2878
  * @throws {AppwriteException}
2702
2879
  * @returns {Promise}
@@ -2708,8 +2885,7 @@ class Locale extends Service {
2708
2885
  return this.client.call('get', uri, {}, payload);
2709
2886
  }
2710
2887
  /**
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.
2888
+ * 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
2889
  *
2714
2890
  * @throws {AppwriteException}
2715
2891
  * @returns {Promise}
@@ -2721,8 +2897,7 @@ class Locale extends Service {
2721
2897
  return this.client.call('get', uri, {}, payload);
2722
2898
  }
2723
2899
  /**
2724
- * List of all countries phone codes. You can use the locale header to get the
2725
- * data in a supported language.
2900
+ * List of all countries phone codes. You can use the locale header to get the data in a supported language.
2726
2901
  *
2727
2902
  * @throws {AppwriteException}
2728
2903
  * @returns {Promise}
@@ -2734,9 +2909,7 @@ class Locale extends Service {
2734
2909
  return this.client.call('get', uri, {}, payload);
2735
2910
  }
2736
2911
  /**
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.
2912
+ * 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
2913
  *
2741
2914
  * @throws {AppwriteException}
2742
2915
  * @returns {Promise}
@@ -2748,8 +2921,7 @@ class Locale extends Service {
2748
2921
  return this.client.call('get', uri, {}, payload);
2749
2922
  }
2750
2923
  /**
2751
- * List of all languages classified by ISO 639-1 including 2-letter code, name
2752
- * in English, and name in the respective language.
2924
+ * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
2753
2925
  *
2754
2926
  * @throws {AppwriteException}
2755
2927
  * @returns {Promise}
@@ -2766,16 +2938,21 @@ class Messaging extends Service {
2766
2938
  constructor(client) {
2767
2939
  super(client);
2768
2940
  }
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) {
2941
+ createSubscriber(paramsOrFirst, ...rest) {
2942
+ let params;
2943
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2944
+ params = (paramsOrFirst || {});
2945
+ }
2946
+ else {
2947
+ params = {
2948
+ topicId: paramsOrFirst,
2949
+ subscriberId: rest[0],
2950
+ targetId: rest[1]
2951
+ };
2952
+ }
2953
+ const topicId = params.topicId;
2954
+ const subscriberId = params.subscriberId;
2955
+ const targetId = params.targetId;
2779
2956
  if (typeof topicId === 'undefined') {
2780
2957
  throw new AppwriteException('Missing required parameter: "topicId"');
2781
2958
  }
@@ -2798,15 +2975,19 @@ class Messaging extends Service {
2798
2975
  'content-type': 'application/json',
2799
2976
  }, payload);
2800
2977
  }
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) {
2978
+ deleteSubscriber(paramsOrFirst, ...rest) {
2979
+ let params;
2980
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2981
+ params = (paramsOrFirst || {});
2982
+ }
2983
+ else {
2984
+ params = {
2985
+ topicId: paramsOrFirst,
2986
+ subscriberId: rest[0]
2987
+ };
2988
+ }
2989
+ const topicId = params.topicId;
2990
+ const subscriberId = params.subscriberId;
2810
2991
  if (typeof topicId === 'undefined') {
2811
2992
  throw new AppwriteException('Missing required parameter: "topicId"');
2812
2993
  }
@@ -2826,17 +3007,21 @@ class Storage extends Service {
2826
3007
  constructor(client) {
2827
3008
  super(client);
2828
3009
  }
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) {
3010
+ listFiles(paramsOrFirst, ...rest) {
3011
+ let params;
3012
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3013
+ params = (paramsOrFirst || {});
3014
+ }
3015
+ else {
3016
+ params = {
3017
+ bucketId: paramsOrFirst,
3018
+ queries: rest[0],
3019
+ search: rest[1]
3020
+ };
3021
+ }
3022
+ const bucketId = params.bucketId;
3023
+ const queries = params.queries;
3024
+ const search = params.search;
2840
3025
  if (typeof bucketId === 'undefined') {
2841
3026
  throw new AppwriteException('Missing required parameter: "bucketId"');
2842
3027
  }
@@ -2851,35 +3036,27 @@ class Storage extends Service {
2851
3036
  const uri = new URL(this.client.config.endpoint + apiPath);
2852
3037
  return this.client.call('get', uri, {}, payload);
2853
3038
  }
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) => { }) {
3039
+ createFile(paramsOrFirst, ...rest) {
3040
+ return __awaiter(this, void 0, void 0, function* () {
3041
+ let params;
3042
+ let onProgress;
3043
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3044
+ params = (paramsOrFirst || {});
3045
+ onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
3046
+ }
3047
+ else {
3048
+ params = {
3049
+ bucketId: paramsOrFirst,
3050
+ fileId: rest[0],
3051
+ file: rest[1],
3052
+ permissions: rest[2]
3053
+ };
3054
+ onProgress = rest[3];
3055
+ }
3056
+ const bucketId = params.bucketId;
3057
+ const fileId = params.fileId;
3058
+ const file = params.file;
3059
+ const permissions = params.permissions;
2883
3060
  if (typeof bucketId === 'undefined') {
2884
3061
  throw new AppwriteException('Missing required parameter: "bucketId"');
2885
3062
  }
@@ -2951,16 +3128,19 @@ class Storage extends Service {
2951
3128
  return response;
2952
3129
  });
2953
3130
  }
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) {
3131
+ getFile(paramsOrFirst, ...rest) {
3132
+ let params;
3133
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3134
+ params = (paramsOrFirst || {});
3135
+ }
3136
+ else {
3137
+ params = {
3138
+ bucketId: paramsOrFirst,
3139
+ fileId: rest[0]
3140
+ };
3141
+ }
3142
+ const bucketId = params.bucketId;
3143
+ const fileId = params.fileId;
2964
3144
  if (typeof bucketId === 'undefined') {
2965
3145
  throw new AppwriteException('Missing required parameter: "bucketId"');
2966
3146
  }
@@ -2972,18 +3152,23 @@ class Storage extends Service {
2972
3152
  const uri = new URL(this.client.config.endpoint + apiPath);
2973
3153
  return this.client.call('get', uri, {}, payload);
2974
3154
  }
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) {
3155
+ updateFile(paramsOrFirst, ...rest) {
3156
+ let params;
3157
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3158
+ params = (paramsOrFirst || {});
3159
+ }
3160
+ else {
3161
+ params = {
3162
+ bucketId: paramsOrFirst,
3163
+ fileId: rest[0],
3164
+ name: rest[1],
3165
+ permissions: rest[2]
3166
+ };
3167
+ }
3168
+ const bucketId = params.bucketId;
3169
+ const fileId = params.fileId;
3170
+ const name = params.name;
3171
+ const permissions = params.permissions;
2987
3172
  if (typeof bucketId === 'undefined') {
2988
3173
  throw new AppwriteException('Missing required parameter: "bucketId"');
2989
3174
  }
@@ -3003,16 +3188,19 @@ class Storage extends Service {
3003
3188
  'content-type': 'application/json',
3004
3189
  }, payload);
3005
3190
  }
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) {
3191
+ deleteFile(paramsOrFirst, ...rest) {
3192
+ let params;
3193
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3194
+ params = (paramsOrFirst || {});
3195
+ }
3196
+ else {
3197
+ params = {
3198
+ bucketId: paramsOrFirst,
3199
+ fileId: rest[0]
3200
+ };
3201
+ }
3202
+ const bucketId = params.bucketId;
3203
+ const fileId = params.fileId;
3016
3204
  if (typeof bucketId === 'undefined') {
3017
3205
  throw new AppwriteException('Missing required parameter: "bucketId"');
3018
3206
  }
@@ -3026,18 +3214,21 @@ class Storage extends Service {
3026
3214
  'content-type': 'application/json',
3027
3215
  }, payload);
3028
3216
  }
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) {
3217
+ getFileDownload(paramsOrFirst, ...rest) {
3218
+ let params;
3219
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3220
+ params = (paramsOrFirst || {});
3221
+ }
3222
+ else {
3223
+ params = {
3224
+ bucketId: paramsOrFirst,
3225
+ fileId: rest[0],
3226
+ token: rest[1]
3227
+ };
3228
+ }
3229
+ const bucketId = params.bucketId;
3230
+ const fileId = params.fileId;
3231
+ const token = params.token;
3041
3232
  if (typeof bucketId === 'undefined') {
3042
3233
  throw new AppwriteException('Missing required parameter: "bucketId"');
3043
3234
  }
@@ -3056,31 +3247,43 @@ class Storage extends Service {
3056
3247
  }
3057
3248
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3058
3249
  }
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) {
3250
+ getFilePreview(paramsOrFirst, ...rest) {
3251
+ let params;
3252
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3253
+ params = (paramsOrFirst || {});
3254
+ }
3255
+ else {
3256
+ params = {
3257
+ bucketId: paramsOrFirst,
3258
+ fileId: rest[0],
3259
+ width: rest[1],
3260
+ height: rest[2],
3261
+ gravity: rest[3],
3262
+ quality: rest[4],
3263
+ borderWidth: rest[5],
3264
+ borderColor: rest[6],
3265
+ borderRadius: rest[7],
3266
+ opacity: rest[8],
3267
+ rotation: rest[9],
3268
+ background: rest[10],
3269
+ output: rest[11],
3270
+ token: rest[12]
3271
+ };
3272
+ }
3273
+ const bucketId = params.bucketId;
3274
+ const fileId = params.fileId;
3275
+ const width = params.width;
3276
+ const height = params.height;
3277
+ const gravity = params.gravity;
3278
+ const quality = params.quality;
3279
+ const borderWidth = params.borderWidth;
3280
+ const borderColor = params.borderColor;
3281
+ const borderRadius = params.borderRadius;
3282
+ const opacity = params.opacity;
3283
+ const rotation = params.rotation;
3284
+ const background = params.background;
3285
+ const output = params.output;
3286
+ const token = params.token;
3084
3287
  if (typeof bucketId === 'undefined') {
3085
3288
  throw new AppwriteException('Missing required parameter: "bucketId"');
3086
3289
  }
@@ -3132,18 +3335,21 @@ class Storage extends Service {
3132
3335
  }
3133
3336
  return this.client.call('get', uri, {}, payload, 'arrayBuffer');
3134
3337
  }
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) {
3338
+ getFileView(paramsOrFirst, ...rest) {
3339
+ let params;
3340
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3341
+ params = (paramsOrFirst || {});
3342
+ }
3343
+ else {
3344
+ params = {
3345
+ bucketId: paramsOrFirst,
3346
+ fileId: rest[0],
3347
+ token: rest[1]
3348
+ };
3349
+ }
3350
+ const bucketId = params.bucketId;
3351
+ const fileId = params.fileId;
3352
+ const token = params.token;
3147
3353
  if (typeof bucketId === 'undefined') {
3148
3354
  throw new AppwriteException('Missing required parameter: "bucketId"');
3149
3355
  }
@@ -3282,20 +3488,344 @@ class Storage extends Service {
3282
3488
  }
3283
3489
  }
3284
3490
 
3285
- class Teams extends Service {
3491
+ class TablesDB extends Service {
3286
3492
  constructor(client) {
3287
3493
  super(client);
3288
3494
  }
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) {
3495
+ listRows(paramsOrFirst, ...rest) {
3496
+ let params;
3497
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3498
+ params = (paramsOrFirst || {});
3499
+ }
3500
+ else {
3501
+ params = {
3502
+ databaseId: paramsOrFirst,
3503
+ tableId: rest[0],
3504
+ queries: rest[1]
3505
+ };
3506
+ }
3507
+ const databaseId = params.databaseId;
3508
+ const tableId = params.tableId;
3509
+ const queries = params.queries;
3510
+ if (typeof databaseId === 'undefined') {
3511
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3512
+ }
3513
+ if (typeof tableId === 'undefined') {
3514
+ throw new AppwriteException('Missing required parameter: "tableId"');
3515
+ }
3516
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3517
+ const payload = {};
3518
+ if (typeof queries !== 'undefined') {
3519
+ payload['queries'] = queries;
3520
+ }
3521
+ const uri = new URL(this.client.config.endpoint + apiPath);
3522
+ return this.client.call('get', uri, {}, payload);
3523
+ }
3524
+ createRow(paramsOrFirst, ...rest) {
3525
+ let params;
3526
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3527
+ params = (paramsOrFirst || {});
3528
+ }
3529
+ else {
3530
+ params = {
3531
+ databaseId: paramsOrFirst,
3532
+ tableId: rest[0],
3533
+ rowId: rest[1],
3534
+ data: rest[2],
3535
+ permissions: rest[3]
3536
+ };
3537
+ }
3538
+ const databaseId = params.databaseId;
3539
+ const tableId = params.tableId;
3540
+ const rowId = params.rowId;
3541
+ const data = params.data;
3542
+ const permissions = params.permissions;
3543
+ if (typeof databaseId === 'undefined') {
3544
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3545
+ }
3546
+ if (typeof tableId === 'undefined') {
3547
+ throw new AppwriteException('Missing required parameter: "tableId"');
3548
+ }
3549
+ if (typeof rowId === 'undefined') {
3550
+ throw new AppwriteException('Missing required parameter: "rowId"');
3551
+ }
3552
+ if (typeof data === 'undefined') {
3553
+ throw new AppwriteException('Missing required parameter: "data"');
3554
+ }
3555
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
3556
+ const payload = {};
3557
+ if (typeof rowId !== 'undefined') {
3558
+ payload['rowId'] = rowId;
3559
+ }
3560
+ if (typeof data !== 'undefined') {
3561
+ payload['data'] = data;
3562
+ }
3563
+ if (typeof permissions !== 'undefined') {
3564
+ payload['permissions'] = permissions;
3565
+ }
3566
+ const uri = new URL(this.client.config.endpoint + apiPath);
3567
+ return this.client.call('post', uri, {
3568
+ 'content-type': 'application/json',
3569
+ }, payload);
3570
+ }
3571
+ getRow(paramsOrFirst, ...rest) {
3572
+ let params;
3573
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3574
+ params = (paramsOrFirst || {});
3575
+ }
3576
+ else {
3577
+ params = {
3578
+ databaseId: paramsOrFirst,
3579
+ tableId: rest[0],
3580
+ rowId: rest[1],
3581
+ queries: rest[2]
3582
+ };
3583
+ }
3584
+ const databaseId = params.databaseId;
3585
+ const tableId = params.tableId;
3586
+ const rowId = params.rowId;
3587
+ const queries = params.queries;
3588
+ if (typeof databaseId === 'undefined') {
3589
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3590
+ }
3591
+ if (typeof tableId === 'undefined') {
3592
+ throw new AppwriteException('Missing required parameter: "tableId"');
3593
+ }
3594
+ if (typeof rowId === 'undefined') {
3595
+ throw new AppwriteException('Missing required parameter: "rowId"');
3596
+ }
3597
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3598
+ const payload = {};
3599
+ if (typeof queries !== 'undefined') {
3600
+ payload['queries'] = queries;
3601
+ }
3602
+ const uri = new URL(this.client.config.endpoint + apiPath);
3603
+ return this.client.call('get', uri, {}, payload);
3604
+ }
3605
+ upsertRow(paramsOrFirst, ...rest) {
3606
+ let params;
3607
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3608
+ params = (paramsOrFirst || {});
3609
+ }
3610
+ else {
3611
+ params = {
3612
+ databaseId: paramsOrFirst,
3613
+ tableId: rest[0],
3614
+ rowId: rest[1],
3615
+ data: rest[2],
3616
+ permissions: rest[3]
3617
+ };
3618
+ }
3619
+ const databaseId = params.databaseId;
3620
+ const tableId = params.tableId;
3621
+ const rowId = params.rowId;
3622
+ const data = params.data;
3623
+ const permissions = params.permissions;
3624
+ if (typeof databaseId === 'undefined') {
3625
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3626
+ }
3627
+ if (typeof tableId === 'undefined') {
3628
+ throw new AppwriteException('Missing required parameter: "tableId"');
3629
+ }
3630
+ if (typeof rowId === 'undefined') {
3631
+ throw new AppwriteException('Missing required parameter: "rowId"');
3632
+ }
3633
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3634
+ const payload = {};
3635
+ if (typeof data !== 'undefined') {
3636
+ payload['data'] = data;
3637
+ }
3638
+ if (typeof permissions !== 'undefined') {
3639
+ payload['permissions'] = permissions;
3640
+ }
3641
+ const uri = new URL(this.client.config.endpoint + apiPath);
3642
+ return this.client.call('put', uri, {
3643
+ 'content-type': 'application/json',
3644
+ }, payload);
3645
+ }
3646
+ updateRow(paramsOrFirst, ...rest) {
3647
+ let params;
3648
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3649
+ params = (paramsOrFirst || {});
3650
+ }
3651
+ else {
3652
+ params = {
3653
+ databaseId: paramsOrFirst,
3654
+ tableId: rest[0],
3655
+ rowId: rest[1],
3656
+ data: rest[2],
3657
+ permissions: rest[3]
3658
+ };
3659
+ }
3660
+ const databaseId = params.databaseId;
3661
+ const tableId = params.tableId;
3662
+ const rowId = params.rowId;
3663
+ const data = params.data;
3664
+ const permissions = params.permissions;
3665
+ if (typeof databaseId === 'undefined') {
3666
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3667
+ }
3668
+ if (typeof tableId === 'undefined') {
3669
+ throw new AppwriteException('Missing required parameter: "tableId"');
3670
+ }
3671
+ if (typeof rowId === 'undefined') {
3672
+ throw new AppwriteException('Missing required parameter: "rowId"');
3673
+ }
3674
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3675
+ const payload = {};
3676
+ if (typeof data !== 'undefined') {
3677
+ payload['data'] = data;
3678
+ }
3679
+ if (typeof permissions !== 'undefined') {
3680
+ payload['permissions'] = permissions;
3681
+ }
3682
+ const uri = new URL(this.client.config.endpoint + apiPath);
3683
+ return this.client.call('patch', uri, {
3684
+ 'content-type': 'application/json',
3685
+ }, payload);
3686
+ }
3687
+ deleteRow(paramsOrFirst, ...rest) {
3688
+ let params;
3689
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3690
+ params = (paramsOrFirst || {});
3691
+ }
3692
+ else {
3693
+ params = {
3694
+ databaseId: paramsOrFirst,
3695
+ tableId: rest[0],
3696
+ rowId: rest[1]
3697
+ };
3698
+ }
3699
+ const databaseId = params.databaseId;
3700
+ const tableId = params.tableId;
3701
+ const rowId = params.rowId;
3702
+ if (typeof databaseId === 'undefined') {
3703
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3704
+ }
3705
+ if (typeof tableId === 'undefined') {
3706
+ throw new AppwriteException('Missing required parameter: "tableId"');
3707
+ }
3708
+ if (typeof rowId === 'undefined') {
3709
+ throw new AppwriteException('Missing required parameter: "rowId"');
3710
+ }
3711
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3712
+ const payload = {};
3713
+ const uri = new URL(this.client.config.endpoint + apiPath);
3714
+ return this.client.call('delete', uri, {
3715
+ 'content-type': 'application/json',
3716
+ }, payload);
3717
+ }
3718
+ decrementRowColumn(paramsOrFirst, ...rest) {
3719
+ let params;
3720
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3721
+ params = (paramsOrFirst || {});
3722
+ }
3723
+ else {
3724
+ params = {
3725
+ databaseId: paramsOrFirst,
3726
+ tableId: rest[0],
3727
+ rowId: rest[1],
3728
+ column: rest[2],
3729
+ value: rest[3],
3730
+ min: rest[4]
3731
+ };
3732
+ }
3733
+ const databaseId = params.databaseId;
3734
+ const tableId = params.tableId;
3735
+ const rowId = params.rowId;
3736
+ const column = params.column;
3737
+ const value = params.value;
3738
+ const min = params.min;
3739
+ if (typeof databaseId === 'undefined') {
3740
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3741
+ }
3742
+ if (typeof tableId === 'undefined') {
3743
+ throw new AppwriteException('Missing required parameter: "tableId"');
3744
+ }
3745
+ if (typeof rowId === 'undefined') {
3746
+ throw new AppwriteException('Missing required parameter: "rowId"');
3747
+ }
3748
+ if (typeof column === 'undefined') {
3749
+ throw new AppwriteException('Missing required parameter: "column"');
3750
+ }
3751
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3752
+ const payload = {};
3753
+ if (typeof value !== 'undefined') {
3754
+ payload['value'] = value;
3755
+ }
3756
+ if (typeof min !== 'undefined') {
3757
+ payload['min'] = min;
3758
+ }
3759
+ const uri = new URL(this.client.config.endpoint + apiPath);
3760
+ return this.client.call('patch', uri, {
3761
+ 'content-type': 'application/json',
3762
+ }, payload);
3763
+ }
3764
+ incrementRowColumn(paramsOrFirst, ...rest) {
3765
+ let params;
3766
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3767
+ params = (paramsOrFirst || {});
3768
+ }
3769
+ else {
3770
+ params = {
3771
+ databaseId: paramsOrFirst,
3772
+ tableId: rest[0],
3773
+ rowId: rest[1],
3774
+ column: rest[2],
3775
+ value: rest[3],
3776
+ max: rest[4]
3777
+ };
3778
+ }
3779
+ const databaseId = params.databaseId;
3780
+ const tableId = params.tableId;
3781
+ const rowId = params.rowId;
3782
+ const column = params.column;
3783
+ const value = params.value;
3784
+ const max = params.max;
3785
+ if (typeof databaseId === 'undefined') {
3786
+ throw new AppwriteException('Missing required parameter: "databaseId"');
3787
+ }
3788
+ if (typeof tableId === 'undefined') {
3789
+ throw new AppwriteException('Missing required parameter: "tableId"');
3790
+ }
3791
+ if (typeof rowId === 'undefined') {
3792
+ throw new AppwriteException('Missing required parameter: "rowId"');
3793
+ }
3794
+ if (typeof column === 'undefined') {
3795
+ throw new AppwriteException('Missing required parameter: "column"');
3796
+ }
3797
+ const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
3798
+ const payload = {};
3799
+ if (typeof value !== 'undefined') {
3800
+ payload['value'] = value;
3801
+ }
3802
+ if (typeof max !== 'undefined') {
3803
+ payload['max'] = max;
3804
+ }
3805
+ const uri = new URL(this.client.config.endpoint + apiPath);
3806
+ return this.client.call('patch', uri, {
3807
+ 'content-type': 'application/json',
3808
+ }, payload);
3809
+ }
3810
+ }
3811
+
3812
+ class Teams extends Service {
3813
+ constructor(client) {
3814
+ super(client);
3815
+ }
3816
+ list(paramsOrFirst, ...rest) {
3817
+ let params;
3818
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3819
+ params = (paramsOrFirst || {});
3820
+ }
3821
+ else {
3822
+ params = {
3823
+ queries: paramsOrFirst,
3824
+ search: rest[0]
3825
+ };
3826
+ }
3827
+ const queries = params.queries;
3828
+ const search = params.search;
3299
3829
  const apiPath = '/teams';
3300
3830
  const payload = {};
3301
3831
  if (typeof queries !== 'undefined') {
@@ -3307,18 +3837,21 @@ class Teams extends Service {
3307
3837
  const uri = new URL(this.client.config.endpoint + apiPath);
3308
3838
  return this.client.call('get', uri, {}, payload);
3309
3839
  }
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) {
3840
+ create(paramsOrFirst, ...rest) {
3841
+ let params;
3842
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3843
+ params = (paramsOrFirst || {});
3844
+ }
3845
+ else {
3846
+ params = {
3847
+ teamId: paramsOrFirst,
3848
+ name: rest[0],
3849
+ roles: rest[1]
3850
+ };
3851
+ }
3852
+ const teamId = params.teamId;
3853
+ const name = params.name;
3854
+ const roles = params.roles;
3322
3855
  if (typeof teamId === 'undefined') {
3323
3856
  throw new AppwriteException('Missing required parameter: "teamId"');
3324
3857
  }
@@ -3341,14 +3874,17 @@ class Teams extends Service {
3341
3874
  'content-type': 'application/json',
3342
3875
  }, payload);
3343
3876
  }
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) {
3877
+ get(paramsOrFirst) {
3878
+ let params;
3879
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3880
+ params = (paramsOrFirst || {});
3881
+ }
3882
+ else {
3883
+ params = {
3884
+ teamId: paramsOrFirst
3885
+ };
3886
+ }
3887
+ const teamId = params.teamId;
3352
3888
  if (typeof teamId === 'undefined') {
3353
3889
  throw new AppwriteException('Missing required parameter: "teamId"');
3354
3890
  }
@@ -3357,15 +3893,19 @@ class Teams extends Service {
3357
3893
  const uri = new URL(this.client.config.endpoint + apiPath);
3358
3894
  return this.client.call('get', uri, {}, payload);
3359
3895
  }
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) {
3896
+ updateName(paramsOrFirst, ...rest) {
3897
+ let params;
3898
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3899
+ params = (paramsOrFirst || {});
3900
+ }
3901
+ else {
3902
+ params = {
3903
+ teamId: paramsOrFirst,
3904
+ name: rest[0]
3905
+ };
3906
+ }
3907
+ const teamId = params.teamId;
3908
+ const name = params.name;
3369
3909
  if (typeof teamId === 'undefined') {
3370
3910
  throw new AppwriteException('Missing required parameter: "teamId"');
3371
3911
  }
@@ -3382,15 +3922,17 @@ class Teams extends Service {
3382
3922
  'content-type': 'application/json',
3383
3923
  }, payload);
3384
3924
  }
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) {
3925
+ delete(paramsOrFirst) {
3926
+ let params;
3927
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3928
+ params = (paramsOrFirst || {});
3929
+ }
3930
+ else {
3931
+ params = {
3932
+ teamId: paramsOrFirst
3933
+ };
3934
+ }
3935
+ const teamId = params.teamId;
3394
3936
  if (typeof teamId === 'undefined') {
3395
3937
  throw new AppwriteException('Missing required parameter: "teamId"');
3396
3938
  }
@@ -3401,18 +3943,21 @@ class Teams extends Service {
3401
3943
  'content-type': 'application/json',
3402
3944
  }, payload);
3403
3945
  }
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) {
3946
+ listMemberships(paramsOrFirst, ...rest) {
3947
+ let params;
3948
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3949
+ params = (paramsOrFirst || {});
3950
+ }
3951
+ else {
3952
+ params = {
3953
+ teamId: paramsOrFirst,
3954
+ queries: rest[0],
3955
+ search: rest[1]
3956
+ };
3957
+ }
3958
+ const teamId = params.teamId;
3959
+ const queries = params.queries;
3960
+ const search = params.search;
3416
3961
  if (typeof teamId === 'undefined') {
3417
3962
  throw new AppwriteException('Missing required parameter: "teamId"');
3418
3963
  }
@@ -3427,40 +3972,29 @@ class Teams extends Service {
3427
3972
  const uri = new URL(this.client.config.endpoint + apiPath);
3428
3973
  return this.client.call('get', uri, {}, payload);
3429
3974
  }
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) {
3975
+ createMembership(paramsOrFirst, ...rest) {
3976
+ let params;
3977
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3978
+ params = (paramsOrFirst || {});
3979
+ }
3980
+ else {
3981
+ params = {
3982
+ teamId: paramsOrFirst,
3983
+ roles: rest[0],
3984
+ email: rest[1],
3985
+ userId: rest[2],
3986
+ phone: rest[3],
3987
+ url: rest[4],
3988
+ name: rest[5]
3989
+ };
3990
+ }
3991
+ const teamId = params.teamId;
3992
+ const roles = params.roles;
3993
+ const email = params.email;
3994
+ const userId = params.userId;
3995
+ const phone = params.phone;
3996
+ const url = params.url;
3997
+ const name = params.name;
3464
3998
  if (typeof teamId === 'undefined') {
3465
3999
  throw new AppwriteException('Missing required parameter: "teamId"');
3466
4000
  }
@@ -3492,17 +4026,19 @@ class Teams extends Service {
3492
4026
  'content-type': 'application/json',
3493
4027
  }, payload);
3494
4028
  }
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) {
4029
+ getMembership(paramsOrFirst, ...rest) {
4030
+ let params;
4031
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4032
+ params = (paramsOrFirst || {});
4033
+ }
4034
+ else {
4035
+ params = {
4036
+ teamId: paramsOrFirst,
4037
+ membershipId: rest[0]
4038
+ };
4039
+ }
4040
+ const teamId = params.teamId;
4041
+ const membershipId = params.membershipId;
3506
4042
  if (typeof teamId === 'undefined') {
3507
4043
  throw new AppwriteException('Missing required parameter: "teamId"');
3508
4044
  }
@@ -3514,19 +4050,21 @@ class Teams extends Service {
3514
4050
  const uri = new URL(this.client.config.endpoint + apiPath);
3515
4051
  return this.client.call('get', uri, {}, payload);
3516
4052
  }
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) {
4053
+ updateMembership(paramsOrFirst, ...rest) {
4054
+ let params;
4055
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4056
+ params = (paramsOrFirst || {});
4057
+ }
4058
+ else {
4059
+ params = {
4060
+ teamId: paramsOrFirst,
4061
+ membershipId: rest[0],
4062
+ roles: rest[1]
4063
+ };
4064
+ }
4065
+ const teamId = params.teamId;
4066
+ const membershipId = params.membershipId;
4067
+ const roles = params.roles;
3530
4068
  if (typeof teamId === 'undefined') {
3531
4069
  throw new AppwriteException('Missing required parameter: "teamId"');
3532
4070
  }
@@ -3546,17 +4084,19 @@ class Teams extends Service {
3546
4084
  'content-type': 'application/json',
3547
4085
  }, payload);
3548
4086
  }
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) {
4087
+ deleteMembership(paramsOrFirst, ...rest) {
4088
+ let params;
4089
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4090
+ params = (paramsOrFirst || {});
4091
+ }
4092
+ else {
4093
+ params = {
4094
+ teamId: paramsOrFirst,
4095
+ membershipId: rest[0]
4096
+ };
4097
+ }
4098
+ const teamId = params.teamId;
4099
+ const membershipId = params.membershipId;
3560
4100
  if (typeof teamId === 'undefined') {
3561
4101
  throw new AppwriteException('Missing required parameter: "teamId"');
3562
4102
  }
@@ -3570,23 +4110,23 @@ class Teams extends Service {
3570
4110
  'content-type': 'application/json',
3571
4111
  }, payload);
3572
4112
  }
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) {
4113
+ updateMembershipStatus(paramsOrFirst, ...rest) {
4114
+ let params;
4115
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4116
+ params = (paramsOrFirst || {});
4117
+ }
4118
+ else {
4119
+ params = {
4120
+ teamId: paramsOrFirst,
4121
+ membershipId: rest[0],
4122
+ userId: rest[1],
4123
+ secret: rest[2]
4124
+ };
4125
+ }
4126
+ const teamId = params.teamId;
4127
+ const membershipId = params.membershipId;
4128
+ const userId = params.userId;
4129
+ const secret = params.secret;
3590
4130
  if (typeof teamId === 'undefined') {
3591
4131
  throw new AppwriteException('Missing required parameter: "teamId"');
3592
4132
  }
@@ -3612,16 +4152,17 @@ class Teams extends Service {
3612
4152
  'content-type': 'application/json',
3613
4153
  }, payload);
3614
4154
  }
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) {
4155
+ getPrefs(paramsOrFirst) {
4156
+ let params;
4157
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4158
+ params = (paramsOrFirst || {});
4159
+ }
4160
+ else {
4161
+ params = {
4162
+ teamId: paramsOrFirst
4163
+ };
4164
+ }
4165
+ const teamId = params.teamId;
3625
4166
  if (typeof teamId === 'undefined') {
3626
4167
  throw new AppwriteException('Missing required parameter: "teamId"');
3627
4168
  }
@@ -3630,17 +4171,19 @@ class Teams extends Service {
3630
4171
  const uri = new URL(this.client.config.endpoint + apiPath);
3631
4172
  return this.client.call('get', uri, {}, payload);
3632
4173
  }
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) {
4174
+ updatePrefs(paramsOrFirst, ...rest) {
4175
+ let params;
4176
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4177
+ params = (paramsOrFirst || {});
4178
+ }
4179
+ else {
4180
+ params = {
4181
+ teamId: paramsOrFirst,
4182
+ prefs: rest[0]
4183
+ };
4184
+ }
4185
+ const teamId = params.teamId;
4186
+ const prefs = params.prefs;
3644
4187
  if (typeof teamId === 'undefined') {
3645
4188
  throw new AppwriteException('Missing required parameter: "teamId"');
3646
4189
  }
@@ -3699,7 +4242,84 @@ Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, document
3699
4242
  Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
3700
4243
  Query.limit = (limit) => new Query("limit", undefined, limit).toString();
3701
4244
  Query.offset = (offset) => new Query("offset", undefined, offset).toString();
4245
+ /**
4246
+ * Filter resources where attribute contains the specified value.
4247
+ *
4248
+ * @param {string} attribute
4249
+ * @param {string | string[]} value
4250
+ * @returns {string}
4251
+ */
3702
4252
  Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
4253
+ /**
4254
+ * Filter resources where attribute does not contain the specified value.
4255
+ *
4256
+ * @param {string} attribute
4257
+ * @param {string | string[]} value
4258
+ * @returns {string}
4259
+ */
4260
+ Query.notContains = (attribute, value) => new Query("notContains", attribute, value).toString();
4261
+ /**
4262
+ * Filter resources by searching attribute for value (inverse of search).
4263
+ * A fulltext index on attribute is required for this query to work.
4264
+ *
4265
+ * @param {string} attribute
4266
+ * @param {string} value
4267
+ * @returns {string}
4268
+ */
4269
+ Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value).toString();
4270
+ /**
4271
+ * Filter resources where attribute is not between start and end (exclusive).
4272
+ *
4273
+ * @param {string} attribute
4274
+ * @param {string | number} start
4275
+ * @param {string | number} end
4276
+ * @returns {string}
4277
+ */
4278
+ Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
4279
+ /**
4280
+ * Filter resources where attribute does not start with value.
4281
+ *
4282
+ * @param {string} attribute
4283
+ * @param {string} value
4284
+ * @returns {string}
4285
+ */
4286
+ Query.notStartsWith = (attribute, value) => new Query("notStartsWith", attribute, value).toString();
4287
+ /**
4288
+ * Filter resources where attribute does not end with value.
4289
+ *
4290
+ * @param {string} attribute
4291
+ * @param {string} value
4292
+ * @returns {string}
4293
+ */
4294
+ Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, value).toString();
4295
+ /**
4296
+ * Filter resources where document was created before date.
4297
+ *
4298
+ * @param {string} value
4299
+ * @returns {string}
4300
+ */
4301
+ Query.createdBefore = (value) => new Query("createdBefore", undefined, value).toString();
4302
+ /**
4303
+ * Filter resources where document was created after date.
4304
+ *
4305
+ * @param {string} value
4306
+ * @returns {string}
4307
+ */
4308
+ Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toString();
4309
+ /**
4310
+ * Filter resources where document was updated before date.
4311
+ *
4312
+ * @param {string} value
4313
+ * @returns {string}
4314
+ */
4315
+ Query.updatedBefore = (value) => new Query("updatedBefore", undefined, value).toString();
4316
+ /**
4317
+ * Filter resources where document was updated after date.
4318
+ *
4319
+ * @param {string} value
4320
+ * @returns {string}
4321
+ */
4322
+ Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toString();
3703
4323
  Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
3704
4324
  Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
3705
4325
 
@@ -4169,5 +4789,5 @@ var ImageFormat;
4169
4789
  ImageFormat["Gif"] = "gif";
4170
4790
  })(ImageFormat || (ImageFormat = {}));
4171
4791
 
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 };
4792
+ 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
4793
  //# sourceMappingURL=sdk.js.map