react-native-appwrite 0.7.0 → 0.7.2

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.
package/dist/cjs/sdk.js CHANGED
@@ -99,7 +99,7 @@ class Client {
99
99
  'x-sdk-name': 'React Native',
100
100
  'x-sdk-platform': 'client',
101
101
  'x-sdk-language': 'reactnative',
102
- 'x-sdk-version': '0.7.0',
102
+ 'x-sdk-version': '0.7.2',
103
103
  'X-Appwrite-Response-Format': '1.6.0',
104
104
  };
105
105
  this.realtime = {
@@ -370,9 +370,9 @@ class Client {
370
370
  this.realtime.connect();
371
371
  };
372
372
  }
373
- call(method, url, headers = {}, params = {}) {
374
- var _a;
375
- return __awaiter(this, void 0, void 0, function* () {
373
+ call(method_1, url_1) {
374
+ return __awaiter(this, arguments, void 0, function* (method, url, headers = {}, params = {}) {
375
+ var _a, _b;
376
376
  method = method.toUpperCase();
377
377
  headers = Object.assign({}, this.headers, headers);
378
378
  headers.Origin = `appwrite-${reactNative.Platform.OS}://${this.config.platform}`;
@@ -424,7 +424,14 @@ class Client {
424
424
  };
425
425
  }
426
426
  if (400 <= response.status) {
427
- throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, data);
427
+ let responseText = '';
428
+ if ((_b = response.headers.get('content-type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
429
+ responseText = JSON.stringify(data);
430
+ }
431
+ else {
432
+ responseText = data === null || data === void 0 ? void 0 : data.message;
433
+ }
434
+ throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, responseText);
428
435
  }
429
436
  const cookieFallback = response.headers.get('X-Fallback-Cookies');
430
437
  if (typeof window !== 'undefined' && window.localStorage && cookieFallback) {
@@ -448,26 +455,20 @@ class Account extends Service {
448
455
  super(client);
449
456
  }
450
457
  /**
451
- * Get account
452
- *
453
458
  * Get the currently logged in user.
454
459
  *
455
460
  * @throws {AppwriteException}
456
461
  * @returns {Promise}
457
462
  */
458
463
  get() {
459
- return __awaiter(this, void 0, void 0, function* () {
460
- const apiPath = '/account';
461
- const payload = {};
462
- const uri = new URL(this.client.config.endpoint + apiPath);
463
- return yield this.client.call('get', uri, {
464
- 'content-type': 'application/json',
465
- }, payload);
466
- });
464
+ const apiPath = '/account';
465
+ const payload = {};
466
+ const uri = new URL(this.client.config.endpoint + apiPath);
467
+ return this.client.call('get', uri, {
468
+ 'content-type': 'application/json',
469
+ }, payload);
467
470
  }
468
471
  /**
469
- * Create account
470
- *
471
472
  * Use this endpoint to allow a new user to register a new account in your
472
473
  * project. After the user registration completes successfully, you can use
473
474
  * the
@@ -484,39 +485,35 @@ class Account extends Service {
484
485
  * @returns {Promise}
485
486
  */
486
487
  create(userId, email, password, name) {
487
- return __awaiter(this, void 0, void 0, function* () {
488
- if (typeof userId === 'undefined') {
489
- throw new AppwriteException('Missing required parameter: "userId"');
490
- }
491
- if (typeof email === 'undefined') {
492
- throw new AppwriteException('Missing required parameter: "email"');
493
- }
494
- if (typeof password === 'undefined') {
495
- throw new AppwriteException('Missing required parameter: "password"');
496
- }
497
- const apiPath = '/account';
498
- const payload = {};
499
- if (typeof userId !== 'undefined') {
500
- payload['userId'] = userId;
501
- }
502
- if (typeof email !== 'undefined') {
503
- payload['email'] = email;
504
- }
505
- if (typeof password !== 'undefined') {
506
- payload['password'] = password;
507
- }
508
- if (typeof name !== 'undefined') {
509
- payload['name'] = name;
510
- }
511
- const uri = new URL(this.client.config.endpoint + apiPath);
512
- return yield this.client.call('post', uri, {
513
- 'content-type': 'application/json',
514
- }, payload);
515
- });
488
+ if (typeof userId === 'undefined') {
489
+ throw new AppwriteException('Missing required parameter: "userId"');
490
+ }
491
+ if (typeof email === 'undefined') {
492
+ throw new AppwriteException('Missing required parameter: "email"');
493
+ }
494
+ if (typeof password === 'undefined') {
495
+ throw new AppwriteException('Missing required parameter: "password"');
496
+ }
497
+ const apiPath = '/account';
498
+ const payload = {};
499
+ if (typeof userId !== 'undefined') {
500
+ payload['userId'] = userId;
501
+ }
502
+ if (typeof email !== 'undefined') {
503
+ payload['email'] = email;
504
+ }
505
+ if (typeof password !== 'undefined') {
506
+ payload['password'] = password;
507
+ }
508
+ if (typeof name !== 'undefined') {
509
+ payload['name'] = name;
510
+ }
511
+ const uri = new URL(this.client.config.endpoint + apiPath);
512
+ return this.client.call('post', uri, {
513
+ 'content-type': 'application/json',
514
+ }, payload);
516
515
  }
517
516
  /**
518
- * Update email
519
- *
520
517
  * Update currently logged in user account email address. After changing user
521
518
  * address, the user confirmation status will get reset. A new confirmation
522
519
  * email is not sent automatically however you can use the send confirmation
@@ -532,30 +529,26 @@ class Account extends Service {
532
529
  * @returns {Promise}
533
530
  */
534
531
  updateEmail(email, password) {
535
- return __awaiter(this, void 0, void 0, function* () {
536
- if (typeof email === 'undefined') {
537
- throw new AppwriteException('Missing required parameter: "email"');
538
- }
539
- if (typeof password === 'undefined') {
540
- throw new AppwriteException('Missing required parameter: "password"');
541
- }
542
- const apiPath = '/account/email';
543
- const payload = {};
544
- if (typeof email !== 'undefined') {
545
- payload['email'] = email;
546
- }
547
- if (typeof password !== 'undefined') {
548
- payload['password'] = password;
549
- }
550
- const uri = new URL(this.client.config.endpoint + apiPath);
551
- return yield this.client.call('patch', uri, {
552
- 'content-type': 'application/json',
553
- }, payload);
554
- });
532
+ if (typeof email === 'undefined') {
533
+ throw new AppwriteException('Missing required parameter: "email"');
534
+ }
535
+ if (typeof password === 'undefined') {
536
+ throw new AppwriteException('Missing required parameter: "password"');
537
+ }
538
+ const apiPath = '/account/email';
539
+ const payload = {};
540
+ if (typeof email !== 'undefined') {
541
+ payload['email'] = email;
542
+ }
543
+ if (typeof password !== 'undefined') {
544
+ payload['password'] = password;
545
+ }
546
+ const uri = new URL(this.client.config.endpoint + apiPath);
547
+ return this.client.call('patch', uri, {
548
+ 'content-type': 'application/json',
549
+ }, payload);
555
550
  }
556
551
  /**
557
- * List identities
558
- *
559
552
  * Get the list of identities for the currently logged in user.
560
553
  *
561
554
  * @param {string[]} queries
@@ -563,21 +556,17 @@ class Account extends Service {
563
556
  * @returns {Promise}
564
557
  */
565
558
  listIdentities(queries) {
566
- return __awaiter(this, void 0, void 0, function* () {
567
- const apiPath = '/account/identities';
568
- const payload = {};
569
- if (typeof queries !== 'undefined') {
570
- payload['queries'] = queries;
571
- }
572
- const uri = new URL(this.client.config.endpoint + apiPath);
573
- return yield this.client.call('get', uri, {
574
- 'content-type': 'application/json',
575
- }, payload);
576
- });
559
+ const apiPath = '/account/identities';
560
+ const payload = {};
561
+ if (typeof queries !== 'undefined') {
562
+ payload['queries'] = queries;
563
+ }
564
+ const uri = new URL(this.client.config.endpoint + apiPath);
565
+ return this.client.call('get', uri, {
566
+ 'content-type': 'application/json',
567
+ }, payload);
577
568
  }
578
569
  /**
579
- * Delete identity
580
- *
581
570
  * Delete an identity by its unique ID.
582
571
  *
583
572
  * @param {string} identityId
@@ -585,21 +574,17 @@ class Account extends Service {
585
574
  * @returns {Promise}
586
575
  */
587
576
  deleteIdentity(identityId) {
588
- return __awaiter(this, void 0, void 0, function* () {
589
- if (typeof identityId === 'undefined') {
590
- throw new AppwriteException('Missing required parameter: "identityId"');
591
- }
592
- const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
593
- const payload = {};
594
- const uri = new URL(this.client.config.endpoint + apiPath);
595
- return yield this.client.call('delete', uri, {
596
- 'content-type': 'application/json',
597
- }, payload);
598
- });
577
+ if (typeof identityId === 'undefined') {
578
+ throw new AppwriteException('Missing required parameter: "identityId"');
579
+ }
580
+ const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
581
+ const payload = {};
582
+ const uri = new URL(this.client.config.endpoint + apiPath);
583
+ return this.client.call('delete', uri, {
584
+ 'content-type': 'application/json',
585
+ }, payload);
599
586
  }
600
587
  /**
601
- * Create JWT
602
- *
603
588
  * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
604
589
  * to authenticate on behalf of the current user when working with the
605
590
  * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
@@ -610,18 +595,14 @@ class Account extends Service {
610
595
  * @returns {Promise}
611
596
  */
612
597
  createJWT() {
613
- return __awaiter(this, void 0, void 0, function* () {
614
- const apiPath = '/account/jwts';
615
- const payload = {};
616
- const uri = new URL(this.client.config.endpoint + apiPath);
617
- return yield this.client.call('post', uri, {
618
- 'content-type': 'application/json',
619
- }, payload);
620
- });
598
+ const apiPath = '/account/jwts';
599
+ const payload = {};
600
+ const uri = new URL(this.client.config.endpoint + apiPath);
601
+ return this.client.call('post', uri, {
602
+ 'content-type': 'application/json',
603
+ }, payload);
621
604
  }
622
605
  /**
623
- * List logs
624
- *
625
606
  * Get the list of latest security activity logs for the currently logged in
626
607
  * user. Each log returns user IP address, location and date and time of log.
627
608
  *
@@ -630,21 +611,17 @@ class Account extends Service {
630
611
  * @returns {Promise}
631
612
  */
632
613
  listLogs(queries) {
633
- return __awaiter(this, void 0, void 0, function* () {
634
- const apiPath = '/account/logs';
635
- const payload = {};
636
- if (typeof queries !== 'undefined') {
637
- payload['queries'] = queries;
638
- }
639
- const uri = new URL(this.client.config.endpoint + apiPath);
640
- return yield this.client.call('get', uri, {
641
- 'content-type': 'application/json',
642
- }, payload);
643
- });
614
+ const apiPath = '/account/logs';
615
+ const payload = {};
616
+ if (typeof queries !== 'undefined') {
617
+ payload['queries'] = queries;
618
+ }
619
+ const uri = new URL(this.client.config.endpoint + apiPath);
620
+ return this.client.call('get', uri, {
621
+ 'content-type': 'application/json',
622
+ }, payload);
644
623
  }
645
624
  /**
646
- * Update MFA
647
- *
648
625
  * Enable or disable MFA on an account.
649
626
  *
650
627
  * @param {boolean} mfa
@@ -652,24 +629,20 @@ class Account extends Service {
652
629
  * @returns {Promise}
653
630
  */
654
631
  updateMFA(mfa) {
655
- return __awaiter(this, void 0, void 0, function* () {
656
- if (typeof mfa === 'undefined') {
657
- throw new AppwriteException('Missing required parameter: "mfa"');
658
- }
659
- const apiPath = '/account/mfa';
660
- const payload = {};
661
- if (typeof mfa !== 'undefined') {
662
- payload['mfa'] = mfa;
663
- }
664
- const uri = new URL(this.client.config.endpoint + apiPath);
665
- return yield this.client.call('patch', uri, {
666
- 'content-type': 'application/json',
667
- }, payload);
668
- });
632
+ if (typeof mfa === 'undefined') {
633
+ throw new AppwriteException('Missing required parameter: "mfa"');
634
+ }
635
+ const apiPath = '/account/mfa';
636
+ const payload = {};
637
+ if (typeof mfa !== 'undefined') {
638
+ payload['mfa'] = mfa;
639
+ }
640
+ const uri = new URL(this.client.config.endpoint + apiPath);
641
+ return this.client.call('patch', uri, {
642
+ 'content-type': 'application/json',
643
+ }, payload);
669
644
  }
670
645
  /**
671
- * Create authenticator
672
- *
673
646
  * Add an authenticator app to be used as an MFA factor. Verify the
674
647
  * authenticator using the [verify
675
648
  * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
@@ -680,21 +653,17 @@ class Account extends Service {
680
653
  * @returns {Promise}
681
654
  */
682
655
  createMfaAuthenticator(type) {
683
- return __awaiter(this, void 0, void 0, function* () {
684
- if (typeof type === 'undefined') {
685
- throw new AppwriteException('Missing required parameter: "type"');
686
- }
687
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
688
- const payload = {};
689
- const uri = new URL(this.client.config.endpoint + apiPath);
690
- return yield this.client.call('post', uri, {
691
- 'content-type': 'application/json',
692
- }, payload);
693
- });
656
+ if (typeof type === 'undefined') {
657
+ throw new AppwriteException('Missing required parameter: "type"');
658
+ }
659
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
660
+ const payload = {};
661
+ const uri = new URL(this.client.config.endpoint + apiPath);
662
+ return this.client.call('post', uri, {
663
+ 'content-type': 'application/json',
664
+ }, payload);
694
665
  }
695
666
  /**
696
- * Verify authenticator
697
- *
698
667
  * Verify an authenticator app after adding it using the [add
699
668
  * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
700
669
  * method.
@@ -705,27 +674,23 @@ class Account extends Service {
705
674
  * @returns {Promise}
706
675
  */
707
676
  updateMfaAuthenticator(type, otp) {
708
- return __awaiter(this, void 0, void 0, function* () {
709
- if (typeof type === 'undefined') {
710
- throw new AppwriteException('Missing required parameter: "type"');
711
- }
712
- if (typeof otp === 'undefined') {
713
- throw new AppwriteException('Missing required parameter: "otp"');
714
- }
715
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
716
- const payload = {};
717
- if (typeof otp !== 'undefined') {
718
- payload['otp'] = otp;
719
- }
720
- const uri = new URL(this.client.config.endpoint + apiPath);
721
- return yield this.client.call('put', uri, {
722
- 'content-type': 'application/json',
723
- }, payload);
724
- });
677
+ if (typeof type === 'undefined') {
678
+ throw new AppwriteException('Missing required parameter: "type"');
679
+ }
680
+ if (typeof otp === 'undefined') {
681
+ throw new AppwriteException('Missing required parameter: "otp"');
682
+ }
683
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
684
+ const payload = {};
685
+ if (typeof otp !== 'undefined') {
686
+ payload['otp'] = otp;
687
+ }
688
+ const uri = new URL(this.client.config.endpoint + apiPath);
689
+ return this.client.call('put', uri, {
690
+ 'content-type': 'application/json',
691
+ }, payload);
725
692
  }
726
693
  /**
727
- * Delete authenticator
728
- *
729
694
  * Delete an authenticator for a user by ID.
730
695
  *
731
696
  * @param {AuthenticatorType} type
@@ -733,21 +698,17 @@ class Account extends Service {
733
698
  * @returns {Promise}
734
699
  */
735
700
  deleteMfaAuthenticator(type) {
736
- return __awaiter(this, void 0, void 0, function* () {
737
- if (typeof type === 'undefined') {
738
- throw new AppwriteException('Missing required parameter: "type"');
739
- }
740
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
741
- const payload = {};
742
- const uri = new URL(this.client.config.endpoint + apiPath);
743
- return yield this.client.call('delete', uri, {
744
- 'content-type': 'application/json',
745
- }, payload);
746
- });
701
+ if (typeof type === 'undefined') {
702
+ throw new AppwriteException('Missing required parameter: "type"');
703
+ }
704
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
705
+ const payload = {};
706
+ const uri = new URL(this.client.config.endpoint + apiPath);
707
+ return this.client.call('delete', uri, {
708
+ 'content-type': 'application/json',
709
+ }, payload);
747
710
  }
748
711
  /**
749
- * Create MFA challenge
750
- *
751
712
  * Begin the process of MFA verification after sign-in. Finish the flow with
752
713
  * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
753
714
  * method.
@@ -757,24 +718,20 @@ class Account extends Service {
757
718
  * @returns {Promise}
758
719
  */
759
720
  createMfaChallenge(factor) {
760
- return __awaiter(this, void 0, void 0, function* () {
761
- if (typeof factor === 'undefined') {
762
- throw new AppwriteException('Missing required parameter: "factor"');
763
- }
764
- const apiPath = '/account/mfa/challenge';
765
- const payload = {};
766
- if (typeof factor !== 'undefined') {
767
- payload['factor'] = factor;
768
- }
769
- const uri = new URL(this.client.config.endpoint + apiPath);
770
- return yield this.client.call('post', uri, {
771
- 'content-type': 'application/json',
772
- }, payload);
773
- });
721
+ if (typeof factor === 'undefined') {
722
+ throw new AppwriteException('Missing required parameter: "factor"');
723
+ }
724
+ const apiPath = '/account/mfa/challenge';
725
+ const payload = {};
726
+ if (typeof factor !== 'undefined') {
727
+ payload['factor'] = factor;
728
+ }
729
+ const uri = new URL(this.client.config.endpoint + apiPath);
730
+ return this.client.call('post', uri, {
731
+ 'content-type': 'application/json',
732
+ }, payload);
774
733
  }
775
734
  /**
776
- * Create MFA challenge (confirmation)
777
- *
778
735
  * Complete the MFA challenge by providing the one-time password. Finish the
779
736
  * process of MFA verification by providing the one-time password. To begin
780
737
  * the flow, use
@@ -787,48 +744,40 @@ class Account extends Service {
787
744
  * @returns {Promise}
788
745
  */
789
746
  updateMfaChallenge(challengeId, otp) {
790
- return __awaiter(this, void 0, void 0, function* () {
791
- if (typeof challengeId === 'undefined') {
792
- throw new AppwriteException('Missing required parameter: "challengeId"');
793
- }
794
- if (typeof otp === 'undefined') {
795
- throw new AppwriteException('Missing required parameter: "otp"');
796
- }
797
- const apiPath = '/account/mfa/challenge';
798
- const payload = {};
799
- if (typeof challengeId !== 'undefined') {
800
- payload['challengeId'] = challengeId;
801
- }
802
- if (typeof otp !== 'undefined') {
803
- payload['otp'] = otp;
804
- }
805
- const uri = new URL(this.client.config.endpoint + apiPath);
806
- return yield this.client.call('put', uri, {
807
- 'content-type': 'application/json',
808
- }, payload);
809
- });
747
+ if (typeof challengeId === 'undefined') {
748
+ throw new AppwriteException('Missing required parameter: "challengeId"');
749
+ }
750
+ if (typeof otp === 'undefined') {
751
+ throw new AppwriteException('Missing required parameter: "otp"');
752
+ }
753
+ const apiPath = '/account/mfa/challenge';
754
+ const payload = {};
755
+ if (typeof challengeId !== 'undefined') {
756
+ payload['challengeId'] = challengeId;
757
+ }
758
+ if (typeof otp !== 'undefined') {
759
+ payload['otp'] = otp;
760
+ }
761
+ const uri = new URL(this.client.config.endpoint + apiPath);
762
+ return this.client.call('put', uri, {
763
+ 'content-type': 'application/json',
764
+ }, payload);
810
765
  }
811
766
  /**
812
- * List factors
813
- *
814
767
  * List the factors available on the account to be used as a MFA challange.
815
768
  *
816
769
  * @throws {AppwriteException}
817
770
  * @returns {Promise}
818
771
  */
819
772
  listMfaFactors() {
820
- return __awaiter(this, void 0, void 0, function* () {
821
- const apiPath = '/account/mfa/factors';
822
- const payload = {};
823
- const uri = new URL(this.client.config.endpoint + apiPath);
824
- return yield this.client.call('get', uri, {
825
- 'content-type': 'application/json',
826
- }, payload);
827
- });
773
+ const apiPath = '/account/mfa/factors';
774
+ const payload = {};
775
+ const uri = new URL(this.client.config.endpoint + apiPath);
776
+ return this.client.call('get', uri, {
777
+ 'content-type': 'application/json',
778
+ }, payload);
828
779
  }
829
780
  /**
830
- * Get MFA recovery codes
831
- *
832
781
  * Get recovery codes that can be used as backup for MFA flow. Before getting
833
782
  * codes, they must be generated using
834
783
  * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
@@ -838,18 +787,14 @@ class Account extends Service {
838
787
  * @returns {Promise}
839
788
  */
840
789
  getMfaRecoveryCodes() {
841
- return __awaiter(this, void 0, void 0, function* () {
842
- const apiPath = '/account/mfa/recovery-codes';
843
- const payload = {};
844
- const uri = new URL(this.client.config.endpoint + apiPath);
845
- return yield this.client.call('get', uri, {
846
- 'content-type': 'application/json',
847
- }, payload);
848
- });
790
+ const apiPath = '/account/mfa/recovery-codes';
791
+ const payload = {};
792
+ const uri = new URL(this.client.config.endpoint + apiPath);
793
+ return this.client.call('get', uri, {
794
+ 'content-type': 'application/json',
795
+ }, payload);
849
796
  }
850
797
  /**
851
- * Create MFA recovery codes
852
- *
853
798
  * Generate recovery codes as backup for MFA flow. It's recommended to
854
799
  * generate and show then immediately after user successfully adds their
855
800
  * authehticator. Recovery codes can be used as a MFA verification type in
@@ -860,18 +805,14 @@ class Account extends Service {
860
805
  * @returns {Promise}
861
806
  */
862
807
  createMfaRecoveryCodes() {
863
- return __awaiter(this, void 0, void 0, function* () {
864
- const apiPath = '/account/mfa/recovery-codes';
865
- const payload = {};
866
- const uri = new URL(this.client.config.endpoint + apiPath);
867
- return yield this.client.call('post', uri, {
868
- 'content-type': 'application/json',
869
- }, payload);
870
- });
808
+ const apiPath = '/account/mfa/recovery-codes';
809
+ const payload = {};
810
+ const uri = new URL(this.client.config.endpoint + apiPath);
811
+ return this.client.call('post', uri, {
812
+ 'content-type': 'application/json',
813
+ }, payload);
871
814
  }
872
815
  /**
873
- * Regenerate MFA recovery codes
874
- *
875
816
  * Regenerate recovery codes that can be used as backup for MFA flow. Before
876
817
  * regenerating codes, they must be first generated using
877
818
  * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
@@ -881,18 +822,14 @@ class Account extends Service {
881
822
  * @returns {Promise}
882
823
  */
883
824
  updateMfaRecoveryCodes() {
884
- return __awaiter(this, void 0, void 0, function* () {
885
- const apiPath = '/account/mfa/recovery-codes';
886
- const payload = {};
887
- const uri = new URL(this.client.config.endpoint + apiPath);
888
- return yield this.client.call('patch', uri, {
889
- 'content-type': 'application/json',
890
- }, payload);
891
- });
825
+ const apiPath = '/account/mfa/recovery-codes';
826
+ const payload = {};
827
+ const uri = new URL(this.client.config.endpoint + apiPath);
828
+ return this.client.call('patch', uri, {
829
+ 'content-type': 'application/json',
830
+ }, payload);
892
831
  }
893
832
  /**
894
- * Update name
895
- *
896
833
  * Update currently logged in user account name.
897
834
  *
898
835
  * @param {string} name
@@ -900,24 +837,20 @@ class Account extends Service {
900
837
  * @returns {Promise}
901
838
  */
902
839
  updateName(name) {
903
- return __awaiter(this, void 0, void 0, function* () {
904
- if (typeof name === 'undefined') {
905
- throw new AppwriteException('Missing required parameter: "name"');
906
- }
907
- const apiPath = '/account/name';
908
- const payload = {};
909
- if (typeof name !== 'undefined') {
910
- payload['name'] = name;
911
- }
912
- const uri = new URL(this.client.config.endpoint + apiPath);
913
- return yield this.client.call('patch', uri, {
914
- 'content-type': 'application/json',
915
- }, payload);
916
- });
840
+ if (typeof name === 'undefined') {
841
+ throw new AppwriteException('Missing required parameter: "name"');
842
+ }
843
+ const apiPath = '/account/name';
844
+ const payload = {};
845
+ if (typeof name !== 'undefined') {
846
+ payload['name'] = name;
847
+ }
848
+ const uri = new URL(this.client.config.endpoint + apiPath);
849
+ return this.client.call('patch', uri, {
850
+ 'content-type': 'application/json',
851
+ }, payload);
917
852
  }
918
853
  /**
919
- * Update password
920
- *
921
854
  * Update currently logged in user password. For validation, user is required
922
855
  * to pass in the new password, and the old password. For users created with
923
856
  * OAuth, Team Invites and Magic URL, oldPassword is optional.
@@ -928,27 +861,23 @@ class Account extends Service {
928
861
  * @returns {Promise}
929
862
  */
930
863
  updatePassword(password, oldPassword) {
931
- return __awaiter(this, void 0, void 0, function* () {
932
- if (typeof password === 'undefined') {
933
- throw new AppwriteException('Missing required parameter: "password"');
934
- }
935
- const apiPath = '/account/password';
936
- const payload = {};
937
- if (typeof password !== 'undefined') {
938
- payload['password'] = password;
939
- }
940
- if (typeof oldPassword !== 'undefined') {
941
- payload['oldPassword'] = oldPassword;
942
- }
943
- const uri = new URL(this.client.config.endpoint + apiPath);
944
- return yield this.client.call('patch', uri, {
945
- 'content-type': 'application/json',
946
- }, payload);
947
- });
864
+ if (typeof password === 'undefined') {
865
+ throw new AppwriteException('Missing required parameter: "password"');
866
+ }
867
+ const apiPath = '/account/password';
868
+ const payload = {};
869
+ if (typeof password !== 'undefined') {
870
+ payload['password'] = password;
871
+ }
872
+ if (typeof oldPassword !== 'undefined') {
873
+ payload['oldPassword'] = oldPassword;
874
+ }
875
+ const uri = new URL(this.client.config.endpoint + apiPath);
876
+ return this.client.call('patch', uri, {
877
+ 'content-type': 'application/json',
878
+ }, payload);
948
879
  }
949
880
  /**
950
- * Update phone
951
- *
952
881
  * Update the currently logged in user's phone number. After updating the
953
882
  * phone number, the phone verification status will be reset. A confirmation
954
883
  * SMS is not sent automatically, however you can use the [POST
@@ -961,48 +890,40 @@ class Account extends Service {
961
890
  * @returns {Promise}
962
891
  */
963
892
  updatePhone(phone, password) {
964
- return __awaiter(this, void 0, void 0, function* () {
965
- if (typeof phone === 'undefined') {
966
- throw new AppwriteException('Missing required parameter: "phone"');
967
- }
968
- if (typeof password === 'undefined') {
969
- throw new AppwriteException('Missing required parameter: "password"');
970
- }
971
- const apiPath = '/account/phone';
972
- const payload = {};
973
- if (typeof phone !== 'undefined') {
974
- payload['phone'] = phone;
975
- }
976
- if (typeof password !== 'undefined') {
977
- payload['password'] = password;
978
- }
979
- const uri = new URL(this.client.config.endpoint + apiPath);
980
- return yield this.client.call('patch', uri, {
981
- 'content-type': 'application/json',
982
- }, payload);
983
- });
893
+ if (typeof phone === 'undefined') {
894
+ throw new AppwriteException('Missing required parameter: "phone"');
895
+ }
896
+ if (typeof password === 'undefined') {
897
+ throw new AppwriteException('Missing required parameter: "password"');
898
+ }
899
+ const apiPath = '/account/phone';
900
+ const payload = {};
901
+ if (typeof phone !== 'undefined') {
902
+ payload['phone'] = phone;
903
+ }
904
+ if (typeof password !== 'undefined') {
905
+ payload['password'] = password;
906
+ }
907
+ const uri = new URL(this.client.config.endpoint + apiPath);
908
+ return this.client.call('patch', uri, {
909
+ 'content-type': 'application/json',
910
+ }, payload);
984
911
  }
985
912
  /**
986
- * Get account preferences
987
- *
988
913
  * Get the preferences as a key-value object for the currently logged in user.
989
914
  *
990
915
  * @throws {AppwriteException}
991
916
  * @returns {Promise}
992
917
  */
993
918
  getPrefs() {
994
- return __awaiter(this, void 0, void 0, function* () {
995
- const apiPath = '/account/prefs';
996
- const payload = {};
997
- const uri = new URL(this.client.config.endpoint + apiPath);
998
- return yield this.client.call('get', uri, {
999
- 'content-type': 'application/json',
1000
- }, payload);
1001
- });
919
+ const apiPath = '/account/prefs';
920
+ const payload = {};
921
+ const uri = new URL(this.client.config.endpoint + apiPath);
922
+ return this.client.call('get', uri, {
923
+ 'content-type': 'application/json',
924
+ }, payload);
1002
925
  }
1003
926
  /**
1004
- * Update preferences
1005
- *
1006
927
  * Update currently logged in user account preferences. The object you pass is
1007
928
  * stored as is, and replaces any previous value. The maximum allowed prefs
1008
929
  * size is 64kB and throws error if exceeded.
@@ -1012,24 +933,20 @@ class Account extends Service {
1012
933
  * @returns {Promise}
1013
934
  */
1014
935
  updatePrefs(prefs) {
1015
- return __awaiter(this, void 0, void 0, function* () {
1016
- if (typeof prefs === 'undefined') {
1017
- throw new AppwriteException('Missing required parameter: "prefs"');
1018
- }
1019
- const apiPath = '/account/prefs';
1020
- const payload = {};
1021
- if (typeof prefs !== 'undefined') {
1022
- payload['prefs'] = prefs;
1023
- }
1024
- const uri = new URL(this.client.config.endpoint + apiPath);
1025
- return yield this.client.call('patch', uri, {
1026
- 'content-type': 'application/json',
1027
- }, payload);
1028
- });
936
+ if (typeof prefs === 'undefined') {
937
+ throw new AppwriteException('Missing required parameter: "prefs"');
938
+ }
939
+ const apiPath = '/account/prefs';
940
+ const payload = {};
941
+ if (typeof prefs !== 'undefined') {
942
+ payload['prefs'] = prefs;
943
+ }
944
+ const uri = new URL(this.client.config.endpoint + apiPath);
945
+ return this.client.call('patch', uri, {
946
+ 'content-type': 'application/json',
947
+ }, payload);
1029
948
  }
1030
949
  /**
1031
- * Create password recovery
1032
- *
1033
950
  * Sends the user an email with a temporary secret key for password reset.
1034
951
  * When the user clicks the confirmation link he is redirected back to your
1035
952
  * app password reset URL with the secret key and email address values
@@ -1045,30 +962,26 @@ class Account extends Service {
1045
962
  * @returns {Promise}
1046
963
  */
1047
964
  createRecovery(email, url) {
1048
- return __awaiter(this, void 0, void 0, function* () {
1049
- if (typeof email === 'undefined') {
1050
- throw new AppwriteException('Missing required parameter: "email"');
1051
- }
1052
- if (typeof url === 'undefined') {
1053
- throw new AppwriteException('Missing required parameter: "url"');
1054
- }
1055
- const apiPath = '/account/recovery';
1056
- const payload = {};
1057
- if (typeof email !== 'undefined') {
1058
- payload['email'] = email;
1059
- }
1060
- if (typeof url !== 'undefined') {
1061
- payload['url'] = url;
1062
- }
1063
- const uri = new URL(this.client.config.endpoint + apiPath);
1064
- return yield this.client.call('post', uri, {
1065
- 'content-type': 'application/json',
1066
- }, payload);
1067
- });
965
+ if (typeof email === 'undefined') {
966
+ throw new AppwriteException('Missing required parameter: "email"');
967
+ }
968
+ if (typeof url === 'undefined') {
969
+ throw new AppwriteException('Missing required parameter: "url"');
970
+ }
971
+ const apiPath = '/account/recovery';
972
+ const payload = {};
973
+ if (typeof email !== 'undefined') {
974
+ payload['email'] = email;
975
+ }
976
+ if (typeof url !== 'undefined') {
977
+ payload['url'] = url;
978
+ }
979
+ const uri = new URL(this.client.config.endpoint + apiPath);
980
+ return this.client.call('post', uri, {
981
+ 'content-type': 'application/json',
982
+ }, payload);
1068
983
  }
1069
984
  /**
1070
- * Create password recovery (confirmation)
1071
- *
1072
985
  * Use this endpoint to complete the user account password reset. Both the
1073
986
  * **userId** and **secret** arguments will be passed as query parameters to
1074
987
  * the redirect URL you have provided when sending your request to the [POST
@@ -1087,36 +1000,32 @@ class Account extends Service {
1087
1000
  * @returns {Promise}
1088
1001
  */
1089
1002
  updateRecovery(userId, secret, password) {
1090
- return __awaiter(this, void 0, void 0, function* () {
1091
- if (typeof userId === 'undefined') {
1092
- throw new AppwriteException('Missing required parameter: "userId"');
1093
- }
1094
- if (typeof secret === 'undefined') {
1095
- throw new AppwriteException('Missing required parameter: "secret"');
1096
- }
1097
- if (typeof password === 'undefined') {
1098
- throw new AppwriteException('Missing required parameter: "password"');
1099
- }
1100
- const apiPath = '/account/recovery';
1101
- const payload = {};
1102
- if (typeof userId !== 'undefined') {
1103
- payload['userId'] = userId;
1104
- }
1105
- if (typeof secret !== 'undefined') {
1106
- payload['secret'] = secret;
1107
- }
1108
- if (typeof password !== 'undefined') {
1109
- payload['password'] = password;
1110
- }
1111
- const uri = new URL(this.client.config.endpoint + apiPath);
1112
- return yield this.client.call('put', uri, {
1113
- 'content-type': 'application/json',
1114
- }, payload);
1115
- });
1003
+ if (typeof userId === 'undefined') {
1004
+ throw new AppwriteException('Missing required parameter: "userId"');
1005
+ }
1006
+ if (typeof secret === 'undefined') {
1007
+ throw new AppwriteException('Missing required parameter: "secret"');
1008
+ }
1009
+ if (typeof password === 'undefined') {
1010
+ throw new AppwriteException('Missing required parameter: "password"');
1011
+ }
1012
+ const apiPath = '/account/recovery';
1013
+ const payload = {};
1014
+ if (typeof userId !== 'undefined') {
1015
+ payload['userId'] = userId;
1016
+ }
1017
+ if (typeof secret !== 'undefined') {
1018
+ payload['secret'] = secret;
1019
+ }
1020
+ if (typeof password !== 'undefined') {
1021
+ payload['password'] = password;
1022
+ }
1023
+ const uri = new URL(this.client.config.endpoint + apiPath);
1024
+ return this.client.call('put', uri, {
1025
+ 'content-type': 'application/json',
1026
+ }, payload);
1116
1027
  }
1117
1028
  /**
1118
- * List sessions
1119
- *
1120
1029
  * Get the list of active sessions across different devices for the currently
1121
1030
  * logged in user.
1122
1031
  *
@@ -1124,18 +1033,14 @@ class Account extends Service {
1124
1033
  * @returns {Promise}
1125
1034
  */
1126
1035
  listSessions() {
1127
- return __awaiter(this, void 0, void 0, function* () {
1128
- const apiPath = '/account/sessions';
1129
- const payload = {};
1130
- const uri = new URL(this.client.config.endpoint + apiPath);
1131
- return yield this.client.call('get', uri, {
1132
- 'content-type': 'application/json',
1133
- }, payload);
1134
- });
1036
+ const apiPath = '/account/sessions';
1037
+ const payload = {};
1038
+ const uri = new URL(this.client.config.endpoint + apiPath);
1039
+ return this.client.call('get', uri, {
1040
+ 'content-type': 'application/json',
1041
+ }, payload);
1135
1042
  }
1136
1043
  /**
1137
- * Delete sessions
1138
- *
1139
1044
  * Delete all sessions from the user account and remove any sessions cookies
1140
1045
  * from the end client.
1141
1046
  *
@@ -1143,18 +1048,14 @@ class Account extends Service {
1143
1048
  * @returns {Promise}
1144
1049
  */
1145
1050
  deleteSessions() {
1146
- return __awaiter(this, void 0, void 0, function* () {
1147
- const apiPath = '/account/sessions';
1148
- const payload = {};
1149
- const uri = new URL(this.client.config.endpoint + apiPath);
1150
- return yield this.client.call('delete', uri, {
1151
- 'content-type': 'application/json',
1152
- }, payload);
1153
- });
1051
+ const apiPath = '/account/sessions';
1052
+ const payload = {};
1053
+ const uri = new URL(this.client.config.endpoint + apiPath);
1054
+ return this.client.call('delete', uri, {
1055
+ 'content-type': 'application/json',
1056
+ }, payload);
1154
1057
  }
1155
1058
  /**
1156
- * Create anonymous session
1157
- *
1158
1059
  * Use this endpoint to allow a new user to register an anonymous account in
1159
1060
  * your project. This route will also create a new session for the user. To
1160
1061
  * allow the new user to convert an anonymous account to a normal account, you
@@ -1167,18 +1068,14 @@ class Account extends Service {
1167
1068
  * @returns {Promise}
1168
1069
  */
1169
1070
  createAnonymousSession() {
1170
- return __awaiter(this, void 0, void 0, function* () {
1171
- const apiPath = '/account/sessions/anonymous';
1172
- const payload = {};
1173
- const uri = new URL(this.client.config.endpoint + apiPath);
1174
- return yield this.client.call('post', uri, {
1175
- 'content-type': 'application/json',
1176
- }, payload);
1177
- });
1071
+ const apiPath = '/account/sessions/anonymous';
1072
+ const payload = {};
1073
+ const uri = new URL(this.client.config.endpoint + apiPath);
1074
+ return this.client.call('post', uri, {
1075
+ 'content-type': 'application/json',
1076
+ }, payload);
1178
1077
  }
1179
1078
  /**
1180
- * Create email password session
1181
- *
1182
1079
  * Allow the user to login into their account by providing a valid email and
1183
1080
  * password combination. This route will create a new session for the user.
1184
1081
  *
@@ -1192,30 +1089,26 @@ class Account extends Service {
1192
1089
  * @returns {Promise}
1193
1090
  */
1194
1091
  createEmailPasswordSession(email, password) {
1195
- return __awaiter(this, void 0, void 0, function* () {
1196
- if (typeof email === 'undefined') {
1197
- throw new AppwriteException('Missing required parameter: "email"');
1198
- }
1199
- if (typeof password === 'undefined') {
1200
- throw new AppwriteException('Missing required parameter: "password"');
1201
- }
1202
- const apiPath = '/account/sessions/email';
1203
- const payload = {};
1204
- if (typeof email !== 'undefined') {
1205
- payload['email'] = email;
1206
- }
1207
- if (typeof password !== 'undefined') {
1208
- payload['password'] = password;
1209
- }
1210
- const uri = new URL(this.client.config.endpoint + apiPath);
1211
- return yield this.client.call('post', uri, {
1212
- 'content-type': 'application/json',
1213
- }, payload);
1214
- });
1092
+ if (typeof email === 'undefined') {
1093
+ throw new AppwriteException('Missing required parameter: "email"');
1094
+ }
1095
+ if (typeof password === 'undefined') {
1096
+ throw new AppwriteException('Missing required parameter: "password"');
1097
+ }
1098
+ const apiPath = '/account/sessions/email';
1099
+ const payload = {};
1100
+ if (typeof email !== 'undefined') {
1101
+ payload['email'] = email;
1102
+ }
1103
+ if (typeof password !== 'undefined') {
1104
+ payload['password'] = password;
1105
+ }
1106
+ const uri = new URL(this.client.config.endpoint + apiPath);
1107
+ return this.client.call('post', uri, {
1108
+ 'content-type': 'application/json',
1109
+ }, payload);
1215
1110
  }
1216
1111
  /**
1217
- * Update magic URL session
1218
- *
1219
1112
  * Use this endpoint to create a session from token. Provide the **userId**
1220
1113
  * and **secret** parameters from the successful response of authentication
1221
1114
  * flows initiated by token creation. For example, magic URL and phone login.
@@ -1226,30 +1119,26 @@ class Account extends Service {
1226
1119
  * @returns {Promise}
1227
1120
  */
1228
1121
  updateMagicURLSession(userId, secret) {
1229
- return __awaiter(this, void 0, void 0, function* () {
1230
- if (typeof userId === 'undefined') {
1231
- throw new AppwriteException('Missing required parameter: "userId"');
1232
- }
1233
- if (typeof secret === 'undefined') {
1234
- throw new AppwriteException('Missing required parameter: "secret"');
1235
- }
1236
- const apiPath = '/account/sessions/magic-url';
1237
- const payload = {};
1238
- if (typeof userId !== 'undefined') {
1239
- payload['userId'] = userId;
1240
- }
1241
- if (typeof secret !== 'undefined') {
1242
- payload['secret'] = secret;
1243
- }
1244
- const uri = new URL(this.client.config.endpoint + apiPath);
1245
- return yield this.client.call('put', uri, {
1246
- 'content-type': 'application/json',
1247
- }, payload);
1248
- });
1122
+ if (typeof userId === 'undefined') {
1123
+ throw new AppwriteException('Missing required parameter: "userId"');
1124
+ }
1125
+ if (typeof secret === 'undefined') {
1126
+ throw new AppwriteException('Missing required parameter: "secret"');
1127
+ }
1128
+ const apiPath = '/account/sessions/magic-url';
1129
+ const payload = {};
1130
+ if (typeof userId !== 'undefined') {
1131
+ payload['userId'] = userId;
1132
+ }
1133
+ if (typeof secret !== 'undefined') {
1134
+ payload['secret'] = secret;
1135
+ }
1136
+ const uri = new URL(this.client.config.endpoint + apiPath);
1137
+ return this.client.call('put', uri, {
1138
+ 'content-type': 'application/json',
1139
+ }, payload);
1249
1140
  }
1250
1141
  /**
1251
- * Create OAuth2 session
1252
- *
1253
1142
  * Allow the user to login to their account using the OAuth2 provider of their
1254
1143
  * choice. Each OAuth2 provider should be enabled from the Appwrite console
1255
1144
  * first. Use the success and failure arguments to provide a redirect URL's
@@ -1297,8 +1186,6 @@ class Account extends Service {
1297
1186
  return uri;
1298
1187
  }
1299
1188
  /**
1300
- * Update phone session
1301
- *
1302
1189
  * Use this endpoint to create a session from token. Provide the **userId**
1303
1190
  * and **secret** parameters from the successful response of authentication
1304
1191
  * flows initiated by token creation. For example, magic URL and phone login.
@@ -1309,30 +1196,26 @@ class Account extends Service {
1309
1196
  * @returns {Promise}
1310
1197
  */
1311
1198
  updatePhoneSession(userId, secret) {
1312
- return __awaiter(this, void 0, void 0, function* () {
1313
- if (typeof userId === 'undefined') {
1314
- throw new AppwriteException('Missing required parameter: "userId"');
1315
- }
1316
- if (typeof secret === 'undefined') {
1317
- throw new AppwriteException('Missing required parameter: "secret"');
1318
- }
1319
- const apiPath = '/account/sessions/phone';
1320
- const payload = {};
1321
- if (typeof userId !== 'undefined') {
1322
- payload['userId'] = userId;
1323
- }
1324
- if (typeof secret !== 'undefined') {
1325
- payload['secret'] = secret;
1326
- }
1327
- const uri = new URL(this.client.config.endpoint + apiPath);
1328
- return yield this.client.call('put', uri, {
1329
- 'content-type': 'application/json',
1330
- }, payload);
1331
- });
1199
+ if (typeof userId === 'undefined') {
1200
+ throw new AppwriteException('Missing required parameter: "userId"');
1201
+ }
1202
+ if (typeof secret === 'undefined') {
1203
+ throw new AppwriteException('Missing required parameter: "secret"');
1204
+ }
1205
+ const apiPath = '/account/sessions/phone';
1206
+ const payload = {};
1207
+ if (typeof userId !== 'undefined') {
1208
+ payload['userId'] = userId;
1209
+ }
1210
+ if (typeof secret !== 'undefined') {
1211
+ payload['secret'] = secret;
1212
+ }
1213
+ const uri = new URL(this.client.config.endpoint + apiPath);
1214
+ return this.client.call('put', uri, {
1215
+ 'content-type': 'application/json',
1216
+ }, payload);
1332
1217
  }
1333
1218
  /**
1334
- * Create session
1335
- *
1336
1219
  * Use this endpoint to create a session from token. Provide the **userId**
1337
1220
  * and **secret** parameters from the successful response of authentication
1338
1221
  * flows initiated by token creation. For example, magic URL and phone login.
@@ -1343,30 +1226,26 @@ class Account extends Service {
1343
1226
  * @returns {Promise}
1344
1227
  */
1345
1228
  createSession(userId, secret) {
1346
- return __awaiter(this, void 0, void 0, function* () {
1347
- if (typeof userId === 'undefined') {
1348
- throw new AppwriteException('Missing required parameter: "userId"');
1349
- }
1350
- if (typeof secret === 'undefined') {
1351
- throw new AppwriteException('Missing required parameter: "secret"');
1352
- }
1353
- const apiPath = '/account/sessions/token';
1354
- const payload = {};
1355
- if (typeof userId !== 'undefined') {
1356
- payload['userId'] = userId;
1357
- }
1358
- if (typeof secret !== 'undefined') {
1359
- payload['secret'] = secret;
1360
- }
1361
- const uri = new URL(this.client.config.endpoint + apiPath);
1362
- return yield this.client.call('post', uri, {
1363
- 'content-type': 'application/json',
1364
- }, payload);
1365
- });
1229
+ if (typeof userId === 'undefined') {
1230
+ throw new AppwriteException('Missing required parameter: "userId"');
1231
+ }
1232
+ if (typeof secret === 'undefined') {
1233
+ throw new AppwriteException('Missing required parameter: "secret"');
1234
+ }
1235
+ const apiPath = '/account/sessions/token';
1236
+ const payload = {};
1237
+ if (typeof userId !== 'undefined') {
1238
+ payload['userId'] = userId;
1239
+ }
1240
+ if (typeof secret !== 'undefined') {
1241
+ payload['secret'] = secret;
1242
+ }
1243
+ const uri = new URL(this.client.config.endpoint + apiPath);
1244
+ return this.client.call('post', uri, {
1245
+ 'content-type': 'application/json',
1246
+ }, payload);
1366
1247
  }
1367
1248
  /**
1368
- * Get session
1369
- *
1370
1249
  * Use this endpoint to get a logged in user's session using a Session ID.
1371
1250
  * Inputting 'current' will return the current session being used.
1372
1251
  *
@@ -1375,21 +1254,17 @@ class Account extends Service {
1375
1254
  * @returns {Promise}
1376
1255
  */
1377
1256
  getSession(sessionId) {
1378
- return __awaiter(this, void 0, void 0, function* () {
1379
- if (typeof sessionId === 'undefined') {
1380
- throw new AppwriteException('Missing required parameter: "sessionId"');
1381
- }
1382
- const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1383
- const payload = {};
1384
- const uri = new URL(this.client.config.endpoint + apiPath);
1385
- return yield this.client.call('get', uri, {
1386
- 'content-type': 'application/json',
1387
- }, payload);
1388
- });
1257
+ if (typeof sessionId === 'undefined') {
1258
+ throw new AppwriteException('Missing required parameter: "sessionId"');
1259
+ }
1260
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1261
+ const payload = {};
1262
+ const uri = new URL(this.client.config.endpoint + apiPath);
1263
+ return this.client.call('get', uri, {
1264
+ 'content-type': 'application/json',
1265
+ }, payload);
1389
1266
  }
1390
1267
  /**
1391
- * Update session
1392
- *
1393
1268
  * Use this endpoint to extend a session's length. Extending a session is
1394
1269
  * useful when session expiry is short. If the session was created using an
1395
1270
  * OAuth provider, this endpoint refreshes the access token from the provider.
@@ -1399,21 +1274,17 @@ class Account extends Service {
1399
1274
  * @returns {Promise}
1400
1275
  */
1401
1276
  updateSession(sessionId) {
1402
- return __awaiter(this, void 0, void 0, function* () {
1403
- if (typeof sessionId === 'undefined') {
1404
- throw new AppwriteException('Missing required parameter: "sessionId"');
1405
- }
1406
- const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1407
- const payload = {};
1408
- const uri = new URL(this.client.config.endpoint + apiPath);
1409
- return yield this.client.call('patch', uri, {
1410
- 'content-type': 'application/json',
1411
- }, payload);
1412
- });
1277
+ if (typeof sessionId === 'undefined') {
1278
+ throw new AppwriteException('Missing required parameter: "sessionId"');
1279
+ }
1280
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1281
+ const payload = {};
1282
+ const uri = new URL(this.client.config.endpoint + apiPath);
1283
+ return this.client.call('patch', uri, {
1284
+ 'content-type': 'application/json',
1285
+ }, payload);
1413
1286
  }
1414
1287
  /**
1415
- * Delete session
1416
- *
1417
1288
  * Logout the user. Use 'current' as the session ID to logout on this device,
1418
1289
  * use a session ID to logout on another device. If you're looking to logout
1419
1290
  * the user on all devices, use [Delete
@@ -1425,21 +1296,17 @@ class Account extends Service {
1425
1296
  * @returns {Promise}
1426
1297
  */
1427
1298
  deleteSession(sessionId) {
1428
- return __awaiter(this, void 0, void 0, function* () {
1429
- if (typeof sessionId === 'undefined') {
1430
- throw new AppwriteException('Missing required parameter: "sessionId"');
1431
- }
1432
- const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1433
- const payload = {};
1434
- const uri = new URL(this.client.config.endpoint + apiPath);
1435
- return yield this.client.call('delete', uri, {
1436
- 'content-type': 'application/json',
1437
- }, payload);
1438
- });
1299
+ if (typeof sessionId === 'undefined') {
1300
+ throw new AppwriteException('Missing required parameter: "sessionId"');
1301
+ }
1302
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1303
+ const payload = {};
1304
+ const uri = new URL(this.client.config.endpoint + apiPath);
1305
+ return this.client.call('delete', uri, {
1306
+ 'content-type': 'application/json',
1307
+ }, payload);
1439
1308
  }
1440
1309
  /**
1441
- * Update status
1442
- *
1443
1310
  * Block the currently logged in user account. Behind the scene, the user
1444
1311
  * record is not deleted but permanently blocked from any access. To
1445
1312
  * completely delete a user, use the Users API instead.
@@ -1448,18 +1315,14 @@ class Account extends Service {
1448
1315
  * @returns {Promise}
1449
1316
  */
1450
1317
  updateStatus() {
1451
- return __awaiter(this, void 0, void 0, function* () {
1452
- const apiPath = '/account/status';
1453
- const payload = {};
1454
- const uri = new URL(this.client.config.endpoint + apiPath);
1455
- return yield this.client.call('patch', uri, {
1456
- 'content-type': 'application/json',
1457
- }, payload);
1458
- });
1318
+ const apiPath = '/account/status';
1319
+ const payload = {};
1320
+ const uri = new URL(this.client.config.endpoint + apiPath);
1321
+ return this.client.call('patch', uri, {
1322
+ 'content-type': 'application/json',
1323
+ }, payload);
1459
1324
  }
1460
1325
  /**
1461
- * Create push target
1462
- *
1463
1326
  * Use this endpoint to register a device for push notifications. Provide a
1464
1327
  * target ID (custom or generated using ID.unique()), a device identifier
1465
1328
  * (usually a device token), and optionally specify which provider should send
@@ -1473,33 +1336,29 @@ class Account extends Service {
1473
1336
  * @returns {Promise}
1474
1337
  */
1475
1338
  createPushTarget(targetId, identifier, providerId) {
1476
- return __awaiter(this, void 0, void 0, function* () {
1477
- if (typeof targetId === 'undefined') {
1478
- throw new AppwriteException('Missing required parameter: "targetId"');
1479
- }
1480
- if (typeof identifier === 'undefined') {
1481
- throw new AppwriteException('Missing required parameter: "identifier"');
1482
- }
1483
- const apiPath = '/account/targets/push';
1484
- const payload = {};
1485
- if (typeof targetId !== 'undefined') {
1486
- payload['targetId'] = targetId;
1487
- }
1488
- if (typeof identifier !== 'undefined') {
1489
- payload['identifier'] = identifier;
1490
- }
1491
- if (typeof providerId !== 'undefined') {
1492
- payload['providerId'] = providerId;
1493
- }
1494
- const uri = new URL(this.client.config.endpoint + apiPath);
1495
- return yield this.client.call('post', uri, {
1496
- 'content-type': 'application/json',
1497
- }, payload);
1498
- });
1339
+ if (typeof targetId === 'undefined') {
1340
+ throw new AppwriteException('Missing required parameter: "targetId"');
1341
+ }
1342
+ if (typeof identifier === 'undefined') {
1343
+ throw new AppwriteException('Missing required parameter: "identifier"');
1344
+ }
1345
+ const apiPath = '/account/targets/push';
1346
+ const payload = {};
1347
+ if (typeof targetId !== 'undefined') {
1348
+ payload['targetId'] = targetId;
1349
+ }
1350
+ if (typeof identifier !== 'undefined') {
1351
+ payload['identifier'] = identifier;
1352
+ }
1353
+ if (typeof providerId !== 'undefined') {
1354
+ payload['providerId'] = providerId;
1355
+ }
1356
+ const uri = new URL(this.client.config.endpoint + apiPath);
1357
+ return this.client.call('post', uri, {
1358
+ 'content-type': 'application/json',
1359
+ }, payload);
1499
1360
  }
1500
1361
  /**
1501
- * Update push target
1502
- *
1503
1362
  * Update the currently logged in user's push notification target. You can
1504
1363
  * modify the target's identifier (device token) and provider ID (token,
1505
1364
  * email, phone etc.). The target must exist and belong to the current user.
@@ -1512,27 +1371,23 @@ class Account extends Service {
1512
1371
  * @returns {Promise}
1513
1372
  */
1514
1373
  updatePushTarget(targetId, identifier) {
1515
- return __awaiter(this, void 0, void 0, function* () {
1516
- if (typeof targetId === 'undefined') {
1517
- throw new AppwriteException('Missing required parameter: "targetId"');
1518
- }
1519
- if (typeof identifier === 'undefined') {
1520
- throw new AppwriteException('Missing required parameter: "identifier"');
1521
- }
1522
- const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
1523
- const payload = {};
1524
- if (typeof identifier !== 'undefined') {
1525
- payload['identifier'] = identifier;
1526
- }
1527
- const uri = new URL(this.client.config.endpoint + apiPath);
1528
- return yield this.client.call('put', uri, {
1529
- 'content-type': 'application/json',
1530
- }, payload);
1531
- });
1374
+ if (typeof targetId === 'undefined') {
1375
+ throw new AppwriteException('Missing required parameter: "targetId"');
1376
+ }
1377
+ if (typeof identifier === 'undefined') {
1378
+ throw new AppwriteException('Missing required parameter: "identifier"');
1379
+ }
1380
+ const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
1381
+ const payload = {};
1382
+ if (typeof identifier !== 'undefined') {
1383
+ payload['identifier'] = identifier;
1384
+ }
1385
+ const uri = new URL(this.client.config.endpoint + apiPath);
1386
+ return this.client.call('put', uri, {
1387
+ 'content-type': 'application/json',
1388
+ }, payload);
1532
1389
  }
1533
1390
  /**
1534
- * Delete push target
1535
- *
1536
1391
  * Delete a push notification target for the currently logged in user. After
1537
1392
  * deletion, the device will no longer receive push notifications. The target
1538
1393
  * must exist and belong to the current user.
@@ -1542,21 +1397,17 @@ class Account extends Service {
1542
1397
  * @returns {Promise}
1543
1398
  */
1544
1399
  deletePushTarget(targetId) {
1545
- return __awaiter(this, void 0, void 0, function* () {
1546
- if (typeof targetId === 'undefined') {
1547
- throw new AppwriteException('Missing required parameter: "targetId"');
1548
- }
1549
- const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
1550
- const payload = {};
1551
- const uri = new URL(this.client.config.endpoint + apiPath);
1552
- return yield this.client.call('delete', uri, {
1553
- 'content-type': 'application/json',
1554
- }, payload);
1555
- });
1400
+ if (typeof targetId === 'undefined') {
1401
+ throw new AppwriteException('Missing required parameter: "targetId"');
1402
+ }
1403
+ const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
1404
+ const payload = {};
1405
+ const uri = new URL(this.client.config.endpoint + apiPath);
1406
+ return this.client.call('delete', uri, {
1407
+ 'content-type': 'application/json',
1408
+ }, payload);
1556
1409
  }
1557
1410
  /**
1558
- * Create email token (OTP)
1559
- *
1560
1411
  * Sends the user an email with a secret key for creating a session. If the
1561
1412
  * provided user ID has not be registered, a new user will be created. Use the
1562
1413
  * returned user ID and secret and submit a request to the [POST
@@ -1575,33 +1426,29 @@ class Account extends Service {
1575
1426
  * @returns {Promise}
1576
1427
  */
1577
1428
  createEmailToken(userId, email, phrase) {
1578
- return __awaiter(this, void 0, void 0, function* () {
1579
- if (typeof userId === 'undefined') {
1580
- throw new AppwriteException('Missing required parameter: "userId"');
1581
- }
1582
- if (typeof email === 'undefined') {
1583
- throw new AppwriteException('Missing required parameter: "email"');
1584
- }
1585
- const apiPath = '/account/tokens/email';
1586
- const payload = {};
1587
- if (typeof userId !== 'undefined') {
1588
- payload['userId'] = userId;
1589
- }
1590
- if (typeof email !== 'undefined') {
1591
- payload['email'] = email;
1592
- }
1593
- if (typeof phrase !== 'undefined') {
1594
- payload['phrase'] = phrase;
1595
- }
1596
- const uri = new URL(this.client.config.endpoint + apiPath);
1597
- return yield this.client.call('post', uri, {
1598
- 'content-type': 'application/json',
1599
- }, payload);
1600
- });
1429
+ if (typeof userId === 'undefined') {
1430
+ throw new AppwriteException('Missing required parameter: "userId"');
1431
+ }
1432
+ if (typeof email === 'undefined') {
1433
+ throw new AppwriteException('Missing required parameter: "email"');
1434
+ }
1435
+ const apiPath = '/account/tokens/email';
1436
+ const payload = {};
1437
+ if (typeof userId !== 'undefined') {
1438
+ payload['userId'] = userId;
1439
+ }
1440
+ if (typeof email !== 'undefined') {
1441
+ payload['email'] = email;
1442
+ }
1443
+ if (typeof phrase !== 'undefined') {
1444
+ payload['phrase'] = phrase;
1445
+ }
1446
+ const uri = new URL(this.client.config.endpoint + apiPath);
1447
+ return this.client.call('post', uri, {
1448
+ 'content-type': 'application/json',
1449
+ }, payload);
1601
1450
  }
1602
1451
  /**
1603
- * Create magic URL token
1604
- *
1605
1452
  * Sends the user an email with a secret key for creating a session. If the
1606
1453
  * provided user ID has not been registered, a new user will be created. When
1607
1454
  * the user clicks the link in the email, the user is redirected back to the
@@ -1625,36 +1472,32 @@ class Account extends Service {
1625
1472
  * @returns {Promise}
1626
1473
  */
1627
1474
  createMagicURLToken(userId, email, url, phrase) {
1628
- return __awaiter(this, void 0, void 0, function* () {
1629
- if (typeof userId === 'undefined') {
1630
- throw new AppwriteException('Missing required parameter: "userId"');
1631
- }
1632
- if (typeof email === 'undefined') {
1633
- throw new AppwriteException('Missing required parameter: "email"');
1634
- }
1635
- const apiPath = '/account/tokens/magic-url';
1636
- const payload = {};
1637
- if (typeof userId !== 'undefined') {
1638
- payload['userId'] = userId;
1639
- }
1640
- if (typeof email !== 'undefined') {
1641
- payload['email'] = email;
1642
- }
1643
- if (typeof url !== 'undefined') {
1644
- payload['url'] = url;
1645
- }
1646
- if (typeof phrase !== 'undefined') {
1647
- payload['phrase'] = phrase;
1648
- }
1649
- const uri = new URL(this.client.config.endpoint + apiPath);
1650
- return yield this.client.call('post', uri, {
1651
- 'content-type': 'application/json',
1652
- }, payload);
1653
- });
1475
+ if (typeof userId === 'undefined') {
1476
+ throw new AppwriteException('Missing required parameter: "userId"');
1477
+ }
1478
+ if (typeof email === 'undefined') {
1479
+ throw new AppwriteException('Missing required parameter: "email"');
1480
+ }
1481
+ const apiPath = '/account/tokens/magic-url';
1482
+ const payload = {};
1483
+ if (typeof userId !== 'undefined') {
1484
+ payload['userId'] = userId;
1485
+ }
1486
+ if (typeof email !== 'undefined') {
1487
+ payload['email'] = email;
1488
+ }
1489
+ if (typeof url !== 'undefined') {
1490
+ payload['url'] = url;
1491
+ }
1492
+ if (typeof phrase !== 'undefined') {
1493
+ payload['phrase'] = phrase;
1494
+ }
1495
+ const uri = new URL(this.client.config.endpoint + apiPath);
1496
+ return this.client.call('post', uri, {
1497
+ 'content-type': 'application/json',
1498
+ }, payload);
1654
1499
  }
1655
1500
  /**
1656
- * Create OAuth2 token
1657
- *
1658
1501
  * Allow the user to login to their account using the OAuth2 provider of their
1659
1502
  * choice. Each OAuth2 provider should be enabled from the Appwrite console
1660
1503
  * first. Use the success and failure arguments to provide a redirect URL's
@@ -1700,8 +1543,6 @@ class Account extends Service {
1700
1543
  return uri;
1701
1544
  }
1702
1545
  /**
1703
- * Create phone token
1704
- *
1705
1546
  * Sends the user an SMS with a secret key for creating a session. If the
1706
1547
  * provided user ID has not be registered, a new user will be created. Use the
1707
1548
  * returned user ID and secret and submit a request to the [POST
@@ -1719,30 +1560,26 @@ class Account extends Service {
1719
1560
  * @returns {Promise}
1720
1561
  */
1721
1562
  createPhoneToken(userId, phone) {
1722
- return __awaiter(this, void 0, void 0, function* () {
1723
- if (typeof userId === 'undefined') {
1724
- throw new AppwriteException('Missing required parameter: "userId"');
1725
- }
1726
- if (typeof phone === 'undefined') {
1727
- throw new AppwriteException('Missing required parameter: "phone"');
1728
- }
1729
- const apiPath = '/account/tokens/phone';
1730
- const payload = {};
1731
- if (typeof userId !== 'undefined') {
1732
- payload['userId'] = userId;
1733
- }
1734
- if (typeof phone !== 'undefined') {
1735
- payload['phone'] = phone;
1736
- }
1737
- const uri = new URL(this.client.config.endpoint + apiPath);
1738
- return yield this.client.call('post', uri, {
1739
- 'content-type': 'application/json',
1740
- }, payload);
1741
- });
1563
+ if (typeof userId === 'undefined') {
1564
+ throw new AppwriteException('Missing required parameter: "userId"');
1565
+ }
1566
+ if (typeof phone === 'undefined') {
1567
+ throw new AppwriteException('Missing required parameter: "phone"');
1568
+ }
1569
+ const apiPath = '/account/tokens/phone';
1570
+ const payload = {};
1571
+ if (typeof userId !== 'undefined') {
1572
+ payload['userId'] = userId;
1573
+ }
1574
+ if (typeof phone !== 'undefined') {
1575
+ payload['phone'] = phone;
1576
+ }
1577
+ const uri = new URL(this.client.config.endpoint + apiPath);
1578
+ return this.client.call('post', uri, {
1579
+ 'content-type': 'application/json',
1580
+ }, payload);
1742
1581
  }
1743
1582
  /**
1744
- * Create email verification
1745
- *
1746
1583
  * Use this endpoint to send a verification message to your user email address
1747
1584
  * to confirm they are the valid owners of that address. Both the **userId**
1748
1585
  * and **secret** arguments will be passed as query parameters to the URL you
@@ -1764,24 +1601,20 @@ class Account extends Service {
1764
1601
  * @returns {Promise}
1765
1602
  */
1766
1603
  createVerification(url) {
1767
- return __awaiter(this, void 0, void 0, function* () {
1768
- if (typeof url === 'undefined') {
1769
- throw new AppwriteException('Missing required parameter: "url"');
1770
- }
1771
- const apiPath = '/account/verification';
1772
- const payload = {};
1773
- if (typeof url !== 'undefined') {
1774
- payload['url'] = url;
1775
- }
1776
- const uri = new URL(this.client.config.endpoint + apiPath);
1777
- return yield this.client.call('post', uri, {
1778
- 'content-type': 'application/json',
1779
- }, payload);
1780
- });
1604
+ if (typeof url === 'undefined') {
1605
+ throw new AppwriteException('Missing required parameter: "url"');
1606
+ }
1607
+ const apiPath = '/account/verification';
1608
+ const payload = {};
1609
+ if (typeof url !== 'undefined') {
1610
+ payload['url'] = url;
1611
+ }
1612
+ const uri = new URL(this.client.config.endpoint + apiPath);
1613
+ return this.client.call('post', uri, {
1614
+ 'content-type': 'application/json',
1615
+ }, payload);
1781
1616
  }
1782
1617
  /**
1783
- * Create email verification (confirmation)
1784
- *
1785
1618
  * Use this endpoint to complete the user email verification process. Use both
1786
1619
  * the **userId** and **secret** parameters that were attached to your app URL
1787
1620
  * to verify the user email ownership. If confirmed this route will return a
@@ -1793,30 +1626,26 @@ class Account extends Service {
1793
1626
  * @returns {Promise}
1794
1627
  */
1795
1628
  updateVerification(userId, secret) {
1796
- return __awaiter(this, void 0, void 0, function* () {
1797
- if (typeof userId === 'undefined') {
1798
- throw new AppwriteException('Missing required parameter: "userId"');
1799
- }
1800
- if (typeof secret === 'undefined') {
1801
- throw new AppwriteException('Missing required parameter: "secret"');
1802
- }
1803
- const apiPath = '/account/verification';
1804
- const payload = {};
1805
- if (typeof userId !== 'undefined') {
1806
- payload['userId'] = userId;
1807
- }
1808
- if (typeof secret !== 'undefined') {
1809
- payload['secret'] = secret;
1810
- }
1811
- const uri = new URL(this.client.config.endpoint + apiPath);
1812
- return yield this.client.call('put', uri, {
1813
- 'content-type': 'application/json',
1814
- }, payload);
1815
- });
1629
+ if (typeof userId === 'undefined') {
1630
+ throw new AppwriteException('Missing required parameter: "userId"');
1631
+ }
1632
+ if (typeof secret === 'undefined') {
1633
+ throw new AppwriteException('Missing required parameter: "secret"');
1634
+ }
1635
+ const apiPath = '/account/verification';
1636
+ const payload = {};
1637
+ if (typeof userId !== 'undefined') {
1638
+ payload['userId'] = userId;
1639
+ }
1640
+ if (typeof secret !== 'undefined') {
1641
+ payload['secret'] = secret;
1642
+ }
1643
+ const uri = new URL(this.client.config.endpoint + apiPath);
1644
+ return this.client.call('put', uri, {
1645
+ 'content-type': 'application/json',
1646
+ }, payload);
1816
1647
  }
1817
1648
  /**
1818
- * Create phone verification
1819
- *
1820
1649
  * Use this endpoint to send a verification SMS to the currently logged in
1821
1650
  * user. This endpoint is meant for use after updating a user's phone number
1822
1651
  * using the
@@ -1830,18 +1659,14 @@ class Account extends Service {
1830
1659
  * @returns {Promise}
1831
1660
  */
1832
1661
  createPhoneVerification() {
1833
- return __awaiter(this, void 0, void 0, function* () {
1834
- const apiPath = '/account/verification/phone';
1835
- const payload = {};
1836
- const uri = new URL(this.client.config.endpoint + apiPath);
1837
- return yield this.client.call('post', uri, {
1838
- 'content-type': 'application/json',
1839
- }, payload);
1840
- });
1662
+ const apiPath = '/account/verification/phone';
1663
+ const payload = {};
1664
+ const uri = new URL(this.client.config.endpoint + apiPath);
1665
+ return this.client.call('post', uri, {
1666
+ 'content-type': 'application/json',
1667
+ }, payload);
1841
1668
  }
1842
1669
  /**
1843
- * Update phone verification (confirmation)
1844
- *
1845
1670
  * Use this endpoint to complete the user phone verification process. Use the
1846
1671
  * **userId** and **secret** that were sent to your user's phone number to
1847
1672
  * verify the user email ownership. If confirmed this route will return a 200
@@ -1853,26 +1678,24 @@ class Account extends Service {
1853
1678
  * @returns {Promise}
1854
1679
  */
1855
1680
  updatePhoneVerification(userId, secret) {
1856
- return __awaiter(this, void 0, void 0, function* () {
1857
- if (typeof userId === 'undefined') {
1858
- throw new AppwriteException('Missing required parameter: "userId"');
1859
- }
1860
- if (typeof secret === 'undefined') {
1861
- throw new AppwriteException('Missing required parameter: "secret"');
1862
- }
1863
- const apiPath = '/account/verification/phone';
1864
- const payload = {};
1865
- if (typeof userId !== 'undefined') {
1866
- payload['userId'] = userId;
1867
- }
1868
- if (typeof secret !== 'undefined') {
1869
- payload['secret'] = secret;
1870
- }
1871
- const uri = new URL(this.client.config.endpoint + apiPath);
1872
- return yield this.client.call('put', uri, {
1873
- 'content-type': 'application/json',
1874
- }, payload);
1875
- });
1681
+ if (typeof userId === 'undefined') {
1682
+ throw new AppwriteException('Missing required parameter: "userId"');
1683
+ }
1684
+ if (typeof secret === 'undefined') {
1685
+ throw new AppwriteException('Missing required parameter: "secret"');
1686
+ }
1687
+ const apiPath = '/account/verification/phone';
1688
+ const payload = {};
1689
+ if (typeof userId !== 'undefined') {
1690
+ payload['userId'] = userId;
1691
+ }
1692
+ if (typeof secret !== 'undefined') {
1693
+ payload['secret'] = secret;
1694
+ }
1695
+ const uri = new URL(this.client.config.endpoint + apiPath);
1696
+ return this.client.call('put', uri, {
1697
+ 'content-type': 'application/json',
1698
+ }, payload);
1876
1699
  }
1877
1700
  }
1878
1701
 
@@ -1881,8 +1704,6 @@ class Avatars extends Service {
1881
1704
  super(client);
1882
1705
  }
1883
1706
  /**
1884
- * Get browser icon
1885
- *
1886
1707
  * You can use this endpoint to show different browser icons to your users.
1887
1708
  * The code argument receives the browser code as it appears in your user [GET
1888
1709
  * /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions)
@@ -1924,8 +1745,6 @@ class Avatars extends Service {
1924
1745
  return uri;
1925
1746
  }
1926
1747
  /**
1927
- * Get credit card icon
1928
- *
1929
1748
  * The credit card endpoint will return you the icon of the credit card
1930
1749
  * provider you need. Use width, height and quality arguments to change the
1931
1750
  * output settings.
@@ -1966,8 +1785,6 @@ class Avatars extends Service {
1966
1785
  return uri;
1967
1786
  }
1968
1787
  /**
1969
- * Get favicon
1970
- *
1971
1788
  * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
1972
1789
  * website URL.
1973
1790
  *
@@ -1994,8 +1811,6 @@ class Avatars extends Service {
1994
1811
  return uri;
1995
1812
  }
1996
1813
  /**
1997
- * Get country flag
1998
- *
1999
1814
  * You can use this endpoint to show different country flags icons to your
2000
1815
  * users. The code argument receives the 2 letter country code. Use width,
2001
1816
  * height and quality arguments to change the output settings. Country codes
@@ -2037,8 +1852,6 @@ class Avatars extends Service {
2037
1852
  return uri;
2038
1853
  }
2039
1854
  /**
2040
- * Get image from URL
2041
- *
2042
1855
  * Use this endpoint to fetch a remote image URL and crop it to any image size
2043
1856
  * you want. This endpoint is very useful if you need to crop and display
2044
1857
  * remote images in your app or in case you want to make sure a 3rd party
@@ -2080,8 +1893,6 @@ class Avatars extends Service {
2080
1893
  return uri;
2081
1894
  }
2082
1895
  /**
2083
- * Get user initials
2084
- *
2085
1896
  * Use this endpoint to show your user initials avatar icon on your website or
2086
1897
  * app. By default, this route will try to print your logged-in user name or
2087
1898
  * email initials. You can also overwrite the user name if you pass the 'name'
@@ -2129,8 +1940,6 @@ class Avatars extends Service {
2129
1940
  return uri;
2130
1941
  }
2131
1942
  /**
2132
- * Get QR code
2133
- *
2134
1943
  * Converts a given plain text to a QR code image. You can use the query
2135
1944
  * parameters to change the size and style of the resulting image.
2136
1945
  *
@@ -2174,8 +1983,6 @@ class Databases extends Service {
2174
1983
  super(client);
2175
1984
  }
2176
1985
  /**
2177
- * List documents
2178
- *
2179
1986
  * Get a list of all the user's documents in a given collection. You can use
2180
1987
  * the query params to filter your results.
2181
1988
  *
@@ -2186,32 +1993,29 @@ class Databases extends Service {
2186
1993
  * @returns {Promise}
2187
1994
  */
2188
1995
  listDocuments(databaseId, collectionId, queries) {
2189
- return __awaiter(this, void 0, void 0, function* () {
2190
- if (typeof databaseId === 'undefined') {
2191
- throw new AppwriteException('Missing required parameter: "databaseId"');
2192
- }
2193
- if (typeof collectionId === 'undefined') {
2194
- throw new AppwriteException('Missing required parameter: "collectionId"');
2195
- }
2196
- const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2197
- const payload = {};
2198
- if (typeof queries !== 'undefined') {
2199
- payload['queries'] = queries;
2200
- }
2201
- const uri = new URL(this.client.config.endpoint + apiPath);
2202
- return yield this.client.call('get', uri, {
2203
- 'content-type': 'application/json',
2204
- }, payload);
2205
- });
1996
+ if (typeof databaseId === 'undefined') {
1997
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1998
+ }
1999
+ if (typeof collectionId === 'undefined') {
2000
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2001
+ }
2002
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2003
+ const payload = {};
2004
+ if (typeof queries !== 'undefined') {
2005
+ payload['queries'] = queries;
2006
+ }
2007
+ const uri = new URL(this.client.config.endpoint + apiPath);
2008
+ return this.client.call('get', uri, {
2009
+ 'content-type': 'application/json',
2010
+ }, payload);
2206
2011
  }
2207
2012
  /**
2208
- * Create document
2209
- *
2210
2013
  * Create a new Document. Before using this route, you should create a new
2211
2014
  * collection resource using either a [server
2212
2015
  * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
2213
2016
  * API or directly from your database console.
2214
2017
  *
2018
+ *
2215
2019
  * @param {string} databaseId
2216
2020
  * @param {string} collectionId
2217
2021
  * @param {string} documentId
@@ -2221,39 +2025,35 @@ class Databases extends Service {
2221
2025
  * @returns {Promise}
2222
2026
  */
2223
2027
  createDocument(databaseId, collectionId, documentId, data, permissions) {
2224
- return __awaiter(this, void 0, void 0, function* () {
2225
- if (typeof databaseId === 'undefined') {
2226
- throw new AppwriteException('Missing required parameter: "databaseId"');
2227
- }
2228
- if (typeof collectionId === 'undefined') {
2229
- throw new AppwriteException('Missing required parameter: "collectionId"');
2230
- }
2231
- if (typeof documentId === 'undefined') {
2232
- throw new AppwriteException('Missing required parameter: "documentId"');
2233
- }
2234
- if (typeof data === 'undefined') {
2235
- throw new AppwriteException('Missing required parameter: "data"');
2236
- }
2237
- const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2238
- const payload = {};
2239
- if (typeof documentId !== 'undefined') {
2240
- payload['documentId'] = documentId;
2241
- }
2242
- if (typeof data !== 'undefined') {
2243
- payload['data'] = data;
2244
- }
2245
- if (typeof permissions !== 'undefined') {
2246
- payload['permissions'] = permissions;
2247
- }
2248
- const uri = new URL(this.client.config.endpoint + apiPath);
2249
- return yield this.client.call('post', uri, {
2250
- 'content-type': 'application/json',
2251
- }, payload);
2252
- });
2028
+ if (typeof databaseId === 'undefined') {
2029
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2030
+ }
2031
+ if (typeof collectionId === 'undefined') {
2032
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2033
+ }
2034
+ if (typeof documentId === 'undefined') {
2035
+ throw new AppwriteException('Missing required parameter: "documentId"');
2036
+ }
2037
+ if (typeof data === 'undefined') {
2038
+ throw new AppwriteException('Missing required parameter: "data"');
2039
+ }
2040
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2041
+ const payload = {};
2042
+ if (typeof documentId !== 'undefined') {
2043
+ payload['documentId'] = documentId;
2044
+ }
2045
+ if (typeof data !== 'undefined') {
2046
+ payload['data'] = data;
2047
+ }
2048
+ if (typeof permissions !== 'undefined') {
2049
+ payload['permissions'] = permissions;
2050
+ }
2051
+ const uri = new URL(this.client.config.endpoint + apiPath);
2052
+ return this.client.call('post', uri, {
2053
+ 'content-type': 'application/json',
2054
+ }, payload);
2253
2055
  }
2254
2056
  /**
2255
- * Get document
2256
- *
2257
2057
  * Get a document by its unique ID. This endpoint response returns a JSON
2258
2058
  * object with the document data.
2259
2059
  *
@@ -2265,30 +2065,26 @@ class Databases extends Service {
2265
2065
  * @returns {Promise}
2266
2066
  */
2267
2067
  getDocument(databaseId, collectionId, documentId, queries) {
2268
- return __awaiter(this, void 0, void 0, function* () {
2269
- if (typeof databaseId === 'undefined') {
2270
- throw new AppwriteException('Missing required parameter: "databaseId"');
2271
- }
2272
- if (typeof collectionId === 'undefined') {
2273
- throw new AppwriteException('Missing required parameter: "collectionId"');
2274
- }
2275
- if (typeof documentId === 'undefined') {
2276
- throw new AppwriteException('Missing required parameter: "documentId"');
2277
- }
2278
- const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2279
- const payload = {};
2280
- if (typeof queries !== 'undefined') {
2281
- payload['queries'] = queries;
2282
- }
2283
- const uri = new URL(this.client.config.endpoint + apiPath);
2284
- return yield this.client.call('get', uri, {
2285
- 'content-type': 'application/json',
2286
- }, payload);
2287
- });
2068
+ if (typeof databaseId === 'undefined') {
2069
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2070
+ }
2071
+ if (typeof collectionId === 'undefined') {
2072
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2073
+ }
2074
+ if (typeof documentId === 'undefined') {
2075
+ throw new AppwriteException('Missing required parameter: "documentId"');
2076
+ }
2077
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2078
+ const payload = {};
2079
+ if (typeof queries !== 'undefined') {
2080
+ payload['queries'] = queries;
2081
+ }
2082
+ const uri = new URL(this.client.config.endpoint + apiPath);
2083
+ return this.client.call('get', uri, {
2084
+ 'content-type': 'application/json',
2085
+ }, payload);
2288
2086
  }
2289
2087
  /**
2290
- * Update document
2291
- *
2292
2088
  * Update a document by its unique ID. Using the patch method you can pass
2293
2089
  * only specific fields that will get updated.
2294
2090
  *
@@ -2301,33 +2097,29 @@ class Databases extends Service {
2301
2097
  * @returns {Promise}
2302
2098
  */
2303
2099
  updateDocument(databaseId, collectionId, documentId, data, permissions) {
2304
- return __awaiter(this, void 0, void 0, function* () {
2305
- if (typeof databaseId === 'undefined') {
2306
- throw new AppwriteException('Missing required parameter: "databaseId"');
2307
- }
2308
- if (typeof collectionId === 'undefined') {
2309
- throw new AppwriteException('Missing required parameter: "collectionId"');
2310
- }
2311
- if (typeof documentId === 'undefined') {
2312
- throw new AppwriteException('Missing required parameter: "documentId"');
2313
- }
2314
- const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2315
- const payload = {};
2316
- if (typeof data !== 'undefined') {
2317
- payload['data'] = data;
2318
- }
2319
- if (typeof permissions !== 'undefined') {
2320
- payload['permissions'] = permissions;
2321
- }
2322
- const uri = new URL(this.client.config.endpoint + apiPath);
2323
- return yield this.client.call('patch', uri, {
2324
- 'content-type': 'application/json',
2325
- }, payload);
2326
- });
2100
+ if (typeof databaseId === 'undefined') {
2101
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2102
+ }
2103
+ if (typeof collectionId === 'undefined') {
2104
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2105
+ }
2106
+ if (typeof documentId === 'undefined') {
2107
+ throw new AppwriteException('Missing required parameter: "documentId"');
2108
+ }
2109
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2110
+ const payload = {};
2111
+ if (typeof data !== 'undefined') {
2112
+ payload['data'] = data;
2113
+ }
2114
+ if (typeof permissions !== 'undefined') {
2115
+ payload['permissions'] = permissions;
2116
+ }
2117
+ const uri = new URL(this.client.config.endpoint + apiPath);
2118
+ return this.client.call('patch', uri, {
2119
+ 'content-type': 'application/json',
2120
+ }, payload);
2327
2121
  }
2328
2122
  /**
2329
- * Delete document
2330
- *
2331
2123
  * Delete a document by its unique ID.
2332
2124
  *
2333
2125
  * @param {string} databaseId
@@ -2337,23 +2129,21 @@ class Databases extends Service {
2337
2129
  * @returns {Promise}
2338
2130
  */
2339
2131
  deleteDocument(databaseId, collectionId, documentId) {
2340
- return __awaiter(this, void 0, void 0, function* () {
2341
- if (typeof databaseId === 'undefined') {
2342
- throw new AppwriteException('Missing required parameter: "databaseId"');
2343
- }
2344
- if (typeof collectionId === 'undefined') {
2345
- throw new AppwriteException('Missing required parameter: "collectionId"');
2346
- }
2347
- if (typeof documentId === 'undefined') {
2348
- throw new AppwriteException('Missing required parameter: "documentId"');
2349
- }
2350
- const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2351
- const payload = {};
2352
- const uri = new URL(this.client.config.endpoint + apiPath);
2353
- return yield this.client.call('delete', uri, {
2354
- 'content-type': 'application/json',
2355
- }, payload);
2356
- });
2132
+ if (typeof databaseId === 'undefined') {
2133
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2134
+ }
2135
+ if (typeof collectionId === 'undefined') {
2136
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2137
+ }
2138
+ if (typeof documentId === 'undefined') {
2139
+ throw new AppwriteException('Missing required parameter: "documentId"');
2140
+ }
2141
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2142
+ const payload = {};
2143
+ const uri = new URL(this.client.config.endpoint + apiPath);
2144
+ return this.client.call('delete', uri, {
2145
+ 'content-type': 'application/json',
2146
+ }, payload);
2357
2147
  }
2358
2148
  }
2359
2149
 
@@ -2362,8 +2152,6 @@ class Functions extends Service {
2362
2152
  super(client);
2363
2153
  }
2364
2154
  /**
2365
- * List executions
2366
- *
2367
2155
  * Get a list of all the current user function execution logs. You can use the
2368
2156
  * query params to filter your results.
2369
2157
  *
@@ -2374,27 +2162,23 @@ class Functions extends Service {
2374
2162
  * @returns {Promise}
2375
2163
  */
2376
2164
  listExecutions(functionId, queries, search) {
2377
- return __awaiter(this, void 0, void 0, function* () {
2378
- if (typeof functionId === 'undefined') {
2379
- throw new AppwriteException('Missing required parameter: "functionId"');
2380
- }
2381
- const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
2382
- const payload = {};
2383
- if (typeof queries !== 'undefined') {
2384
- payload['queries'] = queries;
2385
- }
2386
- if (typeof search !== 'undefined') {
2387
- payload['search'] = search;
2388
- }
2389
- const uri = new URL(this.client.config.endpoint + apiPath);
2390
- return yield this.client.call('get', uri, {
2391
- 'content-type': 'application/json',
2392
- }, payload);
2393
- });
2165
+ if (typeof functionId === 'undefined') {
2166
+ throw new AppwriteException('Missing required parameter: "functionId"');
2167
+ }
2168
+ const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
2169
+ const payload = {};
2170
+ if (typeof queries !== 'undefined') {
2171
+ payload['queries'] = queries;
2172
+ }
2173
+ if (typeof search !== 'undefined') {
2174
+ payload['search'] = search;
2175
+ }
2176
+ const uri = new URL(this.client.config.endpoint + apiPath);
2177
+ return this.client.call('get', uri, {
2178
+ 'content-type': 'application/json',
2179
+ }, payload);
2394
2180
  }
2395
2181
  /**
2396
- * Create execution
2397
- *
2398
2182
  * Trigger a function execution. The returned object will return you the
2399
2183
  * current execution status. You can ping the `Get Execution` endpoint to get
2400
2184
  * updates on the current execution status. Once this endpoint is called, your
@@ -2411,39 +2195,35 @@ class Functions extends Service {
2411
2195
  * @returns {Promise}
2412
2196
  */
2413
2197
  createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
2414
- return __awaiter(this, void 0, void 0, function* () {
2415
- if (typeof functionId === 'undefined') {
2416
- throw new AppwriteException('Missing required parameter: "functionId"');
2417
- }
2418
- const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
2419
- const payload = {};
2420
- if (typeof body !== 'undefined') {
2421
- payload['body'] = body;
2422
- }
2423
- if (typeof async !== 'undefined') {
2424
- payload['async'] = async;
2425
- }
2426
- if (typeof xpath !== 'undefined') {
2427
- payload['path'] = xpath;
2428
- }
2429
- if (typeof method !== 'undefined') {
2430
- payload['method'] = method;
2431
- }
2432
- if (typeof headers !== 'undefined') {
2433
- payload['headers'] = headers;
2434
- }
2435
- if (typeof scheduledAt !== 'undefined') {
2436
- payload['scheduledAt'] = scheduledAt;
2437
- }
2438
- const uri = new URL(this.client.config.endpoint + apiPath);
2439
- return yield this.client.call('post', uri, {
2440
- 'content-type': 'application/json',
2441
- }, payload);
2442
- });
2198
+ if (typeof functionId === 'undefined') {
2199
+ throw new AppwriteException('Missing required parameter: "functionId"');
2200
+ }
2201
+ const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
2202
+ const payload = {};
2203
+ if (typeof body !== 'undefined') {
2204
+ payload['body'] = body;
2205
+ }
2206
+ if (typeof async !== 'undefined') {
2207
+ payload['async'] = async;
2208
+ }
2209
+ if (typeof xpath !== 'undefined') {
2210
+ payload['path'] = xpath;
2211
+ }
2212
+ if (typeof method !== 'undefined') {
2213
+ payload['method'] = method;
2214
+ }
2215
+ if (typeof headers !== 'undefined') {
2216
+ payload['headers'] = headers;
2217
+ }
2218
+ if (typeof scheduledAt !== 'undefined') {
2219
+ payload['scheduledAt'] = scheduledAt;
2220
+ }
2221
+ const uri = new URL(this.client.config.endpoint + apiPath);
2222
+ return this.client.call('post', uri, {
2223
+ 'content-type': 'application/json',
2224
+ }, payload);
2443
2225
  }
2444
2226
  /**
2445
- * Get execution
2446
- *
2447
2227
  * Get a function execution log by its unique ID.
2448
2228
  *
2449
2229
  * @param {string} functionId
@@ -2452,20 +2232,18 @@ class Functions extends Service {
2452
2232
  * @returns {Promise}
2453
2233
  */
2454
2234
  getExecution(functionId, executionId) {
2455
- return __awaiter(this, void 0, void 0, function* () {
2456
- if (typeof functionId === 'undefined') {
2457
- throw new AppwriteException('Missing required parameter: "functionId"');
2458
- }
2459
- if (typeof executionId === 'undefined') {
2460
- throw new AppwriteException('Missing required parameter: "executionId"');
2461
- }
2462
- const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
2463
- const payload = {};
2464
- const uri = new URL(this.client.config.endpoint + apiPath);
2465
- return yield this.client.call('get', uri, {
2466
- 'content-type': 'application/json',
2467
- }, payload);
2468
- });
2235
+ if (typeof functionId === 'undefined') {
2236
+ throw new AppwriteException('Missing required parameter: "functionId"');
2237
+ }
2238
+ if (typeof executionId === 'undefined') {
2239
+ throw new AppwriteException('Missing required parameter: "executionId"');
2240
+ }
2241
+ const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
2242
+ const payload = {};
2243
+ const uri = new URL(this.client.config.endpoint + apiPath);
2244
+ return this.client.call('get', uri, {
2245
+ 'content-type': 'application/json',
2246
+ }, payload);
2469
2247
  }
2470
2248
  }
2471
2249
 
@@ -2474,8 +2252,6 @@ class Graphql extends Service {
2474
2252
  super(client);
2475
2253
  }
2476
2254
  /**
2477
- * GraphQL endpoint
2478
- *
2479
2255
  * Execute a GraphQL mutation.
2480
2256
  *
2481
2257
  * @param {object} query
@@ -2483,25 +2259,21 @@ class Graphql extends Service {
2483
2259
  * @returns {Promise}
2484
2260
  */
2485
2261
  query(query) {
2486
- return __awaiter(this, void 0, void 0, function* () {
2487
- if (typeof query === 'undefined') {
2488
- throw new AppwriteException('Missing required parameter: "query"');
2489
- }
2490
- const apiPath = '/graphql';
2491
- const payload = {};
2492
- if (typeof query !== 'undefined') {
2493
- payload['query'] = query;
2494
- }
2495
- const uri = new URL(this.client.config.endpoint + apiPath);
2496
- return yield this.client.call('post', uri, {
2497
- 'x-sdk-graphql': 'true',
2498
- 'content-type': 'application/json',
2499
- }, payload);
2500
- });
2262
+ if (typeof query === 'undefined') {
2263
+ throw new AppwriteException('Missing required parameter: "query"');
2264
+ }
2265
+ const apiPath = '/graphql';
2266
+ const payload = {};
2267
+ if (typeof query !== 'undefined') {
2268
+ payload['query'] = query;
2269
+ }
2270
+ const uri = new URL(this.client.config.endpoint + apiPath);
2271
+ return this.client.call('post', uri, {
2272
+ 'x-sdk-graphql': 'true',
2273
+ 'content-type': 'application/json',
2274
+ }, payload);
2501
2275
  }
2502
2276
  /**
2503
- * GraphQL endpoint
2504
- *
2505
2277
  * Execute a GraphQL mutation.
2506
2278
  *
2507
2279
  * @param {object} query
@@ -2509,21 +2281,19 @@ class Graphql extends Service {
2509
2281
  * @returns {Promise}
2510
2282
  */
2511
2283
  mutation(query) {
2512
- return __awaiter(this, void 0, void 0, function* () {
2513
- if (typeof query === 'undefined') {
2514
- throw new AppwriteException('Missing required parameter: "query"');
2515
- }
2516
- const apiPath = '/graphql/mutation';
2517
- const payload = {};
2518
- if (typeof query !== 'undefined') {
2519
- payload['query'] = query;
2520
- }
2521
- const uri = new URL(this.client.config.endpoint + apiPath);
2522
- return yield this.client.call('post', uri, {
2523
- 'x-sdk-graphql': 'true',
2524
- 'content-type': 'application/json',
2525
- }, payload);
2526
- });
2284
+ if (typeof query === 'undefined') {
2285
+ throw new AppwriteException('Missing required parameter: "query"');
2286
+ }
2287
+ const apiPath = '/graphql/mutation';
2288
+ const payload = {};
2289
+ if (typeof query !== 'undefined') {
2290
+ payload['query'] = query;
2291
+ }
2292
+ const uri = new URL(this.client.config.endpoint + apiPath);
2293
+ return this.client.call('post', uri, {
2294
+ 'x-sdk-graphql': 'true',
2295
+ 'content-type': 'application/json',
2296
+ }, payload);
2527
2297
  }
2528
2298
  }
2529
2299
 
@@ -2532,8 +2302,6 @@ class Locale extends Service {
2532
2302
  super(client);
2533
2303
  }
2534
2304
  /**
2535
- * Get user locale
2536
- *
2537
2305
  * Get the current user location based on IP. Returns an object with user
2538
2306
  * country code, country name, continent name, continent code, ip address and
2539
2307
  * suggested currency. You can use the locale header to get the data in a
@@ -2545,18 +2313,14 @@ class Locale extends Service {
2545
2313
  * @returns {Promise}
2546
2314
  */
2547
2315
  get() {
2548
- return __awaiter(this, void 0, void 0, function* () {
2549
- const apiPath = '/locale';
2550
- const payload = {};
2551
- const uri = new URL(this.client.config.endpoint + apiPath);
2552
- return yield this.client.call('get', uri, {
2553
- 'content-type': 'application/json',
2554
- }, payload);
2555
- });
2316
+ const apiPath = '/locale';
2317
+ const payload = {};
2318
+ const uri = new URL(this.client.config.endpoint + apiPath);
2319
+ return this.client.call('get', uri, {
2320
+ 'content-type': 'application/json',
2321
+ }, payload);
2556
2322
  }
2557
2323
  /**
2558
- * List locale codes
2559
- *
2560
2324
  * List of all locale codes in [ISO
2561
2325
  * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
2562
2326
  *
@@ -2564,18 +2328,14 @@ class Locale extends Service {
2564
2328
  * @returns {Promise}
2565
2329
  */
2566
2330
  listCodes() {
2567
- return __awaiter(this, void 0, void 0, function* () {
2568
- const apiPath = '/locale/codes';
2569
- const payload = {};
2570
- const uri = new URL(this.client.config.endpoint + apiPath);
2571
- return yield this.client.call('get', uri, {
2572
- 'content-type': 'application/json',
2573
- }, payload);
2574
- });
2331
+ const apiPath = '/locale/codes';
2332
+ const payload = {};
2333
+ const uri = new URL(this.client.config.endpoint + apiPath);
2334
+ return this.client.call('get', uri, {
2335
+ 'content-type': 'application/json',
2336
+ }, payload);
2575
2337
  }
2576
2338
  /**
2577
- * List continents
2578
- *
2579
2339
  * List of all continents. You can use the locale header to get the data in a
2580
2340
  * supported language.
2581
2341
  *
@@ -2583,18 +2343,14 @@ class Locale extends Service {
2583
2343
  * @returns {Promise}
2584
2344
  */
2585
2345
  listContinents() {
2586
- return __awaiter(this, void 0, void 0, function* () {
2587
- const apiPath = '/locale/continents';
2588
- const payload = {};
2589
- const uri = new URL(this.client.config.endpoint + apiPath);
2590
- return yield this.client.call('get', uri, {
2591
- 'content-type': 'application/json',
2592
- }, payload);
2593
- });
2346
+ const apiPath = '/locale/continents';
2347
+ const payload = {};
2348
+ const uri = new URL(this.client.config.endpoint + apiPath);
2349
+ return this.client.call('get', uri, {
2350
+ 'content-type': 'application/json',
2351
+ }, payload);
2594
2352
  }
2595
2353
  /**
2596
- * List countries
2597
- *
2598
2354
  * List of all countries. You can use the locale header to get the data in a
2599
2355
  * supported language.
2600
2356
  *
@@ -2602,18 +2358,14 @@ class Locale extends Service {
2602
2358
  * @returns {Promise}
2603
2359
  */
2604
2360
  listCountries() {
2605
- return __awaiter(this, void 0, void 0, function* () {
2606
- const apiPath = '/locale/countries';
2607
- const payload = {};
2608
- const uri = new URL(this.client.config.endpoint + apiPath);
2609
- return yield this.client.call('get', uri, {
2610
- 'content-type': 'application/json',
2611
- }, payload);
2612
- });
2361
+ const apiPath = '/locale/countries';
2362
+ const payload = {};
2363
+ const uri = new URL(this.client.config.endpoint + apiPath);
2364
+ return this.client.call('get', uri, {
2365
+ 'content-type': 'application/json',
2366
+ }, payload);
2613
2367
  }
2614
2368
  /**
2615
- * List EU countries
2616
- *
2617
2369
  * List of all countries that are currently members of the EU. You can use the
2618
2370
  * locale header to get the data in a supported language.
2619
2371
  *
@@ -2621,18 +2373,14 @@ class Locale extends Service {
2621
2373
  * @returns {Promise}
2622
2374
  */
2623
2375
  listCountriesEU() {
2624
- return __awaiter(this, void 0, void 0, function* () {
2625
- const apiPath = '/locale/countries/eu';
2626
- const payload = {};
2627
- const uri = new URL(this.client.config.endpoint + apiPath);
2628
- return yield this.client.call('get', uri, {
2629
- 'content-type': 'application/json',
2630
- }, payload);
2631
- });
2376
+ const apiPath = '/locale/countries/eu';
2377
+ const payload = {};
2378
+ const uri = new URL(this.client.config.endpoint + apiPath);
2379
+ return this.client.call('get', uri, {
2380
+ 'content-type': 'application/json',
2381
+ }, payload);
2632
2382
  }
2633
2383
  /**
2634
- * List countries phone codes
2635
- *
2636
2384
  * List of all countries phone codes. You can use the locale header to get the
2637
2385
  * data in a supported language.
2638
2386
  *
@@ -2640,18 +2388,14 @@ class Locale extends Service {
2640
2388
  * @returns {Promise}
2641
2389
  */
2642
2390
  listCountriesPhones() {
2643
- return __awaiter(this, void 0, void 0, function* () {
2644
- const apiPath = '/locale/countries/phones';
2645
- const payload = {};
2646
- const uri = new URL(this.client.config.endpoint + apiPath);
2647
- return yield this.client.call('get', uri, {
2648
- 'content-type': 'application/json',
2649
- }, payload);
2650
- });
2391
+ const apiPath = '/locale/countries/phones';
2392
+ const payload = {};
2393
+ const uri = new URL(this.client.config.endpoint + apiPath);
2394
+ return this.client.call('get', uri, {
2395
+ 'content-type': 'application/json',
2396
+ }, payload);
2651
2397
  }
2652
2398
  /**
2653
- * List currencies
2654
- *
2655
2399
  * List of all currencies, including currency symbol, name, plural, and
2656
2400
  * decimal digits for all major and minor currencies. You can use the locale
2657
2401
  * header to get the data in a supported language.
@@ -2660,18 +2404,14 @@ class Locale extends Service {
2660
2404
  * @returns {Promise}
2661
2405
  */
2662
2406
  listCurrencies() {
2663
- return __awaiter(this, void 0, void 0, function* () {
2664
- const apiPath = '/locale/currencies';
2665
- const payload = {};
2666
- const uri = new URL(this.client.config.endpoint + apiPath);
2667
- return yield this.client.call('get', uri, {
2668
- 'content-type': 'application/json',
2669
- }, payload);
2670
- });
2407
+ const apiPath = '/locale/currencies';
2408
+ const payload = {};
2409
+ const uri = new URL(this.client.config.endpoint + apiPath);
2410
+ return this.client.call('get', uri, {
2411
+ 'content-type': 'application/json',
2412
+ }, payload);
2671
2413
  }
2672
2414
  /**
2673
- * List languages
2674
- *
2675
2415
  * List of all languages classified by ISO 639-1 including 2-letter code, name
2676
2416
  * in English, and name in the respective language.
2677
2417
  *
@@ -2679,14 +2419,12 @@ class Locale extends Service {
2679
2419
  * @returns {Promise}
2680
2420
  */
2681
2421
  listLanguages() {
2682
- return __awaiter(this, void 0, void 0, function* () {
2683
- const apiPath = '/locale/languages';
2684
- const payload = {};
2685
- const uri = new URL(this.client.config.endpoint + apiPath);
2686
- return yield this.client.call('get', uri, {
2687
- 'content-type': 'application/json',
2688
- }, payload);
2689
- });
2422
+ const apiPath = '/locale/languages';
2423
+ const payload = {};
2424
+ const uri = new URL(this.client.config.endpoint + apiPath);
2425
+ return this.client.call('get', uri, {
2426
+ 'content-type': 'application/json',
2427
+ }, payload);
2690
2428
  }
2691
2429
  }
