react-native-appwrite 0.7.0 → 0.7.1

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