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