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