2692
2430
 
@@ -2695,8 +2433,6 @@ class Messaging extends Service {
2695
2433
  super(client);
2696
2434
  }
2697
2435
  /**
2698
- * Create subscriber
2699
- *
2700
2436
  * Create a new subscriber.
2701
2437
  *
2702
2438
  * @param {string} topicId
@@ -2706,33 +2442,29 @@ class Messaging extends Service {
2706
2442
  * @returns {Promise}
2707
2443
  */
2708
2444
  createSubscriber(topicId, subscriberId, targetId) {
2709
- return __awaiter(this, void 0, void 0, function* () {
2710
- if (typeof topicId === 'undefined') {
2711
- throw new AppwriteException('Missing required parameter: "topicId"');
2712
- }
2713
- if (typeof subscriberId === 'undefined') {
2714
- throw new AppwriteException('Missing required parameter: "subscriberId"');
2715
- }
2716
- if (typeof targetId === 'undefined') {
2717
- throw new AppwriteException('Missing required parameter: "targetId"');
2718
- }
2719
- const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId);
2720
- const payload = {};
2721
- if (typeof subscriberId !== 'undefined') {
2722
- payload['subscriberId'] = subscriberId;
2723
- }
2724
- if (typeof targetId !== 'undefined') {
2725
- payload['targetId'] = targetId;
2726
- }
2727
- const uri = new URL(this.client.config.endpoint + apiPath);
2728
- return yield this.client.call('post', uri, {
2729
- 'content-type': 'application/json',
2730
- }, payload);
2731
- });
2445
+ if (typeof topicId === 'undefined') {
2446
+ throw new AppwriteException('Missing required parameter: "topicId"');
2447
+ }
2448
+ if (typeof subscriberId === 'undefined') {
2449
+ throw new AppwriteException('Missing required parameter: "subscriberId"');
2450
+ }
2451
+ if (typeof targetId === 'undefined') {
2452
+ throw new AppwriteException('Missing required parameter: "targetId"');
2453
+ }
2454
+ const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId);
2455
+ const payload = {};
2456
+ if (typeof subscriberId !== 'undefined') {
2457
+ payload['subscriberId'] = subscriberId;
2458
+ }
2459
+ if (typeof targetId !== 'undefined') {
2460
+ payload['targetId'] = targetId;
2461
+ }
2462
+ const uri = new URL(this.client.config.endpoint + apiPath);
2463
+ return this.client.call('post', uri, {
2464
+ 'content-type': 'application/json',
2465
+ }, payload);
2732
2466
  }
