react-native-appwrite 0.10.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/README.md +84 -3
- package/dist/cjs/sdk.js +1810 -1113
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1810 -1114
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-email-password-session.md +4 -4
- package/docs/examples/account/create-email-token.md +5 -5
- package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
- package/docs/examples/account/create-mfa-authenticator.md +3 -3
- package/docs/examples/account/create-mfa-challenge.md +3 -3
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
- package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
- package/docs/examples/account/create-phone-token.md +4 -4
- package/docs/examples/account/create-push-target.md +5 -5
- package/docs/examples/account/create-recovery.md +4 -4
- package/docs/examples/account/create-session.md +4 -4
- package/docs/examples/account/create-verification.md +3 -3
- package/docs/examples/account/create.md +6 -6
- package/docs/examples/account/delete-identity.md +3 -3
- package/docs/examples/account/delete-mfa-authenticator.md +3 -3
- package/docs/examples/account/delete-push-target.md +3 -3
- package/docs/examples/account/delete-session.md +3 -3
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-session.md +3 -3
- package/docs/examples/account/list-identities.md +3 -3
- package/docs/examples/account/list-logs.md +3 -3
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/update-email.md +4 -4
- package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
- package/docs/examples/account/update-mfa-authenticator.md +4 -4
- package/docs/examples/account/update-mfa-challenge.md +4 -4
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
- package/docs/examples/account/update-name.md +3 -3
- package/docs/examples/account/update-password.md +4 -4
- package/docs/examples/account/update-phone-session.md +4 -4
- package/docs/examples/account/update-phone-verification.md +4 -4
- package/docs/examples/account/update-phone.md +4 -4
- package/docs/examples/account/update-prefs.md +3 -3
- package/docs/examples/account/update-push-target.md +4 -4
- package/docs/examples/account/update-recovery.md +5 -5
- package/docs/examples/account/update-session.md +3 -3
- package/docs/examples/account/update-verification.md +4 -4
- package/docs/examples/avatars/get-browser.md +6 -6
- package/docs/examples/avatars/get-credit-card.md +6 -6
- package/docs/examples/avatars/get-favicon.md +3 -3
- package/docs/examples/avatars/get-flag.md +6 -6
- package/docs/examples/avatars/get-image.md +5 -5
- package/docs/examples/avatars/get-initials.md +6 -6
- package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
- package/docs/examples/databases/create-document.md +8 -10
- package/docs/examples/databases/decrement-document-attribute.md +18 -0
- package/docs/examples/databases/delete-document.md +5 -5
- package/docs/examples/databases/get-document.md +6 -6
- package/docs/examples/databases/increment-document-attribute.md +18 -0
- package/docs/examples/databases/list-documents.md +5 -5
- package/docs/examples/databases/update-document.md +7 -7
- package/docs/examples/databases/upsert-document.md +7 -7
- package/docs/examples/functions/create-execution.md +9 -9
- package/docs/examples/functions/get-execution.md +4 -4
- package/docs/examples/functions/list-executions.md +4 -4
- package/docs/examples/graphql/mutation.md +3 -3
- package/docs/examples/graphql/query.md +3 -3
- package/docs/examples/messaging/create-subscriber.md +5 -5
- package/docs/examples/messaging/delete-subscriber.md +4 -4
- package/docs/examples/storage/create-file.md +6 -6
- package/docs/examples/storage/delete-file.md +4 -4
- package/docs/examples/storage/get-file-download.md +5 -5
- package/docs/examples/storage/get-file-preview.md +16 -16
- package/docs/examples/storage/get-file-view.md +5 -5
- package/docs/examples/storage/get-file.md +4 -4
- package/docs/examples/storage/list-files.md +5 -5
- package/docs/examples/storage/update-file.md +6 -6
- package/docs/examples/tablesdb/create-row.md +17 -0
- package/docs/examples/tablesdb/decrement-row-column.md +18 -0
- package/docs/examples/tablesdb/delete-row.md +15 -0
- package/docs/examples/tablesdb/get-row.md +16 -0
- package/docs/examples/tablesdb/increment-row-column.md +18 -0
- package/docs/examples/tablesdb/list-rows.md +15 -0
- package/docs/examples/tablesdb/update-row.md +17 -0
- package/docs/examples/tablesdb/upsert-row.md +17 -0
- package/docs/examples/teams/create-membership.md +9 -9
- package/docs/examples/teams/create.md +5 -5
- package/docs/examples/teams/delete-membership.md +4 -4
- package/docs/examples/teams/delete.md +3 -3
- package/docs/examples/teams/get-membership.md +4 -4
- package/docs/examples/teams/get-prefs.md +3 -3
- package/docs/examples/teams/get.md +3 -3
- package/docs/examples/teams/list-memberships.md +5 -5
- package/docs/examples/teams/list.md +4 -4
- package/docs/examples/teams/update-membership-status.md +6 -6
- package/docs/examples/teams/update-membership.md +5 -5
- package/docs/examples/teams/update-name.md +4 -4
- package/docs/examples/teams/update-prefs.md +4 -4
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/index.ts +1 -0
- package/src/models.ts +139 -21
- package/src/query.ts +95 -0
- package/src/services/account.ts +1518 -364
- package/src/services/avatars.ts +296 -87
- package/src/services/databases.ts +438 -55
- package/src/services/functions.ts +118 -23
- package/src/services/graphql.ts +54 -6
- package/src/services/locale.ts +16 -27
- package/src/services/messaging.ts +68 -9
- package/src/services/storage.ts +353 -84
- package/src/services/tables-db.ts +621 -0
- package/src/services/teams.ts +467 -106
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +127 -62
- package/types/query.d.ts +77 -0
- package/types/services/account.d.ts +791 -337
- package/types/services/avatars.d.ts +175 -80
- package/types/services/databases.d.ts +220 -53
- package/types/services/functions.d.ts +65 -20
- package/types/services/graphql.d.ts +26 -4
- package/types/services/locale.d.ts +16 -27
- package/types/services/messaging.d.ts +35 -7
- package/types/services/storage.d.ts +209 -76
- package/types/services/tables-db.d.ts +245 -0
- package/types/services/teams.d.ts +261 -99
- /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
- /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
package/dist/cjs/sdk.js
CHANGED
|
@@ -100,8 +100,8 @@ class Client {
|
|
|
100
100
|
'x-sdk-name': 'React Native',
|
|
101
101
|
'x-sdk-platform': 'client',
|
|
102
102
|
'x-sdk-language': 'reactnative',
|
|
103
|
-
'x-sdk-version': '0.
|
|
104
|
-
'X-Appwrite-Response-Format': '1.
|
|
103
|
+
'x-sdk-version': '0.12.0',
|
|
104
|
+
'X-Appwrite-Response-Format': '1.8.0',
|
|
105
105
|
};
|
|
106
106
|
this.realtime = {
|
|
107
107
|
socket: undefined,
|
|
@@ -485,30 +485,30 @@ class Account extends Service {
|
|
|
485
485
|
*
|
|
486
486
|
* @throws {AppwriteException}
|
|
487
487
|
* @returns {Promise}
|
|
488
|
-
|
|
488
|
+
*/
|
|
489
489
|
get() {
|
|
490
490
|
const apiPath = '/account';
|
|
491
491
|
const payload = {};
|
|
492
492
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
493
493
|
return this.client.call('get', uri, {}, payload);
|
|
494
494
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
495
|
+
create(paramsOrFirst, ...rest) {
|
|
496
|
+
let params;
|
|
497
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
498
|
+
params = (paramsOrFirst || {});
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
params = {
|
|
502
|
+
userId: paramsOrFirst,
|
|
503
|
+
email: rest[0],
|
|
504
|
+
password: rest[1],
|
|
505
|
+
name: rest[2]
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
const userId = params.userId;
|
|
509
|
+
const email = params.email;
|
|
510
|
+
const password = params.password;
|
|
511
|
+
const name = params.name;
|
|
512
512
|
if (typeof userId === 'undefined') {
|
|
513
513
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
514
514
|
}
|
|
@@ -537,22 +537,19 @@ class Account extends Service {
|
|
|
537
537
|
'content-type': 'application/json',
|
|
538
538
|
}, payload);
|
|
539
539
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
* @returns {Promise}
|
|
554
|
-
*/
|
|
555
|
-
updateEmail(email, password) {
|
|
540
|
+
updateEmail(paramsOrFirst, ...rest) {
|
|
541
|
+
let params;
|
|
542
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
543
|
+
params = (paramsOrFirst || {});
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
params = {
|
|
547
|
+
email: paramsOrFirst,
|
|
548
|
+
password: rest[0]
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
const email = params.email;
|
|
552
|
+
const password = params.password;
|
|
556
553
|
if (typeof email === 'undefined') {
|
|
557
554
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
558
555
|
}
|
|
@@ -572,14 +569,17 @@ class Account extends Service {
|
|
|
572
569
|
'content-type': 'application/json',
|
|
573
570
|
}, payload);
|
|
574
571
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
572
|
+
listIdentities(paramsOrFirst) {
|
|
573
|
+
let params;
|
|
574
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
575
|
+
params = (paramsOrFirst || {});
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
params = {
|
|
579
|
+
queries: paramsOrFirst
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
const queries = params.queries;
|
|
583
583
|
const apiPath = '/account/identities';
|
|
584
584
|
const payload = {};
|
|
585
585
|
if (typeof queries !== 'undefined') {
|
|
@@ -588,14 +588,17 @@ class Account extends Service {
|
|
|
588
588
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
589
589
|
return this.client.call('get', uri, {}, payload);
|
|
590
590
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
591
|
+
deleteIdentity(paramsOrFirst) {
|
|
592
|
+
let params;
|
|
593
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
594
|
+
params = (paramsOrFirst || {});
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
params = {
|
|
598
|
+
identityId: paramsOrFirst
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
const identityId = params.identityId;
|
|
599
602
|
if (typeof identityId === 'undefined') {
|
|
600
603
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
601
604
|
}
|
|
@@ -607,15 +610,11 @@ class Account extends Service {
|
|
|
607
610
|
}, payload);
|
|
608
611
|
}
|
|
609
612
|
/**
|
|
610
|
-
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT
|
|
611
|
-
* to authenticate on behalf of the current user when working with the
|
|
612
|
-
* Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
|
|
613
|
-
* from its creation and will be invalid if the user will logout in that time
|
|
614
|
-
* frame.
|
|
613
|
+
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
|
|
615
614
|
*
|
|
616
615
|
* @throws {AppwriteException}
|
|
617
616
|
* @returns {Promise}
|
|
618
|
-
|
|
617
|
+
*/
|
|
619
618
|
createJWT() {
|
|
620
619
|
const apiPath = '/account/jwts';
|
|
621
620
|
const payload = {};
|
|
@@ -624,15 +623,17 @@ class Account extends Service {
|
|
|
624
623
|
'content-type': 'application/json',
|
|
625
624
|
}, payload);
|
|
626
625
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
626
|
+
listLogs(paramsOrFirst) {
|
|
627
|
+
let params;
|
|
628
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
629
|
+
params = (paramsOrFirst || {});
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
params = {
|
|
633
|
+
queries: paramsOrFirst
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
const queries = params.queries;
|
|
636
637
|
const apiPath = '/account/logs';
|
|
637
638
|
const payload = {};
|
|
638
639
|
if (typeof queries !== 'undefined') {
|
|
@@ -641,14 +642,17 @@ class Account extends Service {
|
|
|
641
642
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
642
643
|
return this.client.call('get', uri, {}, payload);
|
|
643
644
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
645
|
+
updateMFA(paramsOrFirst) {
|
|
646
|
+
let params;
|
|
647
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
648
|
+
params = (paramsOrFirst || {});
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
params = {
|
|
652
|
+
mfa: paramsOrFirst
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
const mfa = params.mfa;
|
|
652
656
|
if (typeof mfa === 'undefined') {
|
|
653
657
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
654
658
|
}
|
|
@@ -662,17 +666,17 @@ class Account extends Service {
|
|
|
662
666
|
'content-type': 'application/json',
|
|
663
667
|
}, payload);
|
|
664
668
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
669
|
+
createMfaAuthenticator(paramsOrFirst) {
|
|
670
|
+
let params;
|
|
671
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
672
|
+
params = (paramsOrFirst || {});
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
params = {
|
|
676
|
+
type: paramsOrFirst
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
const type = params.type;
|
|
676
680
|
if (typeof type === 'undefined') {
|
|
677
681
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
678
682
|
}
|
|
@@ -683,17 +687,40 @@ class Account extends Service {
|
|
|
683
687
|
'content-type': 'application/json',
|
|
684
688
|
}, payload);
|
|
685
689
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
690
|
+
createMFAAuthenticator(paramsOrFirst) {
|
|
691
|
+
let params;
|
|
692
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
693
|
+
params = (paramsOrFirst || {});
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
params = {
|
|
697
|
+
type: paramsOrFirst
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
const type = params.type;
|
|
701
|
+
if (typeof type === 'undefined') {
|
|
702
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
703
|
+
}
|
|
704
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
705
|
+
const payload = {};
|
|
706
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
707
|
+
return this.client.call('post', uri, {
|
|
708
|
+
'content-type': 'application/json',
|
|
709
|
+
}, payload);
|
|
710
|
+
}
|
|
711
|
+
updateMfaAuthenticator(paramsOrFirst, ...rest) {
|
|
712
|
+
let params;
|
|
713
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
714
|
+
params = (paramsOrFirst || {});
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
params = {
|
|
718
|
+
type: paramsOrFirst,
|
|
719
|
+
otp: rest[0]
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
const type = params.type;
|
|
723
|
+
const otp = params.otp;
|
|
697
724
|
if (typeof type === 'undefined') {
|
|
698
725
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
699
726
|
}
|
|
@@ -710,14 +737,46 @@ class Account extends Service {
|
|
|
710
737
|
'content-type': 'application/json',
|
|
711
738
|
}, payload);
|
|
712
739
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
740
|
+
updateMFAAuthenticator(paramsOrFirst, ...rest) {
|
|
741
|
+
let params;
|
|
742
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
743
|
+
params = (paramsOrFirst || {});
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
params = {
|
|
747
|
+
type: paramsOrFirst,
|
|
748
|
+
otp: rest[0]
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
const type = params.type;
|
|
752
|
+
const otp = params.otp;
|
|
753
|
+
if (typeof type === 'undefined') {
|
|
754
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
755
|
+
}
|
|
756
|
+
if (typeof otp === 'undefined') {
|
|
757
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
758
|
+
}
|
|
759
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
760
|
+
const payload = {};
|
|
761
|
+
if (typeof otp !== 'undefined') {
|
|
762
|
+
payload['otp'] = otp;
|
|
763
|
+
}
|
|
764
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
765
|
+
return this.client.call('put', uri, {
|
|
766
|
+
'content-type': 'application/json',
|
|
767
|
+
}, payload);
|
|
768
|
+
}
|
|
769
|
+
deleteMfaAuthenticator(paramsOrFirst) {
|
|
770
|
+
let params;
|
|
771
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
772
|
+
params = (paramsOrFirst || {});
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
params = {
|
|
776
|
+
type: paramsOrFirst
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
const type = params.type;
|
|
721
780
|
if (typeof type === 'undefined') {
|
|
722
781
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
723
782
|
}
|
|
@@ -728,16 +787,38 @@ class Account extends Service {
|
|
|
728
787
|
'content-type': 'application/json',
|
|
729
788
|
}, payload);
|
|
730
789
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
790
|
+
deleteMFAAuthenticator(paramsOrFirst) {
|
|
791
|
+
let params;
|
|
792
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
793
|
+
params = (paramsOrFirst || {});
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
params = {
|
|
797
|
+
type: paramsOrFirst
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
const type = params.type;
|
|
801
|
+
if (typeof type === 'undefined') {
|
|
802
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
803
|
+
}
|
|
804
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
805
|
+
const payload = {};
|
|
806
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
807
|
+
return this.client.call('delete', uri, {
|
|
808
|
+
'content-type': 'application/json',
|
|
809
|
+
}, payload);
|
|
810
|
+
}
|
|
811
|
+
createMfaChallenge(paramsOrFirst) {
|
|
812
|
+
let params;
|
|
813
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
814
|
+
params = (paramsOrFirst || {});
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
params = {
|
|
818
|
+
factor: paramsOrFirst
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
const factor = params.factor;
|
|
741
822
|
if (typeof factor === 'undefined') {
|
|
742
823
|
throw new AppwriteException('Missing required parameter: "factor"');
|
|
743
824
|
}
|
|
@@ -751,19 +832,75 @@ class Account extends Service {
|
|
|
751
832
|
'content-type': 'application/json',
|
|
752
833
|
}, payload);
|
|
753
834
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
835
|
+
createMFAChallenge(paramsOrFirst) {
|
|
836
|
+
let params;
|
|
837
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
838
|
+
params = (paramsOrFirst || {});
|
|
839
|
+
}
|
|
840
|
+
else {
|
|
841
|
+
params = {
|
|
842
|
+
factor: paramsOrFirst
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
const factor = params.factor;
|
|
846
|
+
if (typeof factor === 'undefined') {
|
|
847
|
+
throw new AppwriteException('Missing required parameter: "factor"');
|
|
848
|
+
}
|
|
849
|
+
const apiPath = '/account/mfa/challenge';
|
|
850
|
+
const payload = {};
|
|
851
|
+
if (typeof factor !== 'undefined') {
|
|
852
|
+
payload['factor'] = factor;
|
|
853
|
+
}
|
|
854
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
855
|
+
return this.client.call('post', uri, {
|
|
856
|
+
'content-type': 'application/json',
|
|
857
|
+
}, payload);
|
|
858
|
+
}
|
|
859
|
+
updateMfaChallenge(paramsOrFirst, ...rest) {
|
|
860
|
+
let params;
|
|
861
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
862
|
+
params = (paramsOrFirst || {});
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
params = {
|
|
866
|
+
challengeId: paramsOrFirst,
|
|
867
|
+
otp: rest[0]
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
const challengeId = params.challengeId;
|
|
871
|
+
const otp = params.otp;
|
|
872
|
+
if (typeof challengeId === 'undefined') {
|
|
873
|
+
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
874
|
+
}
|
|
875
|
+
if (typeof otp === 'undefined') {
|
|
876
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
877
|
+
}
|
|
878
|
+
const apiPath = '/account/mfa/challenge';
|
|
879
|
+
const payload = {};
|
|
880
|
+
if (typeof challengeId !== 'undefined') {
|
|
881
|
+
payload['challengeId'] = challengeId;
|
|
882
|
+
}
|
|
883
|
+
if (typeof otp !== 'undefined') {
|
|
884
|
+
payload['otp'] = otp;
|
|
885
|
+
}
|
|
886
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
887
|
+
return this.client.call('put', uri, {
|
|
888
|
+
'content-type': 'application/json',
|
|
889
|
+
}, payload);
|
|
890
|
+
}
|
|
891
|
+
updateMFAChallenge(paramsOrFirst, ...rest) {
|
|
892
|
+
let params;
|
|
893
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
894
|
+
params = (paramsOrFirst || {});
|
|
895
|
+
}
|
|
896
|
+
else {
|
|
897
|
+
params = {
|
|
898
|
+
challengeId: paramsOrFirst,
|
|
899
|
+
otp: rest[0]
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
const challengeId = params.challengeId;
|
|
903
|
+
const otp = params.otp;
|
|
767
904
|
if (typeof challengeId === 'undefined') {
|
|
768
905
|
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
769
906
|
}
|
|
@@ -788,7 +925,8 @@ class Account extends Service {
|
|
|
788
925
|
*
|
|
789
926
|
* @throws {AppwriteException}
|
|
790
927
|
* @returns {Promise}
|
|
791
|
-
|
|
928
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
|
|
929
|
+
*/
|
|
792
930
|
listMfaFactors() {
|
|
793
931
|
const apiPath = '/account/mfa/factors';
|
|
794
932
|
const payload = {};
|
|
@@ -796,14 +934,24 @@ class Account extends Service {
|
|
|
796
934
|
return this.client.call('get', uri, {}, payload);
|
|
797
935
|
}
|
|
798
936
|
/**
|
|
799
|
-
*
|
|
800
|
-
* codes, they must be generated using
|
|
801
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
802
|
-
* method. An OTP challenge is required to read recovery codes.
|
|
937
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
803
938
|
*
|
|
804
939
|
* @throws {AppwriteException}
|
|
805
940
|
* @returns {Promise}
|
|
806
|
-
|
|
941
|
+
*/
|
|
942
|
+
listMFAFactors() {
|
|
943
|
+
const apiPath = '/account/mfa/factors';
|
|
944
|
+
const payload = {};
|
|
945
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
946
|
+
return this.client.call('get', uri, {}, payload);
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
|
|
950
|
+
*
|
|
951
|
+
* @throws {AppwriteException}
|
|
952
|
+
* @returns {Promise}
|
|
953
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
|
|
954
|
+
*/
|
|
807
955
|
getMfaRecoveryCodes() {
|
|
808
956
|
const apiPath = '/account/mfa/recovery-codes';
|
|
809
957
|
const payload = {};
|
|
@@ -811,15 +959,24 @@ class Account extends Service {
|
|
|
811
959
|
return this.client.call('get', uri, {}, payload);
|
|
812
960
|
}
|
|
813
961
|
/**
|
|
814
|
-
*
|
|
815
|
-
* generate and show then immediately after user successfully adds their
|
|
816
|
-
* authehticator. Recovery codes can be used as a MFA verification type in
|
|
817
|
-
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
818
|
-
* method.
|
|
962
|
+
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
|
|
819
963
|
*
|
|
820
964
|
* @throws {AppwriteException}
|
|
821
965
|
* @returns {Promise}
|
|
822
|
-
|
|
966
|
+
*/
|
|
967
|
+
getMFARecoveryCodes() {
|
|
968
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
969
|
+
const payload = {};
|
|
970
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
971
|
+
return this.client.call('get', uri, {}, payload);
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
975
|
+
*
|
|
976
|
+
* @throws {AppwriteException}
|
|
977
|
+
* @returns {Promise}
|
|
978
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
|
|
979
|
+
*/
|
|
823
980
|
createMfaRecoveryCodes() {
|
|
824
981
|
const apiPath = '/account/mfa/recovery-codes';
|
|
825
982
|
const payload = {};
|
|
@@ -829,14 +986,26 @@ class Account extends Service {
|
|
|
829
986
|
}, payload);
|
|
830
987
|
}
|
|
831
988
|
/**
|
|
832
|
-
*
|
|
833
|
-
* regenerating codes, they must be first generated using
|
|
834
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
835
|
-
* method. An OTP challenge is required to regenreate recovery codes.
|
|
989
|
+
* Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
836
990
|
*
|
|
837
991
|
* @throws {AppwriteException}
|
|
838
992
|
* @returns {Promise}
|
|
839
|
-
|
|
993
|
+
*/
|
|
994
|
+
createMFARecoveryCodes() {
|
|
995
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
996
|
+
const payload = {};
|
|
997
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
998
|
+
return this.client.call('post', uri, {
|
|
999
|
+
'content-type': 'application/json',
|
|
1000
|
+
}, payload);
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
|
|
1004
|
+
*
|
|
1005
|
+
* @throws {AppwriteException}
|
|
1006
|
+
* @returns {Promise}
|
|
1007
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
|
|
1008
|
+
*/
|
|
840
1009
|
updateMfaRecoveryCodes() {
|
|
841
1010
|
const apiPath = '/account/mfa/recovery-codes';
|
|
842
1011
|
const payload = {};
|
|
@@ -846,13 +1015,30 @@ class Account extends Service {
|
|
|
846
1015
|
}, payload);
|
|
847
1016
|
}
|
|
848
1017
|
/**
|
|
849
|
-
*
|
|
1018
|
+
* Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
|
|
850
1019
|
*
|
|
851
|
-
* @param {string} name
|
|
852
1020
|
* @throws {AppwriteException}
|
|
853
1021
|
* @returns {Promise}
|
|
854
|
-
|
|
855
|
-
|
|
1022
|
+
*/
|
|
1023
|
+
updateMFARecoveryCodes() {
|
|
1024
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
1025
|
+
const payload = {};
|
|
1026
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1027
|
+
return this.client.call('patch', uri, {
|
|
1028
|
+
'content-type': 'application/json',
|
|
1029
|
+
}, payload);
|
|
1030
|
+
}
|
|
1031
|
+
updateName(paramsOrFirst) {
|
|
1032
|
+
let params;
|
|
1033
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1034
|
+
params = (paramsOrFirst || {});
|
|
1035
|
+
}
|
|
1036
|
+
else {
|
|
1037
|
+
params = {
|
|
1038
|
+
name: paramsOrFirst
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
const name = params.name;
|
|
856
1042
|
if (typeof name === 'undefined') {
|
|
857
1043
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
858
1044
|
}
|
|
@@ -866,17 +1052,19 @@ class Account extends Service {
|
|
|
866
1052
|
'content-type': 'application/json',
|
|
867
1053
|
}, payload);
|
|
868
1054
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1055
|
+
updatePassword(paramsOrFirst, ...rest) {
|
|
1056
|
+
let params;
|
|
1057
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1058
|
+
params = (paramsOrFirst || {});
|
|
1059
|
+
}
|
|
1060
|
+
else {
|
|
1061
|
+
params = {
|
|
1062
|
+
password: paramsOrFirst,
|
|
1063
|
+
oldPassword: rest[0]
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
const password = params.password;
|
|
1067
|
+
const oldPassword = params.oldPassword;
|
|
880
1068
|
if (typeof password === 'undefined') {
|
|
881
1069
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
882
1070
|
}
|
|
@@ -893,19 +1081,19 @@ class Account extends Service {
|
|
|
893
1081
|
'content-type': 'application/json',
|
|
894
1082
|
}, payload);
|
|
895
1083
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
1084
|
+
updatePhone(paramsOrFirst, ...rest) {
|
|
1085
|
+
let params;
|
|
1086
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1087
|
+
params = (paramsOrFirst || {});
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
params = {
|
|
1091
|
+
phone: paramsOrFirst,
|
|
1092
|
+
password: rest[0]
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
const phone = params.phone;
|
|
1096
|
+
const password = params.password;
|
|
909
1097
|
if (typeof phone === 'undefined') {
|
|
910
1098
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
911
1099
|
}
|
|
@@ -930,23 +1118,24 @@ class Account extends Service {
|
|
|
930
1118
|
*
|
|
931
1119
|
* @throws {AppwriteException}
|
|
932
1120
|
* @returns {Promise}
|
|
933
|
-
|
|
1121
|
+
*/
|
|
934
1122
|
getPrefs() {
|
|
935
1123
|
const apiPath = '/account/prefs';
|
|
936
1124
|
const payload = {};
|
|
937
1125
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
938
1126
|
return this.client.call('get', uri, {}, payload);
|
|
939
1127
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1128
|
+
updatePrefs(paramsOrFirst) {
|
|
1129
|
+
let params;
|
|
1130
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst)) {
|
|
1131
|
+
params = (paramsOrFirst || {});
|
|
1132
|
+
}
|
|
1133
|
+
else {
|
|
1134
|
+
params = {
|
|
1135
|
+
prefs: paramsOrFirst
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
const prefs = params.prefs;
|
|
950
1139
|
if (typeof prefs === 'undefined') {
|
|
951
1140
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
952
1141
|
}
|
|
@@ -960,22 +1149,19 @@ class Account extends Service {
|
|
|
960
1149
|
'content-type': 'application/json',
|
|
961
1150
|
}, payload);
|
|
962
1151
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
* @returns {Promise}
|
|
977
|
-
*/
|
|
978
|
-
createRecovery(email, url) {
|
|
1152
|
+
createRecovery(paramsOrFirst, ...rest) {
|
|
1153
|
+
let params;
|
|
1154
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1155
|
+
params = (paramsOrFirst || {});
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
params = {
|
|
1159
|
+
email: paramsOrFirst,
|
|
1160
|
+
url: rest[0]
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
const email = params.email;
|
|
1164
|
+
const url = params.url;
|
|
979
1165
|
if (typeof email === 'undefined') {
|
|
980
1166
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
981
1167
|
}
|
|
@@ -995,25 +1181,21 @@ class Account extends Service {
|
|
|
995
1181
|
'content-type': 'application/json',
|
|
996
1182
|
}, payload);
|
|
997
1183
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
* @throws {AppwriteException}
|
|
1014
|
-
* @returns {Promise}
|
|
1015
|
-
*/
|
|
1016
|
-
updateRecovery(userId, secret, password) {
|
|
1184
|
+
updateRecovery(paramsOrFirst, ...rest) {
|
|
1185
|
+
let params;
|
|
1186
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1187
|
+
params = (paramsOrFirst || {});
|
|
1188
|
+
}
|
|
1189
|
+
else {
|
|
1190
|
+
params = {
|
|
1191
|
+
userId: paramsOrFirst,
|
|
1192
|
+
secret: rest[0],
|
|
1193
|
+
password: rest[1]
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
const userId = params.userId;
|
|
1197
|
+
const secret = params.secret;
|
|
1198
|
+
const password = params.password;
|
|
1017
1199
|
if (typeof userId === 'undefined') {
|
|
1018
1200
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1019
1201
|
}
|
|
@@ -1040,12 +1222,11 @@ class Account extends Service {
|
|
|
1040
1222
|
}, payload);
|
|
1041
1223
|
}
|
|
1042
1224
|
/**
|
|
1043
|
-
* Get the list of active sessions across different devices for the currently
|
|
1044
|
-
* logged in user.
|
|
1225
|
+
* Get the list of active sessions across different devices for the currently logged in user.
|
|
1045
1226
|
*
|
|
1046
1227
|
* @throws {AppwriteException}
|
|
1047
1228
|
* @returns {Promise}
|
|
1048
|
-
|
|
1229
|
+
*/
|
|
1049
1230
|
listSessions() {
|
|
1050
1231
|
const apiPath = '/account/sessions';
|
|
1051
1232
|
const payload = {};
|
|
@@ -1053,12 +1234,11 @@ class Account extends Service {
|
|
|
1053
1234
|
return this.client.call('get', uri, {}, payload);
|
|
1054
1235
|
}
|
|
1055
1236
|
/**
|
|
1056
|
-
* Delete all sessions from the user account and remove any sessions cookies
|
|
1057
|
-
* from the end client.
|
|
1237
|
+
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
|
1058
1238
|
*
|
|
1059
1239
|
* @throws {AppwriteException}
|
|
1060
1240
|
* @returns {Promise}
|
|
1061
|
-
|
|
1241
|
+
*/
|
|
1062
1242
|
deleteSessions() {
|
|
1063
1243
|
const apiPath = '/account/sessions';
|
|
1064
1244
|
const payload = {};
|
|
@@ -1068,17 +1248,11 @@ class Account extends Service {
|
|
|
1068
1248
|
}, payload);
|
|
1069
1249
|
}
|
|
1070
1250
|
/**
|
|
1071
|
-
* Use this endpoint to allow a new user to register an anonymous account in
|
|
1072
|
-
* your project. This route will also create a new session for the user. To
|
|
1073
|
-
* allow the new user to convert an anonymous account to a normal account, you
|
|
1074
|
-
* need to update its [email and
|
|
1075
|
-
* password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
|
|
1076
|
-
* or create an [OAuth2
|
|
1077
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
1251
|
+
* Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
1078
1252
|
*
|
|
1079
1253
|
* @throws {AppwriteException}
|
|
1080
1254
|
* @returns {Promise}
|
|
1081
|
-
|
|
1255
|
+
*/
|
|
1082
1256
|
createAnonymousSession() {
|
|
1083
1257
|
const apiPath = '/account/sessions/anonymous';
|
|
1084
1258
|
const payload = {};
|
|
@@ -1087,20 +1261,19 @@ class Account extends Service {
|
|
|
1087
1261
|
'content-type': 'application/json',
|
|
1088
1262
|
}, payload);
|
|
1089
1263
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
createEmailPasswordSession(email, password) {
|
|
1264
|
+
createEmailPasswordSession(paramsOrFirst, ...rest) {
|
|
1265
|
+
let params;
|
|
1266
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1267
|
+
params = (paramsOrFirst || {});
|
|
1268
|
+
}
|
|
1269
|
+
else {
|
|
1270
|
+
params = {
|
|
1271
|
+
email: paramsOrFirst,
|
|
1272
|
+
password: rest[0]
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
const email = params.email;
|
|
1276
|
+
const password = params.password;
|
|
1104
1277
|
if (typeof email === 'undefined') {
|
|
1105
1278
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1106
1279
|
}
|
|
@@ -1120,17 +1293,19 @@ class Account extends Service {
|
|
|
1120
1293
|
'content-type': 'application/json',
|
|
1121
1294
|
}, payload);
|
|
1122
1295
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1296
|
+
updateMagicURLSession(paramsOrFirst, ...rest) {
|
|
1297
|
+
let params;
|
|
1298
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1299
|
+
params = (paramsOrFirst || {});
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
params = {
|
|
1303
|
+
userId: paramsOrFirst,
|
|
1304
|
+
secret: rest[0]
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
const userId = params.userId;
|
|
1308
|
+
const secret = params.secret;
|
|
1134
1309
|
if (typeof userId === 'undefined') {
|
|
1135
1310
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1136
1311
|
}
|
|
@@ -1150,32 +1325,23 @@ class Account extends Service {
|
|
|
1150
1325
|
'content-type': 'application/json',
|
|
1151
1326
|
}, payload);
|
|
1152
1327
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
*
|
|
1171
|
-
* @param {OAuthProvider} provider
|
|
1172
|
-
* @param {string} success
|
|
1173
|
-
* @param {string} failure
|
|
1174
|
-
* @param {string[]} scopes
|
|
1175
|
-
* @throws {AppwriteException}
|
|
1176
|
-
* @returns {void|string}
|
|
1177
|
-
*/
|
|
1178
|
-
createOAuth2Session(provider, success, failure, scopes) {
|
|
1328
|
+
createOAuth2Session(paramsOrFirst, ...rest) {
|
|
1329
|
+
let params;
|
|
1330
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
1331
|
+
params = (paramsOrFirst || {});
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
params = {
|
|
1335
|
+
provider: paramsOrFirst,
|
|
1336
|
+
success: rest[0],
|
|
1337
|
+
failure: rest[1],
|
|
1338
|
+
scopes: rest[2]
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
const provider = params.provider;
|
|
1342
|
+
const success = params.success;
|
|
1343
|
+
const failure = params.failure;
|
|
1344
|
+
const scopes = params.scopes;
|
|
1179
1345
|
if (typeof provider === 'undefined') {
|
|
1180
1346
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1181
1347
|
}
|
|
@@ -1197,17 +1363,19 @@ class Account extends Service {
|
|
|
1197
1363
|
}
|
|
1198
1364
|
return uri;
|
|
1199
1365
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1366
|
+
updatePhoneSession(paramsOrFirst, ...rest) {
|
|
1367
|
+
let params;
|
|
1368
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1369
|
+
params = (paramsOrFirst || {});
|
|
1370
|
+
}
|
|
1371
|
+
else {
|
|
1372
|
+
params = {
|
|
1373
|
+
userId: paramsOrFirst,
|
|
1374
|
+
secret: rest[0]
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
const userId = params.userId;
|
|
1378
|
+
const secret = params.secret;
|
|
1211
1379
|
if (typeof userId === 'undefined') {
|
|
1212
1380
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1213
1381
|
}
|
|
@@ -1227,17 +1395,19 @@ class Account extends Service {
|
|
|
1227
1395
|
'content-type': 'application/json',
|
|
1228
1396
|
}, payload);
|
|
1229
1397
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1398
|
+
createSession(paramsOrFirst, ...rest) {
|
|
1399
|
+
let params;
|
|
1400
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1401
|
+
params = (paramsOrFirst || {});
|
|
1402
|
+
}
|
|
1403
|
+
else {
|
|
1404
|
+
params = {
|
|
1405
|
+
userId: paramsOrFirst,
|
|
1406
|
+
secret: rest[0]
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
const userId = params.userId;
|
|
1410
|
+
const secret = params.secret;
|
|
1241
1411
|
if (typeof userId === 'undefined') {
|
|
1242
1412
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1243
1413
|
}
|
|
@@ -1257,15 +1427,17 @@ class Account extends Service {
|
|
|
1257
1427
|
'content-type': 'application/json',
|
|
1258
1428
|
}, payload);
|
|
1259
1429
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1430
|
+
getSession(paramsOrFirst) {
|
|
1431
|
+
let params;
|
|
1432
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1433
|
+
params = (paramsOrFirst || {});
|
|
1434
|
+
}
|
|
1435
|
+
else {
|
|
1436
|
+
params = {
|
|
1437
|
+
sessionId: paramsOrFirst
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
const sessionId = params.sessionId;
|
|
1269
1441
|
if (typeof sessionId === 'undefined') {
|
|
1270
1442
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1271
1443
|
}
|
|
@@ -1274,16 +1446,17 @@ class Account extends Service {
|
|
|
1274
1446
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1275
1447
|
return this.client.call('get', uri, {}, payload);
|
|
1276
1448
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1449
|
+
updateSession(paramsOrFirst) {
|
|
1450
|
+
let params;
|
|
1451
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1452
|
+
params = (paramsOrFirst || {});
|
|
1453
|
+
}
|
|
1454
|
+
else {
|
|
1455
|
+
params = {
|
|
1456
|
+
sessionId: paramsOrFirst
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
const sessionId = params.sessionId;
|
|
1287
1460
|
if (typeof sessionId === 'undefined') {
|
|
1288
1461
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1289
1462
|
}
|
|
@@ -1294,18 +1467,17 @@ class Account extends Service {
|
|
|
1294
1467
|
'content-type': 'application/json',
|
|
1295
1468
|
}, payload);
|
|
1296
1469
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
deleteSession(sessionId) {
|
|
1470
|
+
deleteSession(paramsOrFirst) {
|
|
1471
|
+
let params;
|
|
1472
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1473
|
+
params = (paramsOrFirst || {});
|
|
1474
|
+
}
|
|
1475
|
+
else {
|
|
1476
|
+
params = {
|
|
1477
|
+
sessionId: paramsOrFirst
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
const sessionId = params.sessionId;
|
|
1309
1481
|
if (typeof sessionId === 'undefined') {
|
|
1310
1482
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1311
1483
|
}
|
|
@@ -1317,13 +1489,11 @@ class Account extends Service {
|
|
|
1317
1489
|
}, payload);
|
|
1318
1490
|
}
|
|
1319
1491
|
/**
|
|
1320
|
-
* Block the currently logged in user account. Behind the scene, the user
|
|
1321
|
-
* record is not deleted but permanently blocked from any access. To
|
|
1322
|
-
* completely delete a user, use the Users API instead.
|
|
1492
|
+
* Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
|
|
1323
1493
|
*
|
|
1324
1494
|
* @throws {AppwriteException}
|
|
1325
1495
|
* @returns {Promise}
|
|
1326
|
-
|
|
1496
|
+
*/
|
|
1327
1497
|
updateStatus() {
|
|
1328
1498
|
const apiPath = '/account/status';
|
|
1329
1499
|
const payload = {};
|
|
@@ -1332,20 +1502,21 @@ class Account extends Service {
|
|
|
1332
1502
|
'content-type': 'application/json',
|
|
1333
1503
|
}, payload);
|
|
1334
1504
|
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1505
|
+
createPushTarget(paramsOrFirst, ...rest) {
|
|
1506
|
+
let params;
|
|
1507
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1508
|
+
params = (paramsOrFirst || {});
|
|
1509
|
+
}
|
|
1510
|
+
else {
|
|
1511
|
+
params = {
|
|
1512
|
+
targetId: paramsOrFirst,
|
|
1513
|
+
identifier: rest[0],
|
|
1514
|
+
providerId: rest[1]
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
const targetId = params.targetId;
|
|
1518
|
+
const identifier = params.identifier;
|
|
1519
|
+
const providerId = params.providerId;
|
|
1349
1520
|
if (typeof targetId === 'undefined') {
|
|
1350
1521
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1351
1522
|
}
|
|
@@ -1368,19 +1539,19 @@ class Account extends Service {
|
|
|
1368
1539
|
'content-type': 'application/json',
|
|
1369
1540
|
}, payload);
|
|
1370
1541
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1542
|
+
updatePushTarget(paramsOrFirst, ...rest) {
|
|
1543
|
+
let params;
|
|
1544
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1545
|
+
params = (paramsOrFirst || {});
|
|
1546
|
+
}
|
|
1547
|
+
else {
|
|
1548
|
+
params = {
|
|
1549
|
+
targetId: paramsOrFirst,
|
|
1550
|
+
identifier: rest[0]
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
const targetId = params.targetId;
|
|
1554
|
+
const identifier = params.identifier;
|
|
1384
1555
|
if (typeof targetId === 'undefined') {
|
|
1385
1556
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1386
1557
|
}
|
|
@@ -1397,16 +1568,17 @@ class Account extends Service {
|
|
|
1397
1568
|
'content-type': 'application/json',
|
|
1398
1569
|
}, payload);
|
|
1399
1570
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1571
|
+
deletePushTarget(paramsOrFirst) {
|
|
1572
|
+
let params;
|
|
1573
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1574
|
+
params = (paramsOrFirst || {});
|
|
1575
|
+
}
|
|
1576
|
+
else {
|
|
1577
|
+
params = {
|
|
1578
|
+
targetId: paramsOrFirst
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
const targetId = params.targetId;
|
|
1410
1582
|
if (typeof targetId === 'undefined') {
|
|
1411
1583
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1412
1584
|
}
|
|
@@ -1417,25 +1589,21 @@ class Account extends Service {
|
|
|
1417
1589
|
'content-type': 'application/json',
|
|
1418
1590
|
}, payload);
|
|
1419
1591
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
* @throws {AppwriteException}
|
|
1436
|
-
* @returns {Promise}
|
|
1437
|
-
*/
|
|
1438
|
-
createEmailToken(userId, email, phrase) {
|
|
1592
|
+
createEmailToken(paramsOrFirst, ...rest) {
|
|
1593
|
+
let params;
|
|
1594
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1595
|
+
params = (paramsOrFirst || {});
|
|
1596
|
+
}
|
|
1597
|
+
else {
|
|
1598
|
+
params = {
|
|
1599
|
+
userId: paramsOrFirst,
|
|
1600
|
+
email: rest[0],
|
|
1601
|
+
phrase: rest[1]
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
const userId = params.userId;
|
|
1605
|
+
const email = params.email;
|
|
1606
|
+
const phrase = params.phrase;
|
|
1439
1607
|
if (typeof userId === 'undefined') {
|
|
1440
1608
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1441
1609
|
}
|
|
@@ -1458,30 +1626,23 @@ class Account extends Service {
|
|
|
1458
1626
|
'content-type': 'application/json',
|
|
1459
1627
|
}, payload);
|
|
1460
1628
|
}
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
* @param {string} email
|
|
1479
|
-
* @param {string} url
|
|
1480
|
-
* @param {boolean} phrase
|
|
1481
|
-
* @throws {AppwriteException}
|
|
1482
|
-
* @returns {Promise}
|
|
1483
|
-
*/
|
|
1484
|
-
createMagicURLToken(userId, email, url, phrase) {
|
|
1629
|
+
createMagicURLToken(paramsOrFirst, ...rest) {
|
|
1630
|
+
let params;
|
|
1631
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1632
|
+
params = (paramsOrFirst || {});
|
|
1633
|
+
}
|
|
1634
|
+
else {
|
|
1635
|
+
params = {
|
|
1636
|
+
userId: paramsOrFirst,
|
|
1637
|
+
email: rest[0],
|
|
1638
|
+
url: rest[1],
|
|
1639
|
+
phrase: rest[2]
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
const userId = params.userId;
|
|
1643
|
+
const email = params.email;
|
|
1644
|
+
const url = params.url;
|
|
1645
|
+
const phrase = params.phrase;
|
|
1485
1646
|
if (typeof userId === 'undefined') {
|
|
1486
1647
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1487
1648
|
}
|
|
@@ -1507,30 +1668,23 @@ class Account extends Service {
|
|
|
1507
1668
|
'content-type': 'application/json',
|
|
1508
1669
|
}, payload);
|
|
1509
1670
|
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
* @param {string} success
|
|
1528
|
-
* @param {string} failure
|
|
1529
|
-
* @param {string[]} scopes
|
|
1530
|
-
* @throws {AppwriteException}
|
|
1531
|
-
* @returns {void|string}
|
|
1532
|
-
*/
|
|
1533
|
-
createOAuth2Token(provider, success, failure, scopes) {
|
|
1671
|
+
createOAuth2Token(paramsOrFirst, ...rest) {
|
|
1672
|
+
let params;
|
|
1673
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
1674
|
+
params = (paramsOrFirst || {});
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
params = {
|
|
1678
|
+
provider: paramsOrFirst,
|
|
1679
|
+
success: rest[0],
|
|
1680
|
+
failure: rest[1],
|
|
1681
|
+
scopes: rest[2]
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
const provider = params.provider;
|
|
1685
|
+
const success = params.success;
|
|
1686
|
+
const failure = params.failure;
|
|
1687
|
+
const scopes = params.scopes;
|
|
1534
1688
|
if (typeof provider === 'undefined') {
|
|
1535
1689
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1536
1690
|
}
|
|
@@ -1552,24 +1706,19 @@ class Account extends Service {
|
|
|
1552
1706
|
}
|
|
1553
1707
|
return uri;
|
|
1554
1708
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
* @param {string} phone
|
|
1569
|
-
* @throws {AppwriteException}
|
|
1570
|
-
* @returns {Promise}
|
|
1571
|
-
*/
|
|
1572
|
-
createPhoneToken(userId, phone) {
|
|
1709
|
+
createPhoneToken(paramsOrFirst, ...rest) {
|
|
1710
|
+
let params;
|
|
1711
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1712
|
+
params = (paramsOrFirst || {});
|
|
1713
|
+
}
|
|
1714
|
+
else {
|
|
1715
|
+
params = {
|
|
1716
|
+
userId: paramsOrFirst,
|
|
1717
|
+
phone: rest[0]
|
|
1718
|
+
};
|
|
1719
|
+
}
|
|
1720
|
+
const userId = params.userId;
|
|
1721
|
+
const phone = params.phone;
|
|
1573
1722
|
if (typeof userId === 'undefined') {
|
|
1574
1723
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1575
1724
|
}
|
|
@@ -1589,28 +1738,17 @@ class Account extends Service {
|
|
|
1589
1738
|
'content-type': 'application/json',
|
|
1590
1739
|
}, payload);
|
|
1591
1740
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
* Please note that in order to avoid a [Redirect
|
|
1604
|
-
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
|
|
1605
|
-
* the only valid redirect URLs are the ones from domains you have set when
|
|
1606
|
-
* adding your platforms in the console interface.
|
|
1607
|
-
*
|
|
1608
|
-
*
|
|
1609
|
-
* @param {string} url
|
|
1610
|
-
* @throws {AppwriteException}
|
|
1611
|
-
* @returns {Promise}
|
|
1612
|
-
*/
|
|
1613
|
-
createVerification(url) {
|
|
1741
|
+
createVerification(paramsOrFirst) {
|
|
1742
|
+
let params;
|
|
1743
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1744
|
+
params = (paramsOrFirst || {});
|
|
1745
|
+
}
|
|
1746
|
+
else {
|
|
1747
|
+
params = {
|
|
1748
|
+
url: paramsOrFirst
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
const url = params.url;
|
|
1614
1752
|
if (typeof url === 'undefined') {
|
|
1615
1753
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1616
1754
|
}
|
|
@@ -1624,18 +1762,19 @@ class Account extends Service {
|
|
|
1624
1762
|
'content-type': 'application/json',
|
|
1625
1763
|
}, payload);
|
|
1626
1764
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1765
|
+
updateVerification(paramsOrFirst, ...rest) {
|
|
1766
|
+
let params;
|
|
1767
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1768
|
+
params = (paramsOrFirst || {});
|
|
1769
|
+
}
|
|
1770
|
+
else {
|
|
1771
|
+
params = {
|
|
1772
|
+
userId: paramsOrFirst,
|
|
1773
|
+
secret: rest[0]
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
const userId = params.userId;
|
|
1777
|
+
const secret = params.secret;
|
|
1639
1778
|
if (typeof userId === 'undefined') {
|
|
1640
1779
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1641
1780
|
}
|
|
@@ -1656,18 +1795,11 @@ class Account extends Service {
|
|
|
1656
1795
|
}, payload);
|
|
1657
1796
|
}
|
|
1658
1797
|
/**
|
|
1659
|
-
* Use this endpoint to send a verification SMS to the currently logged in
|
|
1660
|
-
* user. This endpoint is meant for use after updating a user's phone number
|
|
1661
|
-
* using the
|
|
1662
|
-
* [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
|
|
1663
|
-
* endpoint. Learn more about how to [complete the verification
|
|
1664
|
-
* process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
|
|
1665
|
-
* The verification code sent to the user's phone number is valid for 15
|
|
1666
|
-
* minutes.
|
|
1798
|
+
* Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
|
|
1667
1799
|
*
|
|
1668
1800
|
* @throws {AppwriteException}
|
|
1669
1801
|
* @returns {Promise}
|
|
1670
|
-
|
|
1802
|
+
*/
|
|
1671
1803
|
createPhoneVerification() {
|
|
1672
1804
|
const apiPath = '/account/verification/phone';
|
|
1673
1805
|
const payload = {};
|
|
@@ -1676,18 +1808,19 @@ class Account extends Service {
|
|
|
1676
1808
|
'content-type': 'application/json',
|
|
1677
1809
|
}, payload);
|
|
1678
1810
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1811
|
+
updatePhoneVerification(paramsOrFirst, ...rest) {
|
|
1812
|
+
let params;
|
|
1813
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1814
|
+
params = (paramsOrFirst || {});
|
|
1815
|
+
}
|
|
1816
|
+
else {
|
|
1817
|
+
params = {
|
|
1818
|
+
userId: paramsOrFirst,
|
|
1819
|
+
secret: rest[0]
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
const userId = params.userId;
|
|
1823
|
+
const secret = params.secret;
|
|
1691
1824
|
if (typeof userId === 'undefined') {
|
|
1692
1825
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1693
1826
|
}
|
|
@@ -1713,26 +1846,23 @@ class Avatars extends Service {
|
|
|
1713
1846
|
constructor(client) {
|
|
1714
1847
|
super(client);
|
|
1715
1848
|
}
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
* @returns {ArrayBuffer}
|
|
1734
|
-
*/
|
|
1735
|
-
getBrowser(code, width, height, quality) {
|
|
1849
|
+
getBrowser(paramsOrFirst, ...rest) {
|
|
1850
|
+
let params;
|
|
1851
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
1852
|
+
params = (paramsOrFirst || {});
|
|
1853
|
+
}
|
|
1854
|
+
else {
|
|
1855
|
+
params = {
|
|
1856
|
+
code: paramsOrFirst,
|
|
1857
|
+
width: rest[0],
|
|
1858
|
+
height: rest[1],
|
|
1859
|
+
quality: rest[2]
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
const code = params.code;
|
|
1863
|
+
const width = params.width;
|
|
1864
|
+
const height = params.height;
|
|
1865
|
+
const quality = params.quality;
|
|
1736
1866
|
if (typeof code === 'undefined') {
|
|
1737
1867
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
1738
1868
|
}
|
|
@@ -1754,25 +1884,23 @@ class Avatars extends Service {
|
|
|
1754
1884
|
}
|
|
1755
1885
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1756
1886
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
*/
|
|
1775
|
-
getCreditCard(code, width, height, quality) {
|
|
1887
|
+
getCreditCard(paramsOrFirst, ...rest) {
|
|
1888
|
+
let params;
|
|
1889
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
1890
|
+
params = (paramsOrFirst || {});
|
|
1891
|
+
}
|
|
1892
|
+
else {
|
|
1893
|
+
params = {
|
|
1894
|
+
code: paramsOrFirst,
|
|
1895
|
+
width: rest[0],
|
|
1896
|
+
height: rest[1],
|
|
1897
|
+
quality: rest[2]
|
|
1898
|
+
};
|
|
1899
|
+
}
|
|
1900
|
+
const code = params.code;
|
|
1901
|
+
const width = params.width;
|
|
1902
|
+
const height = params.height;
|
|
1903
|
+
const quality = params.quality;
|
|
1776
1904
|
if (typeof code === 'undefined') {
|
|
1777
1905
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
1778
1906
|
}
|
|
@@ -1794,17 +1922,17 @@ class Avatars extends Service {
|
|
|
1794
1922
|
}
|
|
1795
1923
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1796
1924
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1925
|
+
getFavicon(paramsOrFirst) {
|
|
1926
|
+
let params;
|
|
1927
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1928
|
+
params = (paramsOrFirst || {});
|
|
1929
|
+
}
|
|
1930
|
+
else {
|
|
1931
|
+
params = {
|
|
1932
|
+
url: paramsOrFirst
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
const url = params.url;
|
|
1808
1936
|
if (typeof url === 'undefined') {
|
|
1809
1937
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1810
1938
|
}
|
|
@@ -1820,26 +1948,23 @@ class Avatars extends Service {
|
|
|
1820
1948
|
}
|
|
1821
1949
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1822
1950
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
* @returns {ArrayBuffer}
|
|
1841
|
-
*/
|
|
1842
|
-
getFlag(code, width, height, quality) {
|
|
1951
|
+
getFlag(paramsOrFirst, ...rest) {
|
|
1952
|
+
let params;
|
|
1953
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
1954
|
+
params = (paramsOrFirst || {});
|
|
1955
|
+
}
|
|
1956
|
+
else {
|
|
1957
|
+
params = {
|
|
1958
|
+
code: paramsOrFirst,
|
|
1959
|
+
width: rest[0],
|
|
1960
|
+
height: rest[1],
|
|
1961
|
+
quality: rest[2]
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
const code = params.code;
|
|
1965
|
+
const width = params.width;
|
|
1966
|
+
const height = params.height;
|
|
1967
|
+
const quality = params.quality;
|
|
1843
1968
|
if (typeof code === 'undefined') {
|
|
1844
1969
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
1845
1970
|
}
|
|
@@ -1861,26 +1986,21 @@ class Avatars extends Service {
|
|
|
1861
1986
|
}
|
|
1862
1987
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1863
1988
|
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
* @param {number} height
|
|
1880
|
-
* @throws {AppwriteException}
|
|
1881
|
-
* @returns {ArrayBuffer}
|
|
1882
|
-
*/
|
|
1883
|
-
getImage(url, width, height) {
|
|
1989
|
+
getImage(paramsOrFirst, ...rest) {
|
|
1990
|
+
let params;
|
|
1991
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1992
|
+
params = (paramsOrFirst || {});
|
|
1993
|
+
}
|
|
1994
|
+
else {
|
|
1995
|
+
params = {
|
|
1996
|
+
url: paramsOrFirst,
|
|
1997
|
+
width: rest[0],
|
|
1998
|
+
height: rest[1]
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
const url = params.url;
|
|
2002
|
+
const width = params.width;
|
|
2003
|
+
const height = params.height;
|
|
1884
2004
|
if (typeof url === 'undefined') {
|
|
1885
2005
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1886
2006
|
}
|
|
@@ -1902,32 +2022,23 @@ class Avatars extends Service {
|
|
|
1902
2022
|
}
|
|
1903
2023
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1904
2024
|
}
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
*
|
|
1923
|
-
* @param {string} name
|
|
1924
|
-
* @param {number} width
|
|
1925
|
-
* @param {number} height
|
|
1926
|
-
* @param {string} background
|
|
1927
|
-
* @throws {AppwriteException}
|
|
1928
|
-
* @returns {ArrayBuffer}
|
|
1929
|
-
*/
|
|
1930
|
-
getInitials(name, width, height, background) {
|
|
2025
|
+
getInitials(paramsOrFirst, ...rest) {
|
|
2026
|
+
let params;
|
|
2027
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2028
|
+
params = (paramsOrFirst || {});
|
|
2029
|
+
}
|
|
2030
|
+
else {
|
|
2031
|
+
params = {
|
|
2032
|
+
name: paramsOrFirst,
|
|
2033
|
+
width: rest[0],
|
|
2034
|
+
height: rest[1],
|
|
2035
|
+
background: rest[2]
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
const name = params.name;
|
|
2039
|
+
const width = params.width;
|
|
2040
|
+
const height = params.height;
|
|
2041
|
+
const background = params.background;
|
|
1931
2042
|
const apiPath = '/avatars/initials';
|
|
1932
2043
|
const payload = {};
|
|
1933
2044
|
if (typeof name !== 'undefined') {
|
|
@@ -1949,19 +2060,23 @@ class Avatars extends Service {
|
|
|
1949
2060
|
}
|
|
1950
2061
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1951
2062
|
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2063
|
+
getQR(paramsOrFirst, ...rest) {
|
|
2064
|
+
let params;
|
|
2065
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2066
|
+
params = (paramsOrFirst || {});
|
|
2067
|
+
}
|
|
2068
|
+
else {
|
|
2069
|
+
params = {
|
|
2070
|
+
text: paramsOrFirst,
|
|
2071
|
+
size: rest[0],
|
|
2072
|
+
margin: rest[1],
|
|
2073
|
+
download: rest[2]
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
const text = params.text;
|
|
2077
|
+
const size = params.size;
|
|
2078
|
+
const margin = params.margin;
|
|
2079
|
+
const download = params.download;
|
|
1965
2080
|
if (typeof text === 'undefined') {
|
|
1966
2081
|
throw new AppwriteException('Missing required parameter: "text"');
|
|
1967
2082
|
}
|
|
@@ -2247,17 +2362,21 @@ class Databases extends Service {
|
|
|
2247
2362
|
constructor(client) {
|
|
2248
2363
|
super(client);
|
|
2249
2364
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2365
|
+
listDocuments(paramsOrFirst, ...rest) {
|
|
2366
|
+
let params;
|
|
2367
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2368
|
+
params = (paramsOrFirst || {});
|
|
2369
|
+
}
|
|
2370
|
+
else {
|
|
2371
|
+
params = {
|
|
2372
|
+
databaseId: paramsOrFirst,
|
|
2373
|
+
collectionId: rest[0],
|
|
2374
|
+
queries: rest[1]
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
const databaseId = params.databaseId;
|
|
2378
|
+
const collectionId = params.collectionId;
|
|
2379
|
+
const queries = params.queries;
|
|
2261
2380
|
if (typeof databaseId === 'undefined') {
|
|
2262
2381
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2263
2382
|
}
|
|
@@ -2272,21 +2391,25 @@ class Databases extends Service {
|
|
|
2272
2391
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2273
2392
|
return this.client.call('get', uri, {}, payload);
|
|
2274
2393
|
}
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2394
|
+
createDocument(paramsOrFirst, ...rest) {
|
|
2395
|
+
let params;
|
|
2396
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2397
|
+
params = (paramsOrFirst || {});
|
|
2398
|
+
}
|
|
2399
|
+
else {
|
|
2400
|
+
params = {
|
|
2401
|
+
databaseId: paramsOrFirst,
|
|
2402
|
+
collectionId: rest[0],
|
|
2403
|
+
documentId: rest[1],
|
|
2404
|
+
data: rest[2],
|
|
2405
|
+
permissions: rest[3]
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
const databaseId = params.databaseId;
|
|
2409
|
+
const collectionId = params.collectionId;
|
|
2410
|
+
const documentId = params.documentId;
|
|
2411
|
+
const data = params.data;
|
|
2412
|
+
const permissions = params.permissions;
|
|
2290
2413
|
if (typeof databaseId === 'undefined') {
|
|
2291
2414
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2292
2415
|
}
|
|
@@ -2299,6 +2422,9 @@ class Databases extends Service {
|
|
|
2299
2422
|
if (typeof data === 'undefined') {
|
|
2300
2423
|
throw new AppwriteException('Missing required parameter: "data"');
|
|
2301
2424
|
}
|
|
2425
|
+
data === null || data === void 0 ? true : delete data.$sequence;
|
|
2426
|
+
data === null || data === void 0 ? true : delete data.$collectionId;
|
|
2427
|
+
data === null || data === void 0 ? true : delete data.$databaseId;
|
|
2302
2428
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2303
2429
|
const payload = {};
|
|
2304
2430
|
if (typeof documentId !== 'undefined') {
|
|
@@ -2315,18 +2441,23 @@ class Databases extends Service {
|
|
|
2315
2441
|
'content-type': 'application/json',
|
|
2316
2442
|
}, payload);
|
|
2317
2443
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2444
|
+
getDocument(paramsOrFirst, ...rest) {
|
|
2445
|
+
let params;
|
|
2446
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2447
|
+
params = (paramsOrFirst || {});
|
|
2448
|
+
}
|
|
2449
|
+
else {
|
|
2450
|
+
params = {
|
|
2451
|
+
databaseId: paramsOrFirst,
|
|
2452
|
+
collectionId: rest[0],
|
|
2453
|
+
documentId: rest[1],
|
|
2454
|
+
queries: rest[2]
|
|
2455
|
+
};
|
|
2456
|
+
}
|
|
2457
|
+
const databaseId = params.databaseId;
|
|
2458
|
+
const collectionId = params.collectionId;
|
|
2459
|
+
const documentId = params.documentId;
|
|
2460
|
+
const queries = params.queries;
|
|
2330
2461
|
if (typeof databaseId === 'undefined') {
|
|
2331
2462
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2332
2463
|
}
|
|
@@ -2344,25 +2475,25 @@ class Databases extends Service {
|
|
|
2344
2475
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2345
2476
|
return this.client.call('get', uri, {}, payload);
|
|
2346
2477
|
}
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2478
|
+
upsertDocument(paramsOrFirst, ...rest) {
|
|
2479
|
+
let params;
|
|
2480
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2481
|
+
params = (paramsOrFirst || {});
|
|
2482
|
+
}
|
|
2483
|
+
else {
|
|
2484
|
+
params = {
|
|
2485
|
+
databaseId: paramsOrFirst,
|
|
2486
|
+
collectionId: rest[0],
|
|
2487
|
+
documentId: rest[1],
|
|
2488
|
+
data: rest[2],
|
|
2489
|
+
permissions: rest[3]
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2492
|
+
const databaseId = params.databaseId;
|
|
2493
|
+
const collectionId = params.collectionId;
|
|
2494
|
+
const documentId = params.documentId;
|
|
2495
|
+
const data = params.data;
|
|
2496
|
+
const permissions = params.permissions;
|
|
2366
2497
|
if (typeof databaseId === 'undefined') {
|
|
2367
2498
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2368
2499
|
}
|
|
@@ -2375,6 +2506,9 @@ class Databases extends Service {
|
|
|
2375
2506
|
if (typeof data === 'undefined') {
|
|
2376
2507
|
throw new AppwriteException('Missing required parameter: "data"');
|
|
2377
2508
|
}
|
|
2509
|
+
data === null || data === void 0 ? true : delete data.$sequence;
|
|
2510
|
+
data === null || data === void 0 ? true : delete data.$collectionId;
|
|
2511
|
+
data === null || data === void 0 ? true : delete data.$databaseId;
|
|
2378
2512
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2379
2513
|
const payload = {};
|
|
2380
2514
|
if (typeof data !== 'undefined') {
|
|
@@ -2388,19 +2522,25 @@ class Databases extends Service {
|
|
|
2388
2522
|
'content-type': 'application/json',
|
|
2389
2523
|
}, payload);
|
|
2390
2524
|
}
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2525
|
+
updateDocument(paramsOrFirst, ...rest) {
|
|
2526
|
+
let params;
|
|
2527
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2528
|
+
params = (paramsOrFirst || {});
|
|
2529
|
+
}
|
|
2530
|
+
else {
|
|
2531
|
+
params = {
|
|
2532
|
+
databaseId: paramsOrFirst,
|
|
2533
|
+
collectionId: rest[0],
|
|
2534
|
+
documentId: rest[1],
|
|
2535
|
+
data: rest[2],
|
|
2536
|
+
permissions: rest[3]
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
const databaseId = params.databaseId;
|
|
2540
|
+
const collectionId = params.collectionId;
|
|
2541
|
+
const documentId = params.documentId;
|
|
2542
|
+
const data = params.data;
|
|
2543
|
+
const permissions = params.permissions;
|
|
2404
2544
|
if (typeof databaseId === 'undefined') {
|
|
2405
2545
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2406
2546
|
}
|
|
@@ -2410,6 +2550,9 @@ class Databases extends Service {
|
|
|
2410
2550
|
if (typeof documentId === 'undefined') {
|
|
2411
2551
|
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2412
2552
|
}
|
|
2553
|
+
data === null || data === void 0 ? true : delete data.$sequence;
|
|
2554
|
+
data === null || data === void 0 ? true : delete data.$collectionId;
|
|
2555
|
+
data === null || data === void 0 ? true : delete data.$databaseId;
|
|
2413
2556
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2414
2557
|
const payload = {};
|
|
2415
2558
|
if (typeof data !== 'undefined') {
|
|
@@ -2423,16 +2566,21 @@ class Databases extends Service {
|
|
|
2423
2566
|
'content-type': 'application/json',
|
|
2424
2567
|
}, payload);
|
|
2425
2568
|
}
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2569
|
+
deleteDocument(paramsOrFirst, ...rest) {
|
|
2570
|
+
let params;
|
|
2571
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2572
|
+
params = (paramsOrFirst || {});
|
|
2573
|
+
}
|
|
2574
|
+
else {
|
|
2575
|
+
params = {
|
|
2576
|
+
databaseId: paramsOrFirst,
|
|
2577
|
+
collectionId: rest[0],
|
|
2578
|
+
documentId: rest[1]
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
const databaseId = params.databaseId;
|
|
2582
|
+
const collectionId = params.collectionId;
|
|
2583
|
+
const documentId = params.documentId;
|
|
2436
2584
|
if (typeof databaseId === 'undefined') {
|
|
2437
2585
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2438
2586
|
}
|
|
@@ -2449,22 +2597,117 @@ class Databases extends Service {
|
|
|
2449
2597
|
'content-type': 'application/json',
|
|
2450
2598
|
}, payload);
|
|
2451
2599
|
}
|
|
2600
|
+
decrementDocumentAttribute(paramsOrFirst, ...rest) {
|
|
2601
|
+
let params;
|
|
2602
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2603
|
+
params = (paramsOrFirst || {});
|
|
2604
|
+
}
|
|
2605
|
+
else {
|
|
2606
|
+
params = {
|
|
2607
|
+
databaseId: paramsOrFirst,
|
|
2608
|
+
collectionId: rest[0],
|
|
2609
|
+
documentId: rest[1],
|
|
2610
|
+
attribute: rest[2],
|
|
2611
|
+
value: rest[3],
|
|
2612
|
+
min: rest[4]
|
|
2613
|
+
};
|
|
2614
|
+
}
|
|
2615
|
+
const databaseId = params.databaseId;
|
|
2616
|
+
const collectionId = params.collectionId;
|
|
2617
|
+
const documentId = params.documentId;
|
|
2618
|
+
const attribute = params.attribute;
|
|
2619
|
+
const value = params.value;
|
|
2620
|
+
const min = params.min;
|
|
2621
|
+
if (typeof databaseId === 'undefined') {
|
|
2622
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2623
|
+
}
|
|
2624
|
+
if (typeof collectionId === 'undefined') {
|
|
2625
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2626
|
+
}
|
|
2627
|
+
if (typeof documentId === 'undefined') {
|
|
2628
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2629
|
+
}
|
|
2630
|
+
if (typeof attribute === 'undefined') {
|
|
2631
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
2632
|
+
}
|
|
2633
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
2634
|
+
const payload = {};
|
|
2635
|
+
if (typeof value !== 'undefined') {
|
|
2636
|
+
payload['value'] = value;
|
|
2637
|
+
}
|
|
2638
|
+
if (typeof min !== 'undefined') {
|
|
2639
|
+
payload['min'] = min;
|
|
2640
|
+
}
|
|
2641
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2642
|
+
return this.client.call('patch', uri, {
|
|
2643
|
+
'content-type': 'application/json',
|
|
2644
|
+
}, payload);
|
|
2645
|
+
}
|
|
2646
|
+
incrementDocumentAttribute(paramsOrFirst, ...rest) {
|
|
2647
|
+
let params;
|
|
2648
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2649
|
+
params = (paramsOrFirst || {});
|
|
2650
|
+
}
|
|
2651
|
+
else {
|
|
2652
|
+
params = {
|
|
2653
|
+
databaseId: paramsOrFirst,
|
|
2654
|
+
collectionId: rest[0],
|
|
2655
|
+
documentId: rest[1],
|
|
2656
|
+
attribute: rest[2],
|
|
2657
|
+
value: rest[3],
|
|
2658
|
+
max: rest[4]
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
const databaseId = params.databaseId;
|
|
2662
|
+
const collectionId = params.collectionId;
|
|
2663
|
+
const documentId = params.documentId;
|
|
2664
|
+
const attribute = params.attribute;
|
|
2665
|
+
const value = params.value;
|
|
2666
|
+
const max = params.max;
|
|
2667
|
+
if (typeof databaseId === 'undefined') {
|
|
2668
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2669
|
+
}
|
|
2670
|
+
if (typeof collectionId === 'undefined') {
|
|
2671
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2672
|
+
}
|
|
2673
|
+
if (typeof documentId === 'undefined') {
|
|
2674
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2675
|
+
}
|
|
2676
|
+
if (typeof attribute === 'undefined') {
|
|
2677
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
2678
|
+
}
|
|
2679
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
2680
|
+
const payload = {};
|
|
2681
|
+
if (typeof value !== 'undefined') {
|
|
2682
|
+
payload['value'] = value;
|
|
2683
|
+
}
|
|
2684
|
+
if (typeof max !== 'undefined') {
|
|
2685
|
+
payload['max'] = max;
|
|
2686
|
+
}
|
|
2687
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2688
|
+
return this.client.call('patch', uri, {
|
|
2689
|
+
'content-type': 'application/json',
|
|
2690
|
+
}, payload);
|
|
2691
|
+
}
|
|
2452
2692
|
}
|
|
2453
2693
|
|
|
2454
2694
|
class Functions extends Service {
|
|
2455
2695
|
constructor(client) {
|
|
2456
2696
|
super(client);
|
|
2457
2697
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2698
|
+
listExecutions(paramsOrFirst, ...rest) {
|
|
2699
|
+
let params;
|
|
2700
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2701
|
+
params = (paramsOrFirst || {});
|
|
2702
|
+
}
|
|
2703
|
+
else {
|
|
2704
|
+
params = {
|
|
2705
|
+
functionId: paramsOrFirst,
|
|
2706
|
+
queries: rest[0]
|
|
2707
|
+
};
|
|
2708
|
+
}
|
|
2709
|
+
const functionId = params.functionId;
|
|
2710
|
+
const queries = params.queries;
|
|
2468
2711
|
if (typeof functionId === 'undefined') {
|
|
2469
2712
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2470
2713
|
}
|
|
@@ -2476,23 +2719,29 @@ class Functions extends Service {
|
|
|
2476
2719
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2477
2720
|
return this.client.call('get', uri, {}, payload);
|
|
2478
2721
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2722
|
+
createExecution(paramsOrFirst, ...rest) {
|
|
2723
|
+
let params;
|
|
2724
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2725
|
+
params = (paramsOrFirst || {});
|
|
2726
|
+
}
|
|
2727
|
+
else {
|
|
2728
|
+
params = {
|
|
2729
|
+
functionId: paramsOrFirst,
|
|
2730
|
+
body: rest[0],
|
|
2731
|
+
async: rest[1],
|
|
2732
|
+
xpath: rest[2],
|
|
2733
|
+
method: rest[3],
|
|
2734
|
+
headers: rest[4],
|
|
2735
|
+
scheduledAt: rest[5]
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2738
|
+
const functionId = params.functionId;
|
|
2739
|
+
const body = params.body;
|
|
2740
|
+
const async = params.async;
|
|
2741
|
+
const xpath = params.xpath;
|
|
2742
|
+
const method = params.method;
|
|
2743
|
+
const headers = params.headers;
|
|
2744
|
+
const scheduledAt = params.scheduledAt;
|
|
2496
2745
|
if (typeof functionId === 'undefined') {
|
|
2497
2746
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2498
2747
|
}
|
|
@@ -2521,15 +2770,19 @@ class Functions extends Service {
|
|
|
2521
2770
|
'content-type': 'application/json',
|
|
2522
2771
|
}, payload);
|
|
2523
2772
|
}
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2773
|
+
getExecution(paramsOrFirst, ...rest) {
|
|
2774
|
+
let params;
|
|
2775
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2776
|
+
params = (paramsOrFirst || {});
|
|
2777
|
+
}
|
|
2778
|
+
else {
|
|
2779
|
+
params = {
|
|
2780
|
+
functionId: paramsOrFirst,
|
|
2781
|
+
executionId: rest[0]
|
|
2782
|
+
};
|
|
2783
|
+
}
|
|
2784
|
+
const functionId = params.functionId;
|
|
2785
|
+
const executionId = params.executionId;
|
|
2533
2786
|
if (typeof functionId === 'undefined') {
|
|
2534
2787
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2535
2788
|
}
|
|
@@ -2547,14 +2800,17 @@ class Graphql extends Service {
|
|
|
2547
2800
|
constructor(client) {
|
|
2548
2801
|
super(client);
|
|
2549
2802
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2803
|
+
query(paramsOrFirst) {
|
|
2804
|
+
let params;
|
|
2805
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
|
|
2806
|
+
params = (paramsOrFirst || {});
|
|
2807
|
+
}
|
|
2808
|
+
else {
|
|
2809
|
+
params = {
|
|
2810
|
+
query: paramsOrFirst
|
|
2811
|
+
};
|
|
2812
|
+
}
|
|
2813
|
+
const query = params.query;
|
|
2558
2814
|
if (typeof query === 'undefined') {
|
|
2559
2815
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
2560
2816
|
}
|
|
@@ -2569,14 +2825,17 @@ class Graphql extends Service {
|
|
|
2569
2825
|
'content-type': 'application/json',
|
|
2570
2826
|
}, payload);
|
|
2571
2827
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2828
|
+
mutation(paramsOrFirst) {
|
|
2829
|
+
let params;
|
|
2830
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
|
|
2831
|
+
params = (paramsOrFirst || {});
|
|
2832
|
+
}
|
|
2833
|
+
else {
|
|
2834
|
+
params = {
|
|
2835
|
+
query: paramsOrFirst
|
|
2836
|
+
};
|
|
2837
|
+
}
|
|
2838
|
+
const query = params.query;
|
|
2580
2839
|
if (typeof query === 'undefined') {
|
|
2581
2840
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
2582
2841
|
}
|
|
@@ -2598,16 +2857,13 @@ class Locale extends Service {
|
|
|
2598
2857
|
super(client);
|
|
2599
2858
|
}
|
|
2600
2859
|
/**
|
|
2601
|
-
* Get the current user location based on IP. Returns an object with user
|
|
2602
|
-
* country code, country name, continent name, continent code, ip address and
|
|
2603
|
-
* suggested currency. You can use the locale header to get the data in a
|
|
2604
|
-
* supported language.
|
|
2860
|
+
* Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
|
|
2605
2861
|
*
|
|
2606
2862
|
* ([IP Geolocation by DB-IP](https://db-ip.com))
|
|
2607
2863
|
*
|
|
2608
2864
|
* @throws {AppwriteException}
|
|
2609
2865
|
* @returns {Promise}
|
|
2610
|
-
|
|
2866
|
+
*/
|
|
2611
2867
|
get() {
|
|
2612
2868
|
const apiPath = '/locale';
|
|
2613
2869
|
const payload = {};
|
|
@@ -2615,12 +2871,11 @@ class Locale extends Service {
|
|
|
2615
2871
|
return this.client.call('get', uri, {}, payload);
|
|
2616
2872
|
}
|
|
2617
2873
|
/**
|
|
2618
|
-
* List of all locale codes in [ISO
|
|
2619
|
-
* 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
|
|
2874
|
+
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
|
|
2620
2875
|
*
|
|
2621
2876
|
* @throws {AppwriteException}
|
|
2622
2877
|
* @returns {Promise}
|
|
2623
|
-
|
|
2878
|
+
*/
|
|
2624
2879
|
listCodes() {
|
|
2625
2880
|
const apiPath = '/locale/codes';
|
|
2626
2881
|
const payload = {};
|
|
@@ -2628,12 +2883,11 @@ class Locale extends Service {
|
|
|
2628
2883
|
return this.client.call('get', uri, {}, payload);
|
|
2629
2884
|
}
|
|
2630
2885
|
/**
|
|
2631
|
-
* List of all continents. You can use the locale header to get the data in a
|
|
2632
|
-
* supported language.
|
|
2886
|
+
* List of all continents. You can use the locale header to get the data in a supported language.
|
|
2633
2887
|
*
|
|
2634
2888
|
* @throws {AppwriteException}
|
|
2635
2889
|
* @returns {Promise}
|
|
2636
|
-
|
|
2890
|
+
*/
|
|
2637
2891
|
listContinents() {
|
|
2638
2892
|
const apiPath = '/locale/continents';
|
|
2639
2893
|
const payload = {};
|
|
@@ -2641,12 +2895,11 @@ class Locale extends Service {
|
|
|
2641
2895
|
return this.client.call('get', uri, {}, payload);
|
|
2642
2896
|
}
|
|
2643
2897
|
/**
|
|
2644
|
-
* List of all countries. You can use the locale header to get the data in a
|
|
2645
|
-
* supported language.
|
|
2898
|
+
* List of all countries. You can use the locale header to get the data in a supported language.
|
|
2646
2899
|
*
|
|
2647
2900
|
* @throws {AppwriteException}
|
|
2648
2901
|
* @returns {Promise}
|
|
2649
|
-
|
|
2902
|
+
*/
|
|
2650
2903
|
listCountries() {
|
|
2651
2904
|
const apiPath = '/locale/countries';
|
|
2652
2905
|
const payload = {};
|
|
@@ -2654,12 +2907,11 @@ class Locale extends Service {
|
|
|
2654
2907
|
return this.client.call('get', uri, {}, payload);
|
|
2655
2908
|
}
|
|
2656
2909
|
/**
|
|
2657
|
-
* List of all countries that are currently members of the EU. You can use the
|
|
2658
|
-
* locale header to get the data in a supported language.
|
|
2910
|
+
* List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
|
|
2659
2911
|
*
|
|
2660
2912
|
* @throws {AppwriteException}
|
|
2661
2913
|
* @returns {Promise}
|
|
2662
|
-
|
|
2914
|
+
*/
|
|
2663
2915
|
listCountriesEU() {
|
|
2664
2916
|
const apiPath = '/locale/countries/eu';
|
|
2665
2917
|
const payload = {};
|
|
@@ -2667,12 +2919,11 @@ class Locale extends Service {
|
|
|
2667
2919
|
return this.client.call('get', uri, {}, payload);
|
|
2668
2920
|
}
|
|
2669
2921
|
/**
|
|
2670
|
-
* List of all countries phone codes. You can use the locale header to get the
|
|
2671
|
-
* data in a supported language.
|
|
2922
|
+
* List of all countries phone codes. You can use the locale header to get the data in a supported language.
|
|
2672
2923
|
*
|
|
2673
2924
|
* @throws {AppwriteException}
|
|
2674
2925
|
* @returns {Promise}
|
|
2675
|
-
|
|
2926
|
+
*/
|
|
2676
2927
|
listCountriesPhones() {
|
|
2677
2928
|
const apiPath = '/locale/countries/phones';
|
|
2678
2929
|
const payload = {};
|
|
@@ -2680,13 +2931,11 @@ class Locale extends Service {
|
|
|
2680
2931
|
return this.client.call('get', uri, {}, payload);
|
|
2681
2932
|
}
|
|
2682
2933
|
/**
|
|
2683
|
-
* List of all currencies, including currency symbol, name, plural, and
|
|
2684
|
-
* decimal digits for all major and minor currencies. You can use the locale
|
|
2685
|
-
* header to get the data in a supported language.
|
|
2934
|
+
* List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
|
|
2686
2935
|
*
|
|
2687
2936
|
* @throws {AppwriteException}
|
|
2688
2937
|
* @returns {Promise}
|
|
2689
|
-
|
|
2938
|
+
*/
|
|
2690
2939
|
listCurrencies() {
|
|
2691
2940
|
const apiPath = '/locale/currencies';
|
|
2692
2941
|
const payload = {};
|
|
@@ -2694,12 +2943,11 @@ class Locale extends Service {
|
|
|
2694
2943
|
return this.client.call('get', uri, {}, payload);
|
|
2695
2944
|
}
|
|
2696
2945
|
/**
|
|
2697
|
-
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
2698
|
-
* in English, and name in the respective language.
|
|
2946
|
+
* List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
|
|
2699
2947
|
*
|
|
2700
2948
|
* @throws {AppwriteException}
|
|
2701
2949
|
* @returns {Promise}
|
|
2702
|
-
|
|
2950
|
+
*/
|
|
2703
2951
|
listLanguages() {
|
|
2704
2952
|
const apiPath = '/locale/languages';
|
|
2705
2953
|
const payload = {};
|
|
@@ -2712,16 +2960,21 @@ class Messaging extends Service {
|
|
|
2712
2960
|
constructor(client) {
|
|
2713
2961
|
super(client);
|
|
2714
2962
|
}
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2963
|
+
createSubscriber(paramsOrFirst, ...rest) {
|
|
2964
|
+
let params;
|
|
2965
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2966
|
+
params = (paramsOrFirst || {});
|
|
2967
|
+
}
|
|
2968
|
+
else {
|
|
2969
|
+
params = {
|
|
2970
|
+
topicId: paramsOrFirst,
|
|
2971
|
+
subscriberId: rest[0],
|
|
2972
|
+
targetId: rest[1]
|
|
2973
|
+
};
|
|
2974
|
+
}
|
|
2975
|
+
const topicId = params.topicId;
|
|
2976
|
+
const subscriberId = params.subscriberId;
|
|
2977
|
+
const targetId = params.targetId;
|
|
2725
2978
|
if (typeof topicId === 'undefined') {
|
|
2726
2979
|
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
2727
2980
|
}
|
|
@@ -2744,15 +2997,19 @@ class Messaging extends Service {
|
|
|
2744
2997
|
'content-type': 'application/json',
|
|
2745
2998
|
}, payload);
|
|
2746
2999
|
}
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
3000
|
+
deleteSubscriber(paramsOrFirst, ...rest) {
|
|
3001
|
+
let params;
|
|
3002
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3003
|
+
params = (paramsOrFirst || {});
|
|
3004
|
+
}
|
|
3005
|
+
else {
|
|
3006
|
+
params = {
|
|
3007
|
+
topicId: paramsOrFirst,
|
|
3008
|
+
subscriberId: rest[0]
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
const topicId = params.topicId;
|
|
3012
|
+
const subscriberId = params.subscriberId;
|
|
2756
3013
|
if (typeof topicId === 'undefined') {
|
|
2757
3014
|
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
2758
3015
|
}
|
|
@@ -2772,17 +3029,21 @@ class Storage extends Service {
|
|
|
2772
3029
|
constructor(client) {
|
|
2773
3030
|
super(client);
|
|
2774
3031
|
}
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
3032
|
+
listFiles(paramsOrFirst, ...rest) {
|
|
3033
|
+
let params;
|
|
3034
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3035
|
+
params = (paramsOrFirst || {});
|
|
3036
|
+
}
|
|
3037
|
+
else {
|
|
3038
|
+
params = {
|
|
3039
|
+
bucketId: paramsOrFirst,
|
|
3040
|
+
queries: rest[0],
|
|
3041
|
+
search: rest[1]
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
const bucketId = params.bucketId;
|
|
3045
|
+
const queries = params.queries;
|
|
3046
|
+
const search = params.search;
|
|
2786
3047
|
if (typeof bucketId === 'undefined') {
|
|
2787
3048
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2788
3049
|
}
|
|
@@ -2797,35 +3058,27 @@ class Storage extends Service {
|
|
|
2797
3058
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2798
3059
|
return this.client.call('get', uri, {}, payload);
|
|
2799
3060
|
}
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
* @param {string} fileId
|
|
2822
|
-
* @param {{name: string, type: string, size: number, uri: string}} file
|
|
2823
|
-
* @param {string[]} permissions
|
|
2824
|
-
* @throws {AppwriteException}
|
|
2825
|
-
* @returns {Promise}
|
|
2826
|
-
*/
|
|
2827
|
-
createFile(bucketId_1, fileId_1, file_1, permissions_1) {
|
|
2828
|
-
return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
|
|
3061
|
+
createFile(paramsOrFirst, ...rest) {
|
|
3062
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3063
|
+
let params;
|
|
3064
|
+
let onProgress;
|
|
3065
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3066
|
+
params = (paramsOrFirst || {});
|
|
3067
|
+
onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
|
|
3068
|
+
}
|
|
3069
|
+
else {
|
|
3070
|
+
params = {
|
|
3071
|
+
bucketId: paramsOrFirst,
|
|
3072
|
+
fileId: rest[0],
|
|
3073
|
+
file: rest[1],
|
|
3074
|
+
permissions: rest[2]
|
|
3075
|
+
};
|
|
3076
|
+
onProgress = rest[3];
|
|
3077
|
+
}
|
|
3078
|
+
const bucketId = params.bucketId;
|
|
3079
|
+
const fileId = params.fileId;
|
|
3080
|
+
const file = params.file;
|
|
3081
|
+
const permissions = params.permissions;
|
|
2829
3082
|
if (typeof bucketId === 'undefined') {
|
|
2830
3083
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2831
3084
|
}
|
|
@@ -2897,16 +3150,19 @@ class Storage extends Service {
|
|
|
2897
3150
|
return response;
|
|
2898
3151
|
});
|
|
2899
3152
|
}
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
3153
|
+
getFile(paramsOrFirst, ...rest) {
|
|
3154
|
+
let params;
|
|
3155
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3156
|
+
params = (paramsOrFirst || {});
|
|
3157
|
+
}
|
|
3158
|
+
else {
|
|
3159
|
+
params = {
|
|
3160
|
+
bucketId: paramsOrFirst,
|
|
3161
|
+
fileId: rest[0]
|
|
3162
|
+
};
|
|
3163
|
+
}
|
|
3164
|
+
const bucketId = params.bucketId;
|
|
3165
|
+
const fileId = params.fileId;
|
|
2910
3166
|
if (typeof bucketId === 'undefined') {
|
|
2911
3167
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2912
3168
|
}
|
|
@@ -2918,18 +3174,23 @@ class Storage extends Service {
|
|
|
2918
3174
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2919
3175
|
return this.client.call('get', uri, {}, payload);
|
|
2920
3176
|
}
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
3177
|
+
updateFile(paramsOrFirst, ...rest) {
|
|
3178
|
+
let params;
|
|
3179
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3180
|
+
params = (paramsOrFirst || {});
|
|
3181
|
+
}
|
|
3182
|
+
else {
|
|
3183
|
+
params = {
|
|
3184
|
+
bucketId: paramsOrFirst,
|
|
3185
|
+
fileId: rest[0],
|
|
3186
|
+
name: rest[1],
|
|
3187
|
+
permissions: rest[2]
|
|
3188
|
+
};
|
|
3189
|
+
}
|
|
3190
|
+
const bucketId = params.bucketId;
|
|
3191
|
+
const fileId = params.fileId;
|
|
3192
|
+
const name = params.name;
|
|
3193
|
+
const permissions = params.permissions;
|
|
2933
3194
|
if (typeof bucketId === 'undefined') {
|
|
2934
3195
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2935
3196
|
}
|
|
@@ -2949,16 +3210,19 @@ class Storage extends Service {
|
|
|
2949
3210
|
'content-type': 'application/json',
|
|
2950
3211
|
}, payload);
|
|
2951
3212
|
}
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3213
|
+
deleteFile(paramsOrFirst, ...rest) {
|
|
3214
|
+
let params;
|
|
3215
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3216
|
+
params = (paramsOrFirst || {});
|
|
3217
|
+
}
|
|
3218
|
+
else {
|
|
3219
|
+
params = {
|
|
3220
|
+
bucketId: paramsOrFirst,
|
|
3221
|
+
fileId: rest[0]
|
|
3222
|
+
};
|
|
3223
|
+
}
|
|
3224
|
+
const bucketId = params.bucketId;
|
|
3225
|
+
const fileId = params.fileId;
|
|
2962
3226
|
if (typeof bucketId === 'undefined') {
|
|
2963
3227
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2964
3228
|
}
|
|
@@ -2972,18 +3236,21 @@ class Storage extends Service {
|
|
|
2972
3236
|
'content-type': 'application/json',
|
|
2973
3237
|
}, payload);
|
|
2974
3238
|
}
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3239
|
+
getFileDownload(paramsOrFirst, ...rest) {
|
|
3240
|
+
let params;
|
|
3241
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3242
|
+
params = (paramsOrFirst || {});
|
|
3243
|
+
}
|
|
3244
|
+
else {
|
|
3245
|
+
params = {
|
|
3246
|
+
bucketId: paramsOrFirst,
|
|
3247
|
+
fileId: rest[0],
|
|
3248
|
+
token: rest[1]
|
|
3249
|
+
};
|
|
3250
|
+
}
|
|
3251
|
+
const bucketId = params.bucketId;
|
|
3252
|
+
const fileId = params.fileId;
|
|
3253
|
+
const token = params.token;
|
|
2987
3254
|
if (typeof bucketId === 'undefined') {
|
|
2988
3255
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2989
3256
|
}
|
|
@@ -3002,31 +3269,43 @@ class Storage extends Service {
|
|
|
3002
3269
|
}
|
|
3003
3270
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
3004
3271
|
}
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3272
|
+
getFilePreview(paramsOrFirst, ...rest) {
|
|
3273
|
+
let params;
|
|
3274
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3275
|
+
params = (paramsOrFirst || {});
|
|
3276
|
+
}
|
|
3277
|
+
else {
|
|
3278
|
+
params = {
|
|
3279
|
+
bucketId: paramsOrFirst,
|
|
3280
|
+
fileId: rest[0],
|
|
3281
|
+
width: rest[1],
|
|
3282
|
+
height: rest[2],
|
|
3283
|
+
gravity: rest[3],
|
|
3284
|
+
quality: rest[4],
|
|
3285
|
+
borderWidth: rest[5],
|
|
3286
|
+
borderColor: rest[6],
|
|
3287
|
+
borderRadius: rest[7],
|
|
3288
|
+
opacity: rest[8],
|
|
3289
|
+
rotation: rest[9],
|
|
3290
|
+
background: rest[10],
|
|
3291
|
+
output: rest[11],
|
|
3292
|
+
token: rest[12]
|
|
3293
|
+
};
|
|
3294
|
+
}
|
|
3295
|
+
const bucketId = params.bucketId;
|
|
3296
|
+
const fileId = params.fileId;
|
|
3297
|
+
const width = params.width;
|
|
3298
|
+
const height = params.height;
|
|
3299
|
+
const gravity = params.gravity;
|
|
3300
|
+
const quality = params.quality;
|
|
3301
|
+
const borderWidth = params.borderWidth;
|
|
3302
|
+
const borderColor = params.borderColor;
|
|
3303
|
+
const borderRadius = params.borderRadius;
|
|
3304
|
+
const opacity = params.opacity;
|
|
3305
|
+
const rotation = params.rotation;
|
|
3306
|
+
const background = params.background;
|
|
3307
|
+
const output = params.output;
|
|
3308
|
+
const token = params.token;
|
|
3030
3309
|
if (typeof bucketId === 'undefined') {
|
|
3031
3310
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
3032
3311
|
}
|
|
@@ -3078,18 +3357,21 @@ class Storage extends Service {
|
|
|
3078
3357
|
}
|
|
3079
3358
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
3080
3359
|
}
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3360
|
+
getFileView(paramsOrFirst, ...rest) {
|
|
3361
|
+
let params;
|
|
3362
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3363
|
+
params = (paramsOrFirst || {});
|
|
3364
|
+
}
|
|
3365
|
+
else {
|
|
3366
|
+
params = {
|
|
3367
|
+
bucketId: paramsOrFirst,
|
|
3368
|
+
fileId: rest[0],
|
|
3369
|
+
token: rest[1]
|
|
3370
|
+
};
|
|
3371
|
+
}
|
|
3372
|
+
const bucketId = params.bucketId;
|
|
3373
|
+
const fileId = params.fileId;
|
|
3374
|
+
const token = params.token;
|
|
3093
3375
|
if (typeof bucketId === 'undefined') {
|
|
3094
3376
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
3095
3377
|
}
|
|
@@ -3228,20 +3510,344 @@ class Storage extends Service {
|
|
|
3228
3510
|
}
|
|
3229
3511
|
}
|
|
3230
3512
|
|
|
3513
|
+
class TablesDB extends Service {
|
|
3514
|
+
constructor(client) {
|
|
3515
|
+
super(client);
|
|
3516
|
+
}
|
|
3517
|
+
listRows(paramsOrFirst, ...rest) {
|
|
3518
|
+
let params;
|
|
3519
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3520
|
+
params = (paramsOrFirst || {});
|
|
3521
|
+
}
|
|
3522
|
+
else {
|
|
3523
|
+
params = {
|
|
3524
|
+
databaseId: paramsOrFirst,
|
|
3525
|
+
tableId: rest[0],
|
|
3526
|
+
queries: rest[1]
|
|
3527
|
+
};
|
|
3528
|
+
}
|
|
3529
|
+
const databaseId = params.databaseId;
|
|
3530
|
+
const tableId = params.tableId;
|
|
3531
|
+
const queries = params.queries;
|
|
3532
|
+
if (typeof databaseId === 'undefined') {
|
|
3533
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3534
|
+
}
|
|
3535
|
+
if (typeof tableId === 'undefined') {
|
|
3536
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3537
|
+
}
|
|
3538
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
|
|
3539
|
+
const payload = {};
|
|
3540
|
+
if (typeof queries !== 'undefined') {
|
|
3541
|
+
payload['queries'] = queries;
|
|
3542
|
+
}
|
|
3543
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3544
|
+
return this.client.call('get', uri, {}, payload);
|
|
3545
|
+
}
|
|
3546
|
+
createRow(paramsOrFirst, ...rest) {
|
|
3547
|
+
let params;
|
|
3548
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3549
|
+
params = (paramsOrFirst || {});
|
|
3550
|
+
}
|
|
3551
|
+
else {
|
|
3552
|
+
params = {
|
|
3553
|
+
databaseId: paramsOrFirst,
|
|
3554
|
+
tableId: rest[0],
|
|
3555
|
+
rowId: rest[1],
|
|
3556
|
+
data: rest[2],
|
|
3557
|
+
permissions: rest[3]
|
|
3558
|
+
};
|
|
3559
|
+
}
|
|
3560
|
+
const databaseId = params.databaseId;
|
|
3561
|
+
const tableId = params.tableId;
|
|
3562
|
+
const rowId = params.rowId;
|
|
3563
|
+
const data = params.data;
|
|
3564
|
+
const permissions = params.permissions;
|
|
3565
|
+
if (typeof databaseId === 'undefined') {
|
|
3566
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3567
|
+
}
|
|
3568
|
+
if (typeof tableId === 'undefined') {
|
|
3569
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3570
|
+
}
|
|
3571
|
+
if (typeof rowId === 'undefined') {
|
|
3572
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3573
|
+
}
|
|
3574
|
+
if (typeof data === 'undefined') {
|
|
3575
|
+
throw new AppwriteException('Missing required parameter: "data"');
|
|
3576
|
+
}
|
|
3577
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
|
|
3578
|
+
const payload = {};
|
|
3579
|
+
if (typeof rowId !== 'undefined') {
|
|
3580
|
+
payload['rowId'] = rowId;
|
|
3581
|
+
}
|
|
3582
|
+
if (typeof data !== 'undefined') {
|
|
3583
|
+
payload['data'] = data;
|
|
3584
|
+
}
|
|
3585
|
+
if (typeof permissions !== 'undefined') {
|
|
3586
|
+
payload['permissions'] = permissions;
|
|
3587
|
+
}
|
|
3588
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3589
|
+
return this.client.call('post', uri, {
|
|
3590
|
+
'content-type': 'application/json',
|
|
3591
|
+
}, payload);
|
|
3592
|
+
}
|
|
3593
|
+
getRow(paramsOrFirst, ...rest) {
|
|
3594
|
+
let params;
|
|
3595
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3596
|
+
params = (paramsOrFirst || {});
|
|
3597
|
+
}
|
|
3598
|
+
else {
|
|
3599
|
+
params = {
|
|
3600
|
+
databaseId: paramsOrFirst,
|
|
3601
|
+
tableId: rest[0],
|
|
3602
|
+
rowId: rest[1],
|
|
3603
|
+
queries: rest[2]
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3606
|
+
const databaseId = params.databaseId;
|
|
3607
|
+
const tableId = params.tableId;
|
|
3608
|
+
const rowId = params.rowId;
|
|
3609
|
+
const queries = params.queries;
|
|
3610
|
+
if (typeof databaseId === 'undefined') {
|
|
3611
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3612
|
+
}
|
|
3613
|
+
if (typeof tableId === 'undefined') {
|
|
3614
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3615
|
+
}
|
|
3616
|
+
if (typeof rowId === 'undefined') {
|
|
3617
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3618
|
+
}
|
|
3619
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3620
|
+
const payload = {};
|
|
3621
|
+
if (typeof queries !== 'undefined') {
|
|
3622
|
+
payload['queries'] = queries;
|
|
3623
|
+
}
|
|
3624
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3625
|
+
return this.client.call('get', uri, {}, payload);
|
|
3626
|
+
}
|
|
3627
|
+
upsertRow(paramsOrFirst, ...rest) {
|
|
3628
|
+
let params;
|
|
3629
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3630
|
+
params = (paramsOrFirst || {});
|
|
3631
|
+
}
|
|
3632
|
+
else {
|
|
3633
|
+
params = {
|
|
3634
|
+
databaseId: paramsOrFirst,
|
|
3635
|
+
tableId: rest[0],
|
|
3636
|
+
rowId: rest[1],
|
|
3637
|
+
data: rest[2],
|
|
3638
|
+
permissions: rest[3]
|
|
3639
|
+
};
|
|
3640
|
+
}
|
|
3641
|
+
const databaseId = params.databaseId;
|
|
3642
|
+
const tableId = params.tableId;
|
|
3643
|
+
const rowId = params.rowId;
|
|
3644
|
+
const data = params.data;
|
|
3645
|
+
const permissions = params.permissions;
|
|
3646
|
+
if (typeof databaseId === 'undefined') {
|
|
3647
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3648
|
+
}
|
|
3649
|
+
if (typeof tableId === 'undefined') {
|
|
3650
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3651
|
+
}
|
|
3652
|
+
if (typeof rowId === 'undefined') {
|
|
3653
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3654
|
+
}
|
|
3655
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3656
|
+
const payload = {};
|
|
3657
|
+
if (typeof data !== 'undefined') {
|
|
3658
|
+
payload['data'] = data;
|
|
3659
|
+
}
|
|
3660
|
+
if (typeof permissions !== 'undefined') {
|
|
3661
|
+
payload['permissions'] = permissions;
|
|
3662
|
+
}
|
|
3663
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3664
|
+
return this.client.call('put', uri, {
|
|
3665
|
+
'content-type': 'application/json',
|
|
3666
|
+
}, payload);
|
|
3667
|
+
}
|
|
3668
|
+
updateRow(paramsOrFirst, ...rest) {
|
|
3669
|
+
let params;
|
|
3670
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3671
|
+
params = (paramsOrFirst || {});
|
|
3672
|
+
}
|
|
3673
|
+
else {
|
|
3674
|
+
params = {
|
|
3675
|
+
databaseId: paramsOrFirst,
|
|
3676
|
+
tableId: rest[0],
|
|
3677
|
+
rowId: rest[1],
|
|
3678
|
+
data: rest[2],
|
|
3679
|
+
permissions: rest[3]
|
|
3680
|
+
};
|
|
3681
|
+
}
|
|
3682
|
+
const databaseId = params.databaseId;
|
|
3683
|
+
const tableId = params.tableId;
|
|
3684
|
+
const rowId = params.rowId;
|
|
3685
|
+
const data = params.data;
|
|
3686
|
+
const permissions = params.permissions;
|
|
3687
|
+
if (typeof databaseId === 'undefined') {
|
|
3688
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3689
|
+
}
|
|
3690
|
+
if (typeof tableId === 'undefined') {
|
|
3691
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3692
|
+
}
|
|
3693
|
+
if (typeof rowId === 'undefined') {
|
|
3694
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3695
|
+
}
|
|
3696
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3697
|
+
const payload = {};
|
|
3698
|
+
if (typeof data !== 'undefined') {
|
|
3699
|
+
payload['data'] = data;
|
|
3700
|
+
}
|
|
3701
|
+
if (typeof permissions !== 'undefined') {
|
|
3702
|
+
payload['permissions'] = permissions;
|
|
3703
|
+
}
|
|
3704
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3705
|
+
return this.client.call('patch', uri, {
|
|
3706
|
+
'content-type': 'application/json',
|
|
3707
|
+
}, payload);
|
|
3708
|
+
}
|
|
3709
|
+
deleteRow(paramsOrFirst, ...rest) {
|
|
3710
|
+
let params;
|
|
3711
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3712
|
+
params = (paramsOrFirst || {});
|
|
3713
|
+
}
|
|
3714
|
+
else {
|
|
3715
|
+
params = {
|
|
3716
|
+
databaseId: paramsOrFirst,
|
|
3717
|
+
tableId: rest[0],
|
|
3718
|
+
rowId: rest[1]
|
|
3719
|
+
};
|
|
3720
|
+
}
|
|
3721
|
+
const databaseId = params.databaseId;
|
|
3722
|
+
const tableId = params.tableId;
|
|
3723
|
+
const rowId = params.rowId;
|
|
3724
|
+
if (typeof databaseId === 'undefined') {
|
|
3725
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3726
|
+
}
|
|
3727
|
+
if (typeof tableId === 'undefined') {
|
|
3728
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3729
|
+
}
|
|
3730
|
+
if (typeof rowId === 'undefined') {
|
|
3731
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3732
|
+
}
|
|
3733
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3734
|
+
const payload = {};
|
|
3735
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3736
|
+
return this.client.call('delete', uri, {
|
|
3737
|
+
'content-type': 'application/json',
|
|
3738
|
+
}, payload);
|
|
3739
|
+
}
|
|
3740
|
+
decrementRowColumn(paramsOrFirst, ...rest) {
|
|
3741
|
+
let params;
|
|
3742
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3743
|
+
params = (paramsOrFirst || {});
|
|
3744
|
+
}
|
|
3745
|
+
else {
|
|
3746
|
+
params = {
|
|
3747
|
+
databaseId: paramsOrFirst,
|
|
3748
|
+
tableId: rest[0],
|
|
3749
|
+
rowId: rest[1],
|
|
3750
|
+
column: rest[2],
|
|
3751
|
+
value: rest[3],
|
|
3752
|
+
min: rest[4]
|
|
3753
|
+
};
|
|
3754
|
+
}
|
|
3755
|
+
const databaseId = params.databaseId;
|
|
3756
|
+
const tableId = params.tableId;
|
|
3757
|
+
const rowId = params.rowId;
|
|
3758
|
+
const column = params.column;
|
|
3759
|
+
const value = params.value;
|
|
3760
|
+
const min = params.min;
|
|
3761
|
+
if (typeof databaseId === 'undefined') {
|
|
3762
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3763
|
+
}
|
|
3764
|
+
if (typeof tableId === 'undefined') {
|
|
3765
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3766
|
+
}
|
|
3767
|
+
if (typeof rowId === 'undefined') {
|
|
3768
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3769
|
+
}
|
|
3770
|
+
if (typeof column === 'undefined') {
|
|
3771
|
+
throw new AppwriteException('Missing required parameter: "column"');
|
|
3772
|
+
}
|
|
3773
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
|
|
3774
|
+
const payload = {};
|
|
3775
|
+
if (typeof value !== 'undefined') {
|
|
3776
|
+
payload['value'] = value;
|
|
3777
|
+
}
|
|
3778
|
+
if (typeof min !== 'undefined') {
|
|
3779
|
+
payload['min'] = min;
|
|
3780
|
+
}
|
|
3781
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3782
|
+
return this.client.call('patch', uri, {
|
|
3783
|
+
'content-type': 'application/json',
|
|
3784
|
+
}, payload);
|
|
3785
|
+
}
|
|
3786
|
+
incrementRowColumn(paramsOrFirst, ...rest) {
|
|
3787
|
+
let params;
|
|
3788
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3789
|
+
params = (paramsOrFirst || {});
|
|
3790
|
+
}
|
|
3791
|
+
else {
|
|
3792
|
+
params = {
|
|
3793
|
+
databaseId: paramsOrFirst,
|
|
3794
|
+
tableId: rest[0],
|
|
3795
|
+
rowId: rest[1],
|
|
3796
|
+
column: rest[2],
|
|
3797
|
+
value: rest[3],
|
|
3798
|
+
max: rest[4]
|
|
3799
|
+
};
|
|
3800
|
+
}
|
|
3801
|
+
const databaseId = params.databaseId;
|
|
3802
|
+
const tableId = params.tableId;
|
|
3803
|
+
const rowId = params.rowId;
|
|
3804
|
+
const column = params.column;
|
|
3805
|
+
const value = params.value;
|
|
3806
|
+
const max = params.max;
|
|
3807
|
+
if (typeof databaseId === 'undefined') {
|
|
3808
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3809
|
+
}
|
|
3810
|
+
if (typeof tableId === 'undefined') {
|
|
3811
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3812
|
+
}
|
|
3813
|
+
if (typeof rowId === 'undefined') {
|
|
3814
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3815
|
+
}
|
|
3816
|
+
if (typeof column === 'undefined') {
|
|
3817
|
+
throw new AppwriteException('Missing required parameter: "column"');
|
|
3818
|
+
}
|
|
3819
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
|
|
3820
|
+
const payload = {};
|
|
3821
|
+
if (typeof value !== 'undefined') {
|
|
3822
|
+
payload['value'] = value;
|
|
3823
|
+
}
|
|
3824
|
+
if (typeof max !== 'undefined') {
|
|
3825
|
+
payload['max'] = max;
|
|
3826
|
+
}
|
|
3827
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3828
|
+
return this.client.call('patch', uri, {
|
|
3829
|
+
'content-type': 'application/json',
|
|
3830
|
+
}, payload);
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
|
|
3231
3834
|
class Teams extends Service {
|
|
3232
3835
|
constructor(client) {
|
|
3233
3836
|
super(client);
|
|
3234
3837
|
}
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3838
|
+
list(paramsOrFirst, ...rest) {
|
|
3839
|
+
let params;
|
|
3840
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3841
|
+
params = (paramsOrFirst || {});
|
|
3842
|
+
}
|
|
3843
|
+
else {
|
|
3844
|
+
params = {
|
|
3845
|
+
queries: paramsOrFirst,
|
|
3846
|
+
search: rest[0]
|
|
3847
|
+
};
|
|
3848
|
+
}
|
|
3849
|
+
const queries = params.queries;
|
|
3850
|
+
const search = params.search;
|
|
3245
3851
|
const apiPath = '/teams';
|
|
3246
3852
|
const payload = {};
|
|
3247
3853
|
if (typeof queries !== 'undefined') {
|
|
@@ -3253,18 +3859,21 @@ class Teams extends Service {
|
|
|
3253
3859
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3254
3860
|
return this.client.call('get', uri, {}, payload);
|
|
3255
3861
|
}
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3862
|
+
create(paramsOrFirst, ...rest) {
|
|
3863
|
+
let params;
|
|
3864
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3865
|
+
params = (paramsOrFirst || {});
|
|
3866
|
+
}
|
|
3867
|
+
else {
|
|
3868
|
+
params = {
|
|
3869
|
+
teamId: paramsOrFirst,
|
|
3870
|
+
name: rest[0],
|
|
3871
|
+
roles: rest[1]
|
|
3872
|
+
};
|
|
3873
|
+
}
|
|
3874
|
+
const teamId = params.teamId;
|
|
3875
|
+
const name = params.name;
|
|
3876
|
+
const roles = params.roles;
|
|
3268
3877
|
if (typeof teamId === 'undefined') {
|
|
3269
3878
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3270
3879
|
}
|
|
@@ -3287,14 +3896,17 @@ class Teams extends Service {
|
|
|
3287
3896
|
'content-type': 'application/json',
|
|
3288
3897
|
}, payload);
|
|
3289
3898
|
}
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3899
|
+
get(paramsOrFirst) {
|
|
3900
|
+
let params;
|
|
3901
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3902
|
+
params = (paramsOrFirst || {});
|
|
3903
|
+
}
|
|
3904
|
+
else {
|
|
3905
|
+
params = {
|
|
3906
|
+
teamId: paramsOrFirst
|
|
3907
|
+
};
|
|
3908
|
+
}
|
|
3909
|
+
const teamId = params.teamId;
|
|
3298
3910
|
if (typeof teamId === 'undefined') {
|
|
3299
3911
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3300
3912
|
}
|
|
@@ -3303,15 +3915,19 @@ class Teams extends Service {
|
|
|
3303
3915
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3304
3916
|
return this.client.call('get', uri, {}, payload);
|
|
3305
3917
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3918
|
+
updateName(paramsOrFirst, ...rest) {
|
|
3919
|
+
let params;
|
|
3920
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3921
|
+
params = (paramsOrFirst || {});
|
|
3922
|
+
}
|
|
3923
|
+
else {
|
|
3924
|
+
params = {
|
|
3925
|
+
teamId: paramsOrFirst,
|
|
3926
|
+
name: rest[0]
|
|
3927
|
+
};
|
|
3928
|
+
}
|
|
3929
|
+
const teamId = params.teamId;
|
|
3930
|
+
const name = params.name;
|
|
3315
3931
|
if (typeof teamId === 'undefined') {
|
|
3316
3932
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3317
3933
|
}
|
|
@@ -3328,15 +3944,17 @@ class Teams extends Service {
|
|
|
3328
3944
|
'content-type': 'application/json',
|
|
3329
3945
|
}, payload);
|
|
3330
3946
|
}
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3947
|
+
delete(paramsOrFirst) {
|
|
3948
|
+
let params;
|
|
3949
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3950
|
+
params = (paramsOrFirst || {});
|
|
3951
|
+
}
|
|
3952
|
+
else {
|
|
3953
|
+
params = {
|
|
3954
|
+
teamId: paramsOrFirst
|
|
3955
|
+
};
|
|
3956
|
+
}
|
|
3957
|
+
const teamId = params.teamId;
|
|
3340
3958
|
if (typeof teamId === 'undefined') {
|
|
3341
3959
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3342
3960
|
}
|
|
@@ -3347,18 +3965,21 @@ class Teams extends Service {
|
|
|
3347
3965
|
'content-type': 'application/json',
|
|
3348
3966
|
}, payload);
|
|
3349
3967
|
}
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3968
|
+
listMemberships(paramsOrFirst, ...rest) {
|
|
3969
|
+
let params;
|
|
3970
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3971
|
+
params = (paramsOrFirst || {});
|
|
3972
|
+
}
|
|
3973
|
+
else {
|
|
3974
|
+
params = {
|
|
3975
|
+
teamId: paramsOrFirst,
|
|
3976
|
+
queries: rest[0],
|
|
3977
|
+
search: rest[1]
|
|
3978
|
+
};
|
|
3979
|
+
}
|
|
3980
|
+
const teamId = params.teamId;
|
|
3981
|
+
const queries = params.queries;
|
|
3982
|
+
const search = params.search;
|
|
3362
3983
|
if (typeof teamId === 'undefined') {
|
|
3363
3984
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3364
3985
|
}
|
|
@@ -3373,40 +3994,29 @@ class Teams extends Service {
|
|
|
3373
3994
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3374
3995
|
return this.client.call('get', uri, {}, payload);
|
|
3375
3996
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
* @param {string} teamId
|
|
3400
|
-
* @param {string[]} roles
|
|
3401
|
-
* @param {string} email
|
|
3402
|
-
* @param {string} userId
|
|
3403
|
-
* @param {string} phone
|
|
3404
|
-
* @param {string} url
|
|
3405
|
-
* @param {string} name
|
|
3406
|
-
* @throws {AppwriteException}
|
|
3407
|
-
* @returns {Promise}
|
|
3408
|
-
*/
|
|
3409
|
-
createMembership(teamId, roles, email, userId, phone, url, name) {
|
|
3997
|
+
createMembership(paramsOrFirst, ...rest) {
|
|
3998
|
+
let params;
|
|
3999
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4000
|
+
params = (paramsOrFirst || {});
|
|
4001
|
+
}
|
|
4002
|
+
else {
|
|
4003
|
+
params = {
|
|
4004
|
+
teamId: paramsOrFirst,
|
|
4005
|
+
roles: rest[0],
|
|
4006
|
+
email: rest[1],
|
|
4007
|
+
userId: rest[2],
|
|
4008
|
+
phone: rest[3],
|
|
4009
|
+
url: rest[4],
|
|
4010
|
+
name: rest[5]
|
|
4011
|
+
};
|
|
4012
|
+
}
|
|
4013
|
+
const teamId = params.teamId;
|
|
4014
|
+
const roles = params.roles;
|
|
4015
|
+
const email = params.email;
|
|
4016
|
+
const userId = params.userId;
|
|
4017
|
+
const phone = params.phone;
|
|
4018
|
+
const url = params.url;
|
|
4019
|
+
const name = params.name;
|
|
3410
4020
|
if (typeof teamId === 'undefined') {
|
|
3411
4021
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3412
4022
|
}
|
|
@@ -3438,17 +4048,19 @@ class Teams extends Service {
|
|
|
3438
4048
|
'content-type': 'application/json',
|
|
3439
4049
|
}, payload);
|
|
3440
4050
|
}
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
4051
|
+
getMembership(paramsOrFirst, ...rest) {
|
|
4052
|
+
let params;
|
|
4053
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4054
|
+
params = (paramsOrFirst || {});
|
|
4055
|
+
}
|
|
4056
|
+
else {
|
|
4057
|
+
params = {
|
|
4058
|
+
teamId: paramsOrFirst,
|
|
4059
|
+
membershipId: rest[0]
|
|
4060
|
+
};
|
|
4061
|
+
}
|
|
4062
|
+
const teamId = params.teamId;
|
|
4063
|
+
const membershipId = params.membershipId;
|
|
3452
4064
|
if (typeof teamId === 'undefined') {
|
|
3453
4065
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3454
4066
|
}
|
|
@@ -3460,19 +4072,21 @@ class Teams extends Service {
|
|
|
3460
4072
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3461
4073
|
return this.client.call('get', uri, {}, payload);
|
|
3462
4074
|
}
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
4075
|
+
updateMembership(paramsOrFirst, ...rest) {
|
|
4076
|
+
let params;
|
|
4077
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4078
|
+
params = (paramsOrFirst || {});
|
|
4079
|
+
}
|
|
4080
|
+
else {
|
|
4081
|
+
params = {
|
|
4082
|
+
teamId: paramsOrFirst,
|
|
4083
|
+
membershipId: rest[0],
|
|
4084
|
+
roles: rest[1]
|
|
4085
|
+
};
|
|
4086
|
+
}
|
|
4087
|
+
const teamId = params.teamId;
|
|
4088
|
+
const membershipId = params.membershipId;
|
|
4089
|
+
const roles = params.roles;
|
|
3476
4090
|
if (typeof teamId === 'undefined') {
|
|
3477
4091
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3478
4092
|
}
|
|
@@ -3492,17 +4106,19 @@ class Teams extends Service {
|
|
|
3492
4106
|
'content-type': 'application/json',
|
|
3493
4107
|
}, payload);
|
|
3494
4108
|
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
4109
|
+
deleteMembership(paramsOrFirst, ...rest) {
|
|
4110
|
+
let params;
|
|
4111
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4112
|
+
params = (paramsOrFirst || {});
|
|
4113
|
+
}
|
|
4114
|
+
else {
|
|
4115
|
+
params = {
|
|
4116
|
+
teamId: paramsOrFirst,
|
|
4117
|
+
membershipId: rest[0]
|
|
4118
|
+
};
|
|
4119
|
+
}
|
|
4120
|
+
const teamId = params.teamId;
|
|
4121
|
+
const membershipId = params.membershipId;
|
|
3506
4122
|
if (typeof teamId === 'undefined') {
|
|
3507
4123
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3508
4124
|
}
|
|
@@ -3516,23 +4132,23 @@ class Teams extends Service {
|
|
|
3516
4132
|
'content-type': 'application/json',
|
|
3517
4133
|
}, payload);
|
|
3518
4134
|
}
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
4135
|
+
updateMembershipStatus(paramsOrFirst, ...rest) {
|
|
4136
|
+
let params;
|
|
4137
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4138
|
+
params = (paramsOrFirst || {});
|
|
4139
|
+
}
|
|
4140
|
+
else {
|
|
4141
|
+
params = {
|
|
4142
|
+
teamId: paramsOrFirst,
|
|
4143
|
+
membershipId: rest[0],
|
|
4144
|
+
userId: rest[1],
|
|
4145
|
+
secret: rest[2]
|
|
4146
|
+
};
|
|
4147
|
+
}
|
|
4148
|
+
const teamId = params.teamId;
|
|
4149
|
+
const membershipId = params.membershipId;
|
|
4150
|
+
const userId = params.userId;
|
|
4151
|
+
const secret = params.secret;
|
|
3536
4152
|
if (typeof teamId === 'undefined') {
|
|
3537
4153
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3538
4154
|
}
|
|
@@ -3558,16 +4174,17 @@ class Teams extends Service {
|
|
|
3558
4174
|
'content-type': 'application/json',
|
|
3559
4175
|
}, payload);
|
|
3560
4176
|
}
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
4177
|
+
getPrefs(paramsOrFirst) {
|
|
4178
|
+
let params;
|
|
4179
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4180
|
+
params = (paramsOrFirst || {});
|
|
4181
|
+
}
|
|
4182
|
+
else {
|
|
4183
|
+
params = {
|
|
4184
|
+
teamId: paramsOrFirst
|
|
4185
|
+
};
|
|
4186
|
+
}
|
|
4187
|
+
const teamId = params.teamId;
|
|
3571
4188
|
if (typeof teamId === 'undefined') {
|
|
3572
4189
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3573
4190
|
}
|
|
@@ -3576,17 +4193,19 @@ class Teams extends Service {
|
|
|
3576
4193
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3577
4194
|
return this.client.call('get', uri, {}, payload);
|
|
3578
4195
|
}
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
4196
|
+
updatePrefs(paramsOrFirst, ...rest) {
|
|
4197
|
+
let params;
|
|
4198
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4199
|
+
params = (paramsOrFirst || {});
|
|
4200
|
+
}
|
|
4201
|
+
else {
|
|
4202
|
+
params = {
|
|
4203
|
+
teamId: paramsOrFirst,
|
|
4204
|
+
prefs: rest[0]
|
|
4205
|
+
};
|
|
4206
|
+
}
|
|
4207
|
+
const teamId = params.teamId;
|
|
4208
|
+
const prefs = params.prefs;
|
|
3590
4209
|
if (typeof teamId === 'undefined') {
|
|
3591
4210
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3592
4211
|
}
|
|
@@ -3645,7 +4264,84 @@ Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, document
|
|
|
3645
4264
|
Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
|
|
3646
4265
|
Query.limit = (limit) => new Query("limit", undefined, limit).toString();
|
|
3647
4266
|
Query.offset = (offset) => new Query("offset", undefined, offset).toString();
|
|
4267
|
+
/**
|
|
4268
|
+
* Filter resources where attribute contains the specified value.
|
|
4269
|
+
*
|
|
4270
|
+
* @param {string} attribute
|
|
4271
|
+
* @param {string | string[]} value
|
|
4272
|
+
* @returns {string}
|
|
4273
|
+
*/
|
|
3648
4274
|
Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
|
|
4275
|
+
/**
|
|
4276
|
+
* Filter resources where attribute does not contain the specified value.
|
|
4277
|
+
*
|
|
4278
|
+
* @param {string} attribute
|
|
4279
|
+
* @param {string | string[]} value
|
|
4280
|
+
* @returns {string}
|
|
4281
|
+
*/
|
|
4282
|
+
Query.notContains = (attribute, value) => new Query("notContains", attribute, value).toString();
|
|
4283
|
+
/**
|
|
4284
|
+
* Filter resources by searching attribute for value (inverse of search).
|
|
4285
|
+
* A fulltext index on attribute is required for this query to work.
|
|
4286
|
+
*
|
|
4287
|
+
* @param {string} attribute
|
|
4288
|
+
* @param {string} value
|
|
4289
|
+
* @returns {string}
|
|
4290
|
+
*/
|
|
4291
|
+
Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value).toString();
|
|
4292
|
+
/**
|
|
4293
|
+
* Filter resources where attribute is not between start and end (exclusive).
|
|
4294
|
+
*
|
|
4295
|
+
* @param {string} attribute
|
|
4296
|
+
* @param {string | number} start
|
|
4297
|
+
* @param {string | number} end
|
|
4298
|
+
* @returns {string}
|
|
4299
|
+
*/
|
|
4300
|
+
Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
|
|
4301
|
+
/**
|
|
4302
|
+
* Filter resources where attribute does not start with value.
|
|
4303
|
+
*
|
|
4304
|
+
* @param {string} attribute
|
|
4305
|
+
* @param {string} value
|
|
4306
|
+
* @returns {string}
|
|
4307
|
+
*/
|
|
4308
|
+
Query.notStartsWith = (attribute, value) => new Query("notStartsWith", attribute, value).toString();
|
|
4309
|
+
/**
|
|
4310
|
+
* Filter resources where attribute does not end with value.
|
|
4311
|
+
*
|
|
4312
|
+
* @param {string} attribute
|
|
4313
|
+
* @param {string} value
|
|
4314
|
+
* @returns {string}
|
|
4315
|
+
*/
|
|
4316
|
+
Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, value).toString();
|
|
4317
|
+
/**
|
|
4318
|
+
* Filter resources where document was created before date.
|
|
4319
|
+
*
|
|
4320
|
+
* @param {string} value
|
|
4321
|
+
* @returns {string}
|
|
4322
|
+
*/
|
|
4323
|
+
Query.createdBefore = (value) => new Query("createdBefore", undefined, value).toString();
|
|
4324
|
+
/**
|
|
4325
|
+
* Filter resources where document was created after date.
|
|
4326
|
+
*
|
|
4327
|
+
* @param {string} value
|
|
4328
|
+
* @returns {string}
|
|
4329
|
+
*/
|
|
4330
|
+
Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toString();
|
|
4331
|
+
/**
|
|
4332
|
+
* Filter resources where document was updated before date.
|
|
4333
|
+
*
|
|
4334
|
+
* @param {string} value
|
|
4335
|
+
* @returns {string}
|
|
4336
|
+
*/
|
|
4337
|
+
Query.updatedBefore = (value) => new Query("updatedBefore", undefined, value).toString();
|
|
4338
|
+
/**
|
|
4339
|
+
* Filter resources where document was updated after date.
|
|
4340
|
+
*
|
|
4341
|
+
* @param {string} value
|
|
4342
|
+
* @returns {string}
|
|
4343
|
+
*/
|
|
4344
|
+
Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toString();
|
|
3649
4345
|
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
3650
4346
|
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
3651
4347
|
|
|
@@ -4129,5 +4825,6 @@ exports.Permission = Permission;
|
|
|
4129
4825
|
exports.Query = Query;
|
|
4130
4826
|
exports.Role = Role;
|
|
4131
4827
|
exports.Storage = Storage;
|
|
4828
|
+
exports.TablesDB = TablesDB;
|
|
4132
4829
|
exports.Teams = Teams;
|
|
4133
4830
|
//# sourceMappingURL=sdk.js.map
|