2733
2467
  /**
2734
- * Delete subscriber
2735
- *
2736
2468
  * Delete a subscriber by its unique ID.
2737
2469
  *
2738
2470
  * @param {string} topicId
@@ -2740,21 +2472,19 @@ class Messaging extends Service {
2740
2472
  * @throws {AppwriteException}
2741
2473
  * @returns {Promise}
2742
2474
  */
2743
- deleteSubscriber(topicId, subscriberId) {
2744
- return __awaiter(this, void 0, void 0, function* () {
2745
- if (typeof topicId === 'undefined') {
2746
- throw new AppwriteException('Missing required parameter: "topicId"');
2747
- }
2748
- if (typeof subscriberId === 'undefined') {
2749
- throw new AppwriteException('Missing required parameter: "subscriberId"');
2750
- }
2751
- const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId);
2752
- const payload = {};
2753
- const uri = new URL(this.client.config.endpoint + apiPath);
2754
- return yield this.client.call('delete', uri, {
2755
- 'content-type': 'application/json',
2756
- }, payload);
2757
- });
2475
+ deleteSubscriber(topicId, subscriberId) {
2476
+ if (typeof topicId === 'undefined') {
2477
+ throw new AppwriteException('Missing required parameter: "topicId"');
2478
+ }
2479
+ if (typeof subscriberId === 'undefined') {
2480
+ throw new AppwriteException('Missing required parameter: "subscriberId"');
2481
+ }
2482
+ const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId);
2483
+ const payload = {};
2484
+ const uri = new URL(this.client.config.endpoint + apiPath);
2485
+ return this.client.call('delete', uri, {
2486
+ 'content-type': 'application/json',
2487
+ }, payload);
2758
2488
  }
2759
2489
  }
2760
2490
 
@@ -2763,8 +2493,6 @@ class Storage extends Service {
2763
2493
  super(client);
2764
2494
  }
2765
2495
  /**
2766
- * List files
2767
- *
2768
2496
  * Get a list of all the user files. You can use the query params to filter
2769
2497
  * your results.
2770
2498
  *
@@ -2775,27 +2503,23 @@ class Storage extends Service {
2775
2503
  * @returns {Promise}
2776
2504
  */
2777
2505
  listFiles(bucketId, queries, search) {
2778
- return __awaiter(this, void 0, void 0, function* () {
2779
- if (typeof bucketId === 'undefined') {
2780
- throw new AppwriteException('Missing required parameter: "bucketId"');
2781
- }
2782
- const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
2783
- const payload = {};
2784
- if (typeof queries !== 'undefined') {
2785
- payload['queries'] = queries;
2786
- }
2787
- if (typeof search !== 'undefined') {
2788
- payload['search'] = search;
2789
- }
2790
- const uri = new URL(this.client.config.endpoint + apiPath);
2791
- return yield this.client.call('get', uri, {
2792
- 'content-type': 'application/json',
2793
- }, payload);
2794
- });
2506
+ if (typeof bucketId === 'undefined') {
2507
+ throw new AppwriteException('Missing required parameter: "bucketId"');
2508
+ }
2509
+ const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
2510
+ const payload = {};
2511
+ if (typeof queries !== 'undefined') {
2512
+ payload['queries'] = queries;
2513
+ }
2514
+ if (typeof search !== 'undefined') {
2515
+ payload['search'] = search;
2516
+ }
2517
+ const uri = new URL(this.client.config.endpoint + apiPath);
2518
+ return this.client.call('get', uri, {
2519
+ 'content-type': 'application/json',
2520
+ }, payload);
2795
2521
  }
2796
2522
  /**
2797
- * Create file
2798
- *
2799
2523
  * Create a new file. Before using this route, you should create a new bucket
2800
2524
  * resource using either a [server
2801
2525
  * integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
@@ -2822,8 +2546,8 @@ class Storage extends Service {
2822
2546
  * @throws {AppwriteException}
2823
2547
  * @returns {Promise}
2824
2548
  */
2825
- createFile(bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2826
- return __awaiter(this, void 0, void 0, function* () {
2549
+ createFile(bucketId_1, fileId_1, file_1, permissions_1) {
2550
+ return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2827
2551
  if (typeof bucketId === 'undefined') {
2828
2552
  throw new AppwriteException('Missing required parameter: "bucketId"');
2829
2553
  }
@@ -2847,7 +2571,7 @@ class Storage extends Service {
2847
2571
  const uri = new URL(this.client.config.endpoint + apiPath);
2848
2572
  const size = file.size;
2849
2573
  if (size <= Service.CHUNK_SIZE) {
2850
- return yield this.client.call('post', uri, {
2574
+ return this.client.call('post', uri, {
2851
2575
  'content-type': 'multipart/form-data',
2852
2576
  }, payload);
2853
2577
  }
@@ -2896,8 +2620,6 @@ class Storage extends Service {
2896
2620
  });
2897
2621
  }
2898
2622
  /**
2899
- * Get file
2900
- *
2901
2623
  * Get a file by its unique ID. This endpoint response returns a JSON object
2902
2624
  * with the file metadata.
2903
2625
  *
@@ -2907,24 +2629,20 @@ class Storage extends Service {
2907
2629
  * @returns {Promise}
2908
2630
  */
2909
2631
  getFile(bucketId, fileId) {
2910
- return __awaiter(this, void 0, void 0, function* () {
2911
- if (typeof bucketId === 'undefined') {
2912
- throw new AppwriteException('Missing required parameter: "bucketId"');
2913
- }
2914
- if (typeof fileId === 'undefined') {
2915
- throw new AppwriteException('Missing required parameter: "fileId"');
2916
- }
2917
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
2918
- const payload = {};
2919
- const uri = new URL(this.client.config.endpoint + apiPath);
2920
- return yield this.client.call('get', uri, {
2921
- 'content-type': 'application/json',
2922
- }, payload);
2923
- });
2632
+ if (typeof bucketId === 'undefined') {
2633
+ throw new AppwriteException('Missing required parameter: "bucketId"');
2634
+ }
2635
+ if (typeof fileId === 'undefined') {
2636
+ throw new AppwriteException('Missing required parameter: "fileId"');
2637
+ }
2638
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
2639
+ const payload = {};
2640
+ const uri = new URL(this.client.config.endpoint + apiPath);
2641
+ return this.client.call('get', uri, {
2642
+ 'content-type': 'application/json',
2643
+ }, payload);
2924
2644
  }
2925
2645
  /**
2926
- * Update file
2927
- *
2928
2646
  * Update a file by its unique ID. Only users with write permissions have
2929
2647
  * access to update this resource.
2930
2648
  *
@@ -2936,30 +2654,26 @@ class Storage extends Service {
2936
2654
  * @returns {Promise}
2937
2655
  */
2938
2656
  updateFile(bucketId, fileId, name, permissions) {
2939
- return __awaiter(this, void 0, void 0, function* () {
2940
- if (typeof bucketId === 'undefined') {
2941
- throw new AppwriteException('Missing required parameter: "bucketId"');
2942
- }
2943
- if (typeof fileId === 'undefined') {
2944
- throw new AppwriteException('Missing required parameter: "fileId"');
2945
- }
2946
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
2947
- const payload = {};
2948
- if (typeof name !== 'undefined') {
2949
- payload['name'] = name;
2950
- }
2951
- if (typeof permissions !== 'undefined') {
2952
- payload['permissions'] = permissions;
2953
- }
2954
- const uri = new URL(this.client.config.endpoint + apiPath);
2955
- return yield this.client.call('put', uri, {
2956
- 'content-type': 'application/json',
2957
- }, payload);
2958
- });
2657
+ if (typeof bucketId === 'undefined') {
2658
+ throw new AppwriteException('Missing required parameter: "bucketId"');
2659
+ }
2660
+ if (typeof fileId === 'undefined') {
2661
+ throw new AppwriteException('Missing required parameter: "fileId"');
2662
+ }
2663
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
2664
+ const payload = {};
2665
+ if (typeof name !== 'undefined') {
2666
+ payload['name'] = name;
2667
+ }
2668
+ if (typeof permissions !== 'undefined') {
2669
+ payload['permissions'] = permissions;
2670
+ }
2671
+ const uri = new URL(this.client.config.endpoint + apiPath);
2672
+ return this.client.call('put', uri, {
2673
+ 'content-type': 'application/json',
2674
+ }, payload);
2959
2675
  }
2960
2676
  /**
2961
- * Delete file
2962
- *
2963
2677
  * Delete a file by its unique ID. Only users with write permissions have
2964
2678
  * access to delete this resource.
2965
2679
  *
@@ -2969,24 +2683,20 @@ class Storage extends Service {
2969
2683
  * @returns {Promise}
2970
2684
  */
2971
2685
  deleteFile(bucketId, fileId) {
2972
- return __awaiter(this, void 0, void 0, function* () {
2973
- if (typeof bucketId === 'undefined') {
2974
- throw new AppwriteException('Missing required parameter: "bucketId"');
2975
- }
2976
- if (typeof fileId === 'undefined') {
2977
- throw new AppwriteException('Missing required parameter: "fileId"');
2978
- }
2979
- const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
2980
- const payload = {};
2981
- const uri = new URL(this.client.config.endpoint + apiPath);
2982
- return yield this.client.call('delete', uri, {
2983
- 'content-type': 'application/json',
2984
- }, payload);
2985
- });
2686
+ if (typeof bucketId === 'undefined') {
2687
+ throw new AppwriteException('Missing required parameter: "bucketId"');
2688
+ }
2689
+ if (typeof fileId === 'undefined') {
2690
+ throw new AppwriteException('Missing required parameter: "fileId"');
2691
+ }
2692
+ const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
2693
+ const payload = {};
2694
+ const uri = new URL(this.client.config.endpoint + apiPath);
2695
+ return this.client.call('delete', uri, {
2696
+ 'content-type': 'application/json',
2697
+ }, payload);
2986
2698
  }
2987
2699
  /**
2988
- * Get file for download
2989
- *
2990
2700
  * Get a file content by its unique ID. The endpoint response return with a
2991
2701
  * 'Content-Disposition: attachment' header that tells the browser to start
2992
2702
  * downloading the file to user downloads directory.
@@ -3013,8 +2723,6 @@ class Storage extends Service {
3013
2723
  return uri;
3014
2724
  }
3015
2725
  /**
3016
- * Get file preview
3017
- *
3018
2726
  * Get a file preview image. Currently, this method supports preview for image
3019
2727
  * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
3020
2728
  * and spreadsheets, will return the file icon image. You can also pass query
@@ -3087,8 +2795,6 @@ class Storage extends Service {
3087
2795
  return uri;
3088
2796
  }
3089
2797
  /**
3090
- * Get file for view
3091
- *
3092
2798
  * Get a file content by its unique ID. This endpoint is similar to the
3093
2799
  * download method but returns with no 'Content-Disposition: attachment'
3094
2800
  * header.
@@ -3121,8 +2827,6 @@ class Teams extends Service {
3121
2827
  super(client);
3122
2828
  }
3123
2829
  /**
3124
- * List teams
3125
- *
3126
2830
  * Get a list of all the teams in which the current user is a member. You can
3127
2831
  * use the parameters to filter your results.
3128
2832
  *
@@ -3132,24 +2836,20 @@ class Teams extends Service {
3132
2836
  * @returns {Promise}
3133
2837
  */
3134
2838
  list(queries, search) {
3135
- return __awaiter(this, void 0, void 0, function* () {
3136
- const apiPath = '/teams';
3137
- const payload = {};
3138
- if (typeof queries !== 'undefined') {
3139
- payload['queries'] = queries;
3140
- }
3141
- if (typeof search !== 'undefined') {
3142
- payload['search'] = search;
3143
- }
3144
- const uri = new URL(this.client.config.endpoint + apiPath);
3145
- return yield this.client.call('get', uri, {
3146
- 'content-type': 'application/json',
3147
- }, payload);
3148
- });
2839
+ const apiPath = '/teams';
2840
+ const payload = {};
2841
+ if (typeof queries !== 'undefined') {
2842
+ payload['queries'] = queries;
2843
+ }
2844
+ if (typeof search !== 'undefined') {
2845
+ payload['search'] = search;
2846
+ }
2847
+ const uri = new URL(this.client.config.endpoint + apiPath);
2848
+ return this.client.call('get', uri, {
2849
+ 'content-type': 'application/json',
2850
+ }, payload);
3149
2851
  }
3150
2852
  /**
3151
- * Create team
3152
- *
3153
2853
  * Create a new team. The user who creates the team will automatically be
3154
2854
  * assigned as the owner of the team. Only the users with the owner role can
3155
2855
  * invite new members, add new owners and delete or update the team.
@@ -3161,33 +2861,29 @@ class Teams extends Service {
3161
2861
  * @returns {Promise}
3162
2862
  */
3163
2863
  create(teamId, name, roles) {
3164
- return __awaiter(this, void 0, void 0, function* () {
3165
- if (typeof teamId === 'undefined') {
3166
- throw new AppwriteException('Missing required parameter: "teamId"');
3167
- }
3168
- if (typeof name === 'undefined') {
3169
- throw new AppwriteException('Missing required parameter: "name"');
3170
- }
3171
- const apiPath = '/teams';
3172
- const payload = {};
3173
- if (typeof teamId !== 'undefined') {
3174
- payload['teamId'] = teamId;
3175
- }
3176
- if (typeof name !== 'undefined') {
3177
- payload['name'] = name;
3178
- }
3179
- if (typeof roles !== 'undefined') {
3180
- payload['roles'] = roles;
3181
- }
3182
- const uri = new URL(this.client.config.endpoint + apiPath);
3183
- return yield this.client.call('post', uri, {
3184
- 'content-type': 'application/json',
3185
- }, payload);
3186
- });
2864
+ if (typeof teamId === 'undefined') {
2865
+ throw new AppwriteException('Missing required parameter: "teamId"');
2866
+ }
2867
+ if (typeof name === 'undefined') {
2868
+ throw new AppwriteException('Missing required parameter: "name"');
2869
+ }
2870
+ const apiPath = '/teams';
2871
+ const payload = {};
2872
+ if (typeof teamId !== 'undefined') {
2873
+ payload['teamId'] = teamId;
2874
+ }
2875
+ if (typeof name !== 'undefined') {
2876
+ payload['name'] = name;
2877
+ }
2878
+ if (typeof roles !== 'undefined') {
2879
+ payload['roles'] = roles;
2880
+ }
2881
+ const uri = new URL(this.client.config.endpoint + apiPath);
2882
+ return this.client.call('post', uri, {
2883
+ 'content-type': 'application/json',
2884
+ }, payload);
3187
2885
  }
3188
2886
  /**
3189
- * Get team
3190
- *
3191
2887
  * Get a team by its ID. All team members have read access for this resource.
3192
2888
  *
3193
2889
  * @param {string} teamId
@@ -3195,21 +2891,17 @@ class Teams extends Service {
3195
2891
  * @returns {Promise}
3196
2892
  */
3197
2893
  get(teamId) {
3198
- return __awaiter(this, void 0, void 0, function* () {
3199
- if (typeof teamId === 'undefined') {
3200
- throw new AppwriteException('Missing required parameter: "teamId"');
3201
- }
3202
- const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
3203
- const payload = {};
3204
- const uri = new URL(this.client.config.endpoint + apiPath);
3205
- return yield this.client.call('get', uri, {
3206
- 'content-type': 'application/json',
3207
- }, payload);
3208
- });
2894
+ if (typeof teamId === 'undefined') {
2895
+ throw new AppwriteException('Missing required parameter: "teamId"');
2896
+ }
2897
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
2898
+ const payload = {};
2899
+ const uri = new URL(this.client.config.endpoint + apiPath);
2900
+ return this.client.call('get', uri, {
2901
+ 'content-type': 'application/json',
2902
+ }, payload);
3209
2903
  }
3210
2904
  /**
3211
- * Update name
3212
- *
3213
2905
  * Update the team's name by its unique ID.
3214
2906
  *
3215
2907
  * @param {string} teamId
@@ -3218,27 +2910,23 @@ class Teams extends Service {
3218
2910
  * @returns {Promise}
3219
2911
  */
3220
2912
  updateName(teamId, name) {
3221
- return __awaiter(this, void 0, void 0, function* () {
3222
- if (typeof teamId === 'undefined') {
3223
- throw new AppwriteException('Missing required parameter: "teamId"');
3224
- }
3225
- if (typeof name === 'undefined') {
3226
- throw new AppwriteException('Missing required parameter: "name"');
3227
- }
3228
- const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
3229
- const payload = {};
3230
- if (typeof name !== 'undefined') {
3231
- payload['name'] = name;
3232
- }
3233
- const uri = new URL(this.client.config.endpoint + apiPath);
3234
- return yield this.client.call('put', uri, {
3235
- 'content-type': 'application/json',
3236
- }, payload);
3237
- });
2913
+ if (typeof teamId === 'undefined') {
2914
+ throw new AppwriteException('Missing required parameter: "teamId"');
2915
+ }
2916
+ if (typeof name === 'undefined') {
2917
+ throw new AppwriteException('Missing required parameter: "name"');
2918
+ }
2919
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
2920
+ const payload = {};
2921
+ if (typeof name !== 'undefined') {
2922
+ payload['name'] = name;
2923
+ }
2924
+ const uri = new URL(this.client.config.endpoint + apiPath);
2925
+ return this.client.call('put', uri, {
2926
+ 'content-type': 'application/json',
2927
+ }, payload);
3238
2928
  }
3239
2929
  /**
3240
- * Delete team
3241
- *
3242
2930
  * Delete a team using its ID. Only team members with the owner role can
3243
2931
  * delete the team.
3244
2932
  *
@@ -3247,21 +2935,17 @@ class Teams extends Service {
3247
2935
  * @returns {Promise}
3248
2936
  */
3249
2937
  delete(teamId) {
3250
- return __awaiter(this, void 0, void 0, function* () {
3251
- if (typeof teamId === 'undefined') {
3252
- throw new AppwriteException('Missing required parameter: "teamId"');
3253
- }
3254
- const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
3255
- const payload = {};
3256
- const uri = new URL(this.client.config.endpoint + apiPath);
3257
- return yield this.client.call('delete', uri, {
3258
- 'content-type': 'application/json',
3259
- }, payload);
3260
- });
2938
+ if (typeof teamId === 'undefined') {
2939
+ throw new AppwriteException('Missing required parameter: "teamId"');
2940
+ }
2941
+ const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
2942
+ const payload = {};
2943
+ const uri = new URL(this.client.config.endpoint + apiPath);
2944
+ return this.client.call('delete', uri, {
2945
+ 'content-type': 'application/json',
2946
+ }, payload);
3261
2947
  }
3262
2948
  /**
3263
- * List team memberships
3264
- *
3265
2949
  * Use this endpoint to list a team's members using the team's ID. All team
3266
2950
  * members have read access to this endpoint. Hide sensitive attributes from
3267
2951
  * the response by toggling membership privacy in the Console.
@@ -3273,27 +2957,23 @@ class Teams extends Service {
3273
2957
  * @returns {Promise}
3274
2958
  */
3275
2959
  listMemberships(teamId, queries, search) {
3276
- return __awaiter(this, void 0, void 0, function* () {
3277
- if (typeof teamId === 'undefined') {
3278
- throw new AppwriteException('Missing required parameter: "teamId"');
3279
- }
3280
- const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
3281
- const payload = {};
3282
- if (typeof queries !== 'undefined') {
3283
- payload['queries'] = queries;
3284
- }
3285
- if (typeof search !== 'undefined') {
3286
- payload['search'] = search;
3287
- }
3288
- const uri = new URL(this.client.config.endpoint + apiPath);
3289
- return yield this.client.call('get', uri, {
3290
- 'content-type': 'application/json',
3291
- }, payload);
3292
- });
2960
+ if (typeof teamId === 'undefined') {
2961
+ throw new AppwriteException('Missing required parameter: "teamId"');
2962
+ }
2963
+ const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
2964
+ const payload = {};
2965
+ if (typeof queries !== 'undefined') {
2966
+ payload['queries'] = queries;
2967
+ }
2968
+ if (typeof search !== 'undefined') {
2969
+ payload['search'] = search;
2970
+ }
2971
+ const uri = new URL(this.client.config.endpoint + apiPath);
2972
+ return this.client.call('get', uri, {
2973
+ 'content-type': 'application/json',
2974
+ }, payload);
3293
2975
  }
3294
2976
  /**
3295
- * Create team membership
3296
- *
3297
2977
  * Invite a new member to join your team. Provide an ID for existing users, or
3298
2978
  * invite unregistered users using an email or phone number. If initiated from
3299
2979
  * a Client SDK, Appwrite will send an email or sms with a link to join the
@@ -3327,42 +3007,38 @@ class Teams extends Service {
3327
3007
  * @returns {Promise}
3328
3008
  */
3329
3009
  createMembership(teamId, roles, email, userId, phone, url, name) {
3330
- return __awaiter(this, void 0, void 0, function* () {
3331
- if (typeof teamId === 'undefined') {
3332
- throw new AppwriteException('Missing required parameter: "teamId"');
3333
- }
3334
- if (typeof roles === 'undefined') {
3335
- throw new AppwriteException('Missing required parameter: "roles"');
3336
- }
3337
- const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
3338
- const payload = {};
3339
- if (typeof email !== 'undefined') {
3340
- payload['email'] = email;
3341
- }
3342
- if (typeof userId !== 'undefined') {
3343
- payload['userId'] = userId;
3344
- }
3345
- if (typeof phone !== 'undefined') {
3346
- payload['phone'] = phone;
3347
- }
3348
- if (typeof roles !== 'undefined') {
3349
- payload['roles'] = roles;
3350
- }
3351
- if (typeof url !== 'undefined') {
3352
- payload['url'] = url;
3353
- }
3354
- if (typeof name !== 'undefined') {
3355
- payload['name'] = name;
3356
- }
3357
- const uri = new URL(this.client.config.endpoint + apiPath);
3358
- return yield this.client.call('post', uri, {
3359
- 'content-type': 'application/json',
3360
- }, payload);
3361
- });
3010
+ if (typeof teamId === 'undefined') {
3011
+ throw new AppwriteException('Missing required parameter: "teamId"');
3012
+ }
3013
+ if (typeof roles === 'undefined') {
3014
+ throw new AppwriteException('Missing required parameter: "roles"');
3015
+ }
3016
+ const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
3017
+ const payload = {};
3018
+ if (typeof email !== 'undefined') {
3019
+ payload['email'] = email;
3020
+ }
3021
+ if (typeof userId !== 'undefined') {
3022
+ payload['userId'] = userId;
3023
+ }
3024
+ if (typeof phone !== 'undefined') {
3025
+ payload['phone'] = phone;
3026
+ }
3027
+ if (typeof roles !== 'undefined') {
3028
+ payload['roles'] = roles;
3029
+ }
3030
+ if (typeof url !== 'undefined') {
3031
+ payload['url'] = url;
3032
+ }
3033
+ if (typeof name !== 'undefined') {
3034
+ payload['name'] = name;
3035
+ }
3036
+ const uri = new URL(this.client.config.endpoint + apiPath);
3037
+ return this.client.call('post', uri, {
3038
+ 'content-type': 'application/json',
3039
+ }, payload);
3362
3040
  }
3363
3041
  /**
3364
- * Get team membership
3365
- *
3366
3042
  * Get a team member by the membership unique id. All team members have read
3367
3043
  * access for this resource. Hide sensitive attributes from the response by
3368
3044
  * toggling membership privacy in the Console.
@@ -3373,24 +3049,20 @@ class Teams extends Service {
3373
3049
  * @returns {Promise}
3374
3050
  */
3375
3051
  getMembership(teamId, membershipId) {
3376
- return __awaiter(this, void 0, void 0, function* () {
3377
- if (typeof teamId === 'undefined') {
3378
- throw new AppwriteException('Missing required parameter: "teamId"');
3379
- }
3380
- if (typeof membershipId === 'undefined') {
3381
- throw new AppwriteException('Missing required parameter: "membershipId"');
3382
- }
3383
- const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3384
- const payload = {};
3385
- const uri = new URL(this.client.config.endpoint + apiPath);
3386
- return yield this.client.call('get', uri, {
3387
- 'content-type': 'application/json',
3388
- }, payload);
3389
- });
3052
+ if (typeof teamId === 'undefined') {
3053
+ throw new AppwriteException('Missing required parameter: "teamId"');
3054
+ }
3055
+ if (typeof membershipId === 'undefined') {
3056
+ throw new AppwriteException('Missing required parameter: "membershipId"');
3057
+ }
3058
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3059
+ const payload = {};
3060
+ const uri = new URL(this.client.config.endpoint + apiPath);
3061
+ return this.client.call('get', uri, {
3062
+ 'content-type': 'application/json',
3063
+ }, payload);
3390
3064
  }
3391
3065
  /**
3392
- * Update membership
3393
- *
3394
3066
  * Modify the roles of a team member. Only team members with the owner role
3395
3067
  * have access to this endpoint. Learn more about [roles and
3396
3068
  * permissions](https://appwrite.io/docs/permissions).
@@ -3403,30 +3075,26 @@ class Teams extends Service {
3403
3075
  * @returns {Promise}
3404
3076
  */
3405
3077
  updateMembership(teamId, membershipId, roles) {
3406
- return __awaiter(this, void 0, void 0, function* () {
3407
- if (typeof teamId === 'undefined') {
3408
- throw new AppwriteException('Missing required parameter: "teamId"');
3409
- }
3410
- if (typeof membershipId === 'undefined') {
3411
- throw new AppwriteException('Missing required parameter: "membershipId"');
3412
- }
3413
- if (typeof roles === 'undefined') {
3414
- throw new AppwriteException('Missing required parameter: "roles"');
3415
- }
3416
- const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3417
- const payload = {};
3418
- if (typeof roles !== 'undefined') {
3419
- payload['roles'] = roles;
3420
- }
3421
- const uri = new URL(this.client.config.endpoint + apiPath);
3422
- return yield this.client.call('patch', uri, {
3423
- 'content-type': 'application/json',
3424
- }, payload);
3425
- });
3078
+ if (typeof teamId === 'undefined') {
3079
+ throw new AppwriteException('Missing required parameter: "teamId"');
3080
+ }
3081
+ if (typeof membershipId === 'undefined') {
3082
+ throw new AppwriteException('Missing required parameter: "membershipId"');
3083
+ }
3084
+ if (typeof roles === 'undefined') {
3085
+ throw new AppwriteException('Missing required parameter: "roles"');
3086
+ }
3087
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3088
+ const payload = {};
3089
+ if (typeof roles !== 'undefined') {
3090
+ payload['roles'] = roles;
3091
+ }
3092
+ const uri = new URL(this.client.config.endpoint + apiPath);
3093
+ return this.client.call('patch', uri, {
3094
+ 'content-type': 'application/json',
3095
+ }, payload);
3426
3096
  }
3427
3097
  /**
3428
- * Delete team membership
3429
- *
3430
3098
  * This endpoint allows a user to leave a team or for a team owner to delete
3431
3099
  * the membership of any other team member. You can also use this endpoint to
3432
3100
  * delete a user membership even if it is not accepted.
@@ -3437,24 +3105,20 @@ class Teams extends Service {
3437
3105
  * @returns {Promise}
3438
3106
  */
3439
3107
  deleteMembership(teamId, membershipId) {
3440
- return __awaiter(this, void 0, void 0, function* () {
3441
- if (typeof teamId === 'undefined') {
3442
- throw new AppwriteException('Missing required parameter: "teamId"');
3443
- }
3444
- if (typeof membershipId === 'undefined') {
3445
- throw new AppwriteException('Missing required parameter: "membershipId"');
3446
- }
3447
- const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3448
- const payload = {};
3449
- const uri = new URL(this.client.config.endpoint + apiPath);
3450
- return yield this.client.call('delete', uri, {
3451
- 'content-type': 'application/json',
3452
- }, payload);
3453
- });
3108
+ if (typeof teamId === 'undefined') {
3109
+ throw new AppwriteException('Missing required parameter: "teamId"');
3110
+ }
3111
+ if (typeof membershipId === 'undefined') {
3112
+ throw new AppwriteException('Missing required parameter: "membershipId"');
3113
+ }
3114
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3115
+ const payload = {};
3116
+ const uri = new URL(this.client.config.endpoint + apiPath);
3117
+ return this.client.call('delete', uri, {
3118
+ 'content-type': 'application/json',
3119
+ }, payload);
3454
3120
  }
3455
3121
  /**
3456
- * Update team membership status
3457
- *
3458
3122
  * Use this endpoint to allow a user to accept an invitation to join a team
3459
3123
  * after being redirected back to your app from the invitation email received
3460
3124
  * by the user.
@@ -3471,36 +3135,32 @@ class Teams extends Service {
3471
3135
  * @returns {Promise}
3472
3136
  */
3473
3137
  updateMembershipStatus(teamId, membershipId, userId, secret) {
3474
- return __awaiter(this, void 0, void 0, function* () {
3475
- if (typeof teamId === 'undefined') {
3476
- throw new AppwriteException('Missing required parameter: "teamId"');
3477
- }
3478
- if (typeof membershipId === 'undefined') {
3479
- throw new AppwriteException('Missing required parameter: "membershipId"');
3480
- }
3481
- if (typeof userId === 'undefined') {
3482
- throw new AppwriteException('Missing required parameter: "userId"');
3483
- }
3484
- if (typeof secret === 'undefined') {
3485
- throw new AppwriteException('Missing required parameter: "secret"');
3486
- }
3487
- const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3488
- const payload = {};
3489
- if (typeof userId !== 'undefined') {
3490
- payload['userId'] = userId;
3491
- }
3492
- if (typeof secret !== 'undefined') {
3493
- payload['secret'] = secret;
3494
- }
3495
- const uri = new URL(this.client.config.endpoint + apiPath);
3496
- return yield this.client.call('patch', uri, {
3497
- 'content-type': 'application/json',
3498
- }, payload);
3499
- });
3138
+ if (typeof teamId === 'undefined') {
3139
+ throw new AppwriteException('Missing required parameter: "teamId"');
3140
+ }
3141
+ if (typeof membershipId === 'undefined') {
3142
+ throw new AppwriteException('Missing required parameter: "membershipId"');
3143
+ }
3144
+ if (typeof userId === 'undefined') {
3145
+ throw new AppwriteException('Missing required parameter: "userId"');
3146
+ }
3147
+ if (typeof secret === 'undefined') {
3148
+ throw new AppwriteException('Missing required parameter: "secret"');
3149
+ }
3150
+ const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3151
+ const payload = {};
3152
+ if (typeof userId !== 'undefined') {
3153
+ payload['userId'] = userId;
3154
+ }
3155
+ if (typeof secret !== 'undefined') {
3156
+ payload['secret'] = secret;
3157
+ }
3158
+ const uri = new URL(this.client.config.endpoint + apiPath);
3159
+ return this.client.call('patch', uri, {
3160
+ 'content-type': 'application/json',
3161
+ }, payload);
3500
3162
  }
3501
3163
  /**
3502
- * Get team preferences
3503
- *
3504
3164
  * Get the team's shared preferences by its unique ID. If a preference doesn't
3505
3165
  * need to be shared by all team members, prefer storing them in [user
3506
3166
  * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
@@ -3510,21 +3170,17 @@ class Teams extends Service {
3510
3170
  * @returns {Promise}
3511
3171
  */
3512
3172
  getPrefs(teamId) {
3513
- return __awaiter(this, void 0, void 0, function* () {
3514
- if (typeof teamId === 'undefined') {
3515
- throw new AppwriteException('Missing required parameter: "teamId"');
3516
- }
3517
- const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
3518
- const payload = {};
3519
- const uri = new URL(this.client.config.endpoint + apiPath);
3520
- return yield this.client.call('get', uri, {
3521
- 'content-type': 'application/json',
3522
- }, payload);
3523
- });
3173
+ if (typeof teamId === 'undefined') {
3174
+ throw new AppwriteException('Missing required parameter: "teamId"');
3175
+ }
3176
+ const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
3177
+ const payload = {};
3178
+ const uri = new URL(this.client.config.endpoint + apiPath);
3179
+ return this.client.call('get', uri, {
3180
+ 'content-type': 'application/json',
3181
+ }, payload);
3524
3182
  }
3525
3183
  /**
3526
- * Update preferences
3527
- *
3528
3184
  * Update the team's preferences by its unique ID. The object you pass is
3529
3185
  * stored as is and replaces any previous value. The maximum allowed prefs
3530
3186
  * size is 64kB and throws an error if exceeded.
@@ -3535,23 +3191,21 @@ class Teams extends Service {
3535
3191
  * @returns {Promise}
3536
3192
  */
3537
3193
  updatePrefs(teamId, prefs) {
3538
- return __awaiter(this, void 0, void 0, function* () {
3539
- if (typeof teamId === 'undefined') {
3540
- throw new AppwriteException('Missing required parameter: "teamId"');
3541
- }
3542
- if (typeof prefs === 'undefined') {
3543
- throw new AppwriteException('Missing required parameter: "prefs"');
3544
- }
3545
- const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
3546
- const payload = {};
3547
- if (typeof prefs !== 'undefined') {
3548
- payload['prefs'] = prefs;
3549
- }
3550
- const uri = new URL(this.client.config.endpoint + apiPath);
3551
- return yield this.client.call('put', uri, {
3552
- 'content-type': 'application/json',
3553
- }, payload);
3554
- });
3194
+ if (typeof teamId === 'undefined') {
3195
+ throw new AppwriteException('Missing required parameter: "teamId"');
3196
+ }
3197
+ if (typeof prefs === 'undefined') {
3198
+ throw new AppwriteException('Missing required parameter: "prefs"');
3199
+ }
3200
+ const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
3201
+ const payload = {};
3202
+ if (typeof prefs !== 'undefined') {
3203
+ payload['prefs'] = prefs;
3204
+ }
3205
+ const uri = new URL(this.client.config.endpoint + apiPath);
3206
+ return this.client.call('put', uri, {
3207
+ 'content-type': 'application/json',
3208
+ }, payload);
3555
3209
  }
3556
3210
  }
3557
3211
 
@@ -3718,7 +3372,7 @@ class ID {
3718
3372
  }
3719
3373
  static unique(padding = 7) {
3720
3374
  // Generate a unique ID with padding to have a longer ID
3721
- const baseId = __classPrivateFieldGet(ID, _a, "m", _ID_hexTimestamp).call(ID);
3375
+ const baseId = __classPrivateFieldGet(_a, _a, "m", _ID_hexTimestamp).call(_a);
3722
3376
  let randomPadding = '';
3723
3377
  for (let i = 0; i < padding; i++) {
3724
3378
  const randomHexDigit = Math.floor(Math.random() * 16).toString(16);
@@ -3828,6 +3482,7 @@ exports.CreditCard = void 0;
3828
3482
  CreditCard["Visa"] = "visa";
3829
3483
  CreditCard["MIR"] = "mir";
3830
3484
  CreditCard["Maestro"] = "maestro";
3485
+ CreditCard["Rupay"] = "rupay";
3831
3486
  })(exports.CreditCard || (exports.CreditCard = {}));
3832
3487
 
3833
3488
  exports.Flag = void 0;