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/esm/sdk.js
CHANGED
|
@@ -78,8 +78,8 @@ class Client {
|
|
|
78
78
|
'x-sdk-name': 'React Native',
|
|
79
79
|
'x-sdk-platform': 'client',
|
|
80
80
|
'x-sdk-language': 'reactnative',
|
|
81
|
-
'x-sdk-version': '0.
|
|
82
|
-
'X-Appwrite-Response-Format': '1.
|
|
81
|
+
'x-sdk-version': '0.12.0',
|
|
82
|
+
'X-Appwrite-Response-Format': '1.8.0',
|
|
83
83
|
};
|
|
84
84
|
this.realtime = {
|
|
85
85
|
socket: undefined,
|
|
@@ -463,30 +463,30 @@ class Account extends Service {
|
|
|
463
463
|
*
|
|
464
464
|
* @throws {AppwriteException}
|
|
465
465
|
* @returns {Promise}
|
|
466
|
-
|
|
466
|
+
*/
|
|
467
467
|
get() {
|
|
468
468
|
const apiPath = '/account';
|
|
469
469
|
const payload = {};
|
|
470
470
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
471
471
|
return this.client.call('get', uri, {}, payload);
|
|
472
472
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
473
|
+
create(paramsOrFirst, ...rest) {
|
|
474
|
+
let params;
|
|
475
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
476
|
+
params = (paramsOrFirst || {});
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
params = {
|
|
480
|
+
userId: paramsOrFirst,
|
|
481
|
+
email: rest[0],
|
|
482
|
+
password: rest[1],
|
|
483
|
+
name: rest[2]
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
const userId = params.userId;
|
|
487
|
+
const email = params.email;
|
|
488
|
+
const password = params.password;
|
|
489
|
+
const name = params.name;
|
|
490
490
|
if (typeof userId === 'undefined') {
|
|
491
491
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
492
492
|
}
|
|
@@ -515,22 +515,19 @@ class Account extends Service {
|
|
|
515
515
|
'content-type': 'application/json',
|
|
516
516
|
}, payload);
|
|
517
517
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
* @returns {Promise}
|
|
532
|
-
*/
|
|
533
|
-
updateEmail(email, password) {
|
|
518
|
+
updateEmail(paramsOrFirst, ...rest) {
|
|
519
|
+
let params;
|
|
520
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
521
|
+
params = (paramsOrFirst || {});
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
params = {
|
|
525
|
+
email: paramsOrFirst,
|
|
526
|
+
password: rest[0]
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
const email = params.email;
|
|
530
|
+
const password = params.password;
|
|
534
531
|
if (typeof email === 'undefined') {
|
|
535
532
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
536
533
|
}
|
|
@@ -550,14 +547,17 @@ class Account extends Service {
|
|
|
550
547
|
'content-type': 'application/json',
|
|
551
548
|
}, payload);
|
|
552
549
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
550
|
+
listIdentities(paramsOrFirst) {
|
|
551
|
+
let params;
|
|
552
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
553
|
+
params = (paramsOrFirst || {});
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
params = {
|
|
557
|
+
queries: paramsOrFirst
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
const queries = params.queries;
|
|
561
561
|
const apiPath = '/account/identities';
|
|
562
562
|
const payload = {};
|
|
563
563
|
if (typeof queries !== 'undefined') {
|
|
@@ -566,14 +566,17 @@ class Account extends Service {
|
|
|
566
566
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
567
567
|
return this.client.call('get', uri, {}, payload);
|
|
568
568
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
569
|
+
deleteIdentity(paramsOrFirst) {
|
|
570
|
+
let params;
|
|
571
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
572
|
+
params = (paramsOrFirst || {});
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
params = {
|
|
576
|
+
identityId: paramsOrFirst
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
const identityId = params.identityId;
|
|
577
580
|
if (typeof identityId === 'undefined') {
|
|
578
581
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
579
582
|
}
|
|
@@ -585,15 +588,11 @@ class Account extends Service {
|
|
|
585
588
|
}, payload);
|
|
586
589
|
}
|
|
587
590
|
/**
|
|
588
|
-
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT
|
|
589
|
-
* to authenticate on behalf of the current user when working with the
|
|
590
|
-
* Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
|
|
591
|
-
* from its creation and will be invalid if the user will logout in that time
|
|
592
|
-
* frame.
|
|
591
|
+
* 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.
|
|
593
592
|
*
|
|
594
593
|
* @throws {AppwriteException}
|
|
595
594
|
* @returns {Promise}
|
|
596
|
-
|
|
595
|
+
*/
|
|
597
596
|
createJWT() {
|
|
598
597
|
const apiPath = '/account/jwts';
|
|
599
598
|
const payload = {};
|
|
@@ -602,15 +601,17 @@ class Account extends Service {
|
|
|
602
601
|
'content-type': 'application/json',
|
|
603
602
|
}, payload);
|
|
604
603
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
604
|
+
listLogs(paramsOrFirst) {
|
|
605
|
+
let params;
|
|
606
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
607
|
+
params = (paramsOrFirst || {});
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
params = {
|
|
611
|
+
queries: paramsOrFirst
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
const queries = params.queries;
|
|
614
615
|
const apiPath = '/account/logs';
|
|
615
616
|
const payload = {};
|
|
616
617
|
if (typeof queries !== 'undefined') {
|
|
@@ -619,14 +620,17 @@ class Account extends Service {
|
|
|
619
620
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
620
621
|
return this.client.call('get', uri, {}, payload);
|
|
621
622
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
updateMFA(paramsOrFirst) {
|
|
624
|
+
let params;
|
|
625
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
626
|
+
params = (paramsOrFirst || {});
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
params = {
|
|
630
|
+
mfa: paramsOrFirst
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
const mfa = params.mfa;
|
|
630
634
|
if (typeof mfa === 'undefined') {
|
|
631
635
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
632
636
|
}
|
|
@@ -640,17 +644,17 @@ class Account extends Service {
|
|
|
640
644
|
'content-type': 'application/json',
|
|
641
645
|
}, payload);
|
|
642
646
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
647
|
+
createMfaAuthenticator(paramsOrFirst) {
|
|
648
|
+
let params;
|
|
649
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
650
|
+
params = (paramsOrFirst || {});
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
params = {
|
|
654
|
+
type: paramsOrFirst
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
const type = params.type;
|
|
654
658
|
if (typeof type === 'undefined') {
|
|
655
659
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
656
660
|
}
|
|
@@ -661,17 +665,40 @@ class Account extends Service {
|
|
|
661
665
|
'content-type': 'application/json',
|
|
662
666
|
}, payload);
|
|
663
667
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
668
|
+
createMFAAuthenticator(paramsOrFirst) {
|
|
669
|
+
let params;
|
|
670
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
671
|
+
params = (paramsOrFirst || {});
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
params = {
|
|
675
|
+
type: paramsOrFirst
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
const type = params.type;
|
|
679
|
+
if (typeof type === 'undefined') {
|
|
680
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
681
|
+
}
|
|
682
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
683
|
+
const payload = {};
|
|
684
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
685
|
+
return this.client.call('post', uri, {
|
|
686
|
+
'content-type': 'application/json',
|
|
687
|
+
}, payload);
|
|
688
|
+
}
|
|
689
|
+
updateMfaAuthenticator(paramsOrFirst, ...rest) {
|
|
690
|
+
let params;
|
|
691
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
692
|
+
params = (paramsOrFirst || {});
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
params = {
|
|
696
|
+
type: paramsOrFirst,
|
|
697
|
+
otp: rest[0]
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
const type = params.type;
|
|
701
|
+
const otp = params.otp;
|
|
675
702
|
if (typeof type === 'undefined') {
|
|
676
703
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
677
704
|
}
|
|
@@ -688,14 +715,46 @@ class Account extends Service {
|
|
|
688
715
|
'content-type': 'application/json',
|
|
689
716
|
}, payload);
|
|
690
717
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
718
|
+
updateMFAAuthenticator(paramsOrFirst, ...rest) {
|
|
719
|
+
let params;
|
|
720
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
721
|
+
params = (paramsOrFirst || {});
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
params = {
|
|
725
|
+
type: paramsOrFirst,
|
|
726
|
+
otp: rest[0]
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
const type = params.type;
|
|
730
|
+
const otp = params.otp;
|
|
731
|
+
if (typeof type === 'undefined') {
|
|
732
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
733
|
+
}
|
|
734
|
+
if (typeof otp === 'undefined') {
|
|
735
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
736
|
+
}
|
|
737
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
738
|
+
const payload = {};
|
|
739
|
+
if (typeof otp !== 'undefined') {
|
|
740
|
+
payload['otp'] = otp;
|
|
741
|
+
}
|
|
742
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
743
|
+
return this.client.call('put', uri, {
|
|
744
|
+
'content-type': 'application/json',
|
|
745
|
+
}, payload);
|
|
746
|
+
}
|
|
747
|
+
deleteMfaAuthenticator(paramsOrFirst) {
|
|
748
|
+
let params;
|
|
749
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
750
|
+
params = (paramsOrFirst || {});
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
params = {
|
|
754
|
+
type: paramsOrFirst
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
const type = params.type;
|
|
699
758
|
if (typeof type === 'undefined') {
|
|
700
759
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
701
760
|
}
|
|
@@ -706,16 +765,38 @@ class Account extends Service {
|
|
|
706
765
|
'content-type': 'application/json',
|
|
707
766
|
}, payload);
|
|
708
767
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
768
|
+
deleteMFAAuthenticator(paramsOrFirst) {
|
|
769
|
+
let params;
|
|
770
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
771
|
+
params = (paramsOrFirst || {});
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
params = {
|
|
775
|
+
type: paramsOrFirst
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
const type = params.type;
|
|
779
|
+
if (typeof type === 'undefined') {
|
|
780
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
781
|
+
}
|
|
782
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
783
|
+
const payload = {};
|
|
784
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
785
|
+
return this.client.call('delete', uri, {
|
|
786
|
+
'content-type': 'application/json',
|
|
787
|
+
}, payload);
|
|
788
|
+
}
|
|
789
|
+
createMfaChallenge(paramsOrFirst) {
|
|
790
|
+
let params;
|
|
791
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
792
|
+
params = (paramsOrFirst || {});
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
params = {
|
|
796
|
+
factor: paramsOrFirst
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
const factor = params.factor;
|
|
719
800
|
if (typeof factor === 'undefined') {
|
|
720
801
|
throw new AppwriteException('Missing required parameter: "factor"');
|
|
721
802
|
}
|
|
@@ -729,19 +810,75 @@ class Account extends Service {
|
|
|
729
810
|
'content-type': 'application/json',
|
|
730
811
|
}, payload);
|
|
731
812
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
813
|
+
createMFAChallenge(paramsOrFirst) {
|
|
814
|
+
let params;
|
|
815
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
816
|
+
params = (paramsOrFirst || {});
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
params = {
|
|
820
|
+
factor: paramsOrFirst
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
const factor = params.factor;
|
|
824
|
+
if (typeof factor === 'undefined') {
|
|
825
|
+
throw new AppwriteException('Missing required parameter: "factor"');
|
|
826
|
+
}
|
|
827
|
+
const apiPath = '/account/mfa/challenge';
|
|
828
|
+
const payload = {};
|
|
829
|
+
if (typeof factor !== 'undefined') {
|
|
830
|
+
payload['factor'] = factor;
|
|
831
|
+
}
|
|
832
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
833
|
+
return this.client.call('post', uri, {
|
|
834
|
+
'content-type': 'application/json',
|
|
835
|
+
}, payload);
|
|
836
|
+
}
|
|
837
|
+
updateMfaChallenge(paramsOrFirst, ...rest) {
|
|
838
|
+
let params;
|
|
839
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
840
|
+
params = (paramsOrFirst || {});
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
params = {
|
|
844
|
+
challengeId: paramsOrFirst,
|
|
845
|
+
otp: rest[0]
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
const challengeId = params.challengeId;
|
|
849
|
+
const otp = params.otp;
|
|
850
|
+
if (typeof challengeId === 'undefined') {
|
|
851
|
+
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
852
|
+
}
|
|
853
|
+
if (typeof otp === 'undefined') {
|
|
854
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
855
|
+
}
|
|
856
|
+
const apiPath = '/account/mfa/challenge';
|
|
857
|
+
const payload = {};
|
|
858
|
+
if (typeof challengeId !== 'undefined') {
|
|
859
|
+
payload['challengeId'] = challengeId;
|
|
860
|
+
}
|
|
861
|
+
if (typeof otp !== 'undefined') {
|
|
862
|
+
payload['otp'] = otp;
|
|
863
|
+
}
|
|
864
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
865
|
+
return this.client.call('put', uri, {
|
|
866
|
+
'content-type': 'application/json',
|
|
867
|
+
}, payload);
|
|
868
|
+
}
|
|
869
|
+
updateMFAChallenge(paramsOrFirst, ...rest) {
|
|
870
|
+
let params;
|
|
871
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
872
|
+
params = (paramsOrFirst || {});
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
params = {
|
|
876
|
+
challengeId: paramsOrFirst,
|
|
877
|
+
otp: rest[0]
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
const challengeId = params.challengeId;
|
|
881
|
+
const otp = params.otp;
|
|
745
882
|
if (typeof challengeId === 'undefined') {
|
|
746
883
|
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
747
884
|
}
|
|
@@ -766,7 +903,8 @@ class Account extends Service {
|
|
|
766
903
|
*
|
|
767
904
|
* @throws {AppwriteException}
|
|
768
905
|
* @returns {Promise}
|
|
769
|
-
|
|
906
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
|
|
907
|
+
*/
|
|
770
908
|
listMfaFactors() {
|
|
771
909
|
const apiPath = '/account/mfa/factors';
|
|
772
910
|
const payload = {};
|
|
@@ -774,14 +912,24 @@ class Account extends Service {
|
|
|
774
912
|
return this.client.call('get', uri, {}, payload);
|
|
775
913
|
}
|
|
776
914
|
/**
|
|
777
|
-
*
|
|
778
|
-
* codes, they must be generated using
|
|
779
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
780
|
-
* method. An OTP challenge is required to read recovery codes.
|
|
915
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
781
916
|
*
|
|
782
917
|
* @throws {AppwriteException}
|
|
783
918
|
* @returns {Promise}
|
|
784
|
-
|
|
919
|
+
*/
|
|
920
|
+
listMFAFactors() {
|
|
921
|
+
const apiPath = '/account/mfa/factors';
|
|
922
|
+
const payload = {};
|
|
923
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
924
|
+
return this.client.call('get', uri, {}, payload);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* 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.
|
|
928
|
+
*
|
|
929
|
+
* @throws {AppwriteException}
|
|
930
|
+
* @returns {Promise}
|
|
931
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
|
|
932
|
+
*/
|
|
785
933
|
getMfaRecoveryCodes() {
|
|
786
934
|
const apiPath = '/account/mfa/recovery-codes';
|
|
787
935
|
const payload = {};
|
|
@@ -789,15 +937,24 @@ class Account extends Service {
|
|
|
789
937
|
return this.client.call('get', uri, {}, payload);
|
|
790
938
|
}
|
|
791
939
|
/**
|
|
792
|
-
*
|
|
793
|
-
* generate and show then immediately after user successfully adds their
|
|
794
|
-
* authehticator. Recovery codes can be used as a MFA verification type in
|
|
795
|
-
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
|
|
796
|
-
* method.
|
|
940
|
+
* 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.
|
|
797
941
|
*
|
|
798
942
|
* @throws {AppwriteException}
|
|
799
943
|
* @returns {Promise}
|
|
800
|
-
|
|
944
|
+
*/
|
|
945
|
+
getMFARecoveryCodes() {
|
|
946
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
947
|
+
const payload = {};
|
|
948
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
949
|
+
return this.client.call('get', uri, {}, payload);
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* 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.
|
|
953
|
+
*
|
|
954
|
+
* @throws {AppwriteException}
|
|
955
|
+
* @returns {Promise}
|
|
956
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
|
|
957
|
+
*/
|
|
801
958
|
createMfaRecoveryCodes() {
|
|
802
959
|
const apiPath = '/account/mfa/recovery-codes';
|
|
803
960
|
const payload = {};
|
|
@@ -807,14 +964,26 @@ class Account extends Service {
|
|
|
807
964
|
}, payload);
|
|
808
965
|
}
|
|
809
966
|
/**
|
|
810
|
-
*
|
|
811
|
-
* regenerating codes, they must be first generated using
|
|
812
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
813
|
-
* method. An OTP challenge is required to regenreate recovery codes.
|
|
967
|
+
* 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.
|
|
814
968
|
*
|
|
815
969
|
* @throws {AppwriteException}
|
|
816
970
|
* @returns {Promise}
|
|
817
|
-
|
|
971
|
+
*/
|
|
972
|
+
createMFARecoveryCodes() {
|
|
973
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
974
|
+
const payload = {};
|
|
975
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
976
|
+
return this.client.call('post', uri, {
|
|
977
|
+
'content-type': 'application/json',
|
|
978
|
+
}, payload);
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* 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.
|
|
982
|
+
*
|
|
983
|
+
* @throws {AppwriteException}
|
|
984
|
+
* @returns {Promise}
|
|
985
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
|
|
986
|
+
*/
|
|
818
987
|
updateMfaRecoveryCodes() {
|
|
819
988
|
const apiPath = '/account/mfa/recovery-codes';
|
|
820
989
|
const payload = {};
|
|
@@ -824,13 +993,30 @@ class Account extends Service {
|
|
|
824
993
|
}, payload);
|
|
825
994
|
}
|
|
826
995
|
/**
|
|
827
|
-
*
|
|
996
|
+
* 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.
|
|
828
997
|
*
|
|
829
|
-
* @param {string} name
|
|
830
998
|
* @throws {AppwriteException}
|
|
831
999
|
* @returns {Promise}
|
|
832
|
-
|
|
833
|
-
|
|
1000
|
+
*/
|
|
1001
|
+
updateMFARecoveryCodes() {
|
|
1002
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
1003
|
+
const payload = {};
|
|
1004
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1005
|
+
return this.client.call('patch', uri, {
|
|
1006
|
+
'content-type': 'application/json',
|
|
1007
|
+
}, payload);
|
|
1008
|
+
}
|
|
1009
|
+
updateName(paramsOrFirst) {
|
|
1010
|
+
let params;
|
|
1011
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1012
|
+
params = (paramsOrFirst || {});
|
|
1013
|
+
}
|
|
1014
|
+
else {
|
|
1015
|
+
params = {
|
|
1016
|
+
name: paramsOrFirst
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
const name = params.name;
|
|
834
1020
|
if (typeof name === 'undefined') {
|
|
835
1021
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
836
1022
|
}
|
|
@@ -844,17 +1030,19 @@ class Account extends Service {
|
|
|
844
1030
|
'content-type': 'application/json',
|
|
845
1031
|
}, payload);
|
|
846
1032
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1033
|
+
updatePassword(paramsOrFirst, ...rest) {
|
|
1034
|
+
let params;
|
|
1035
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1036
|
+
params = (paramsOrFirst || {});
|
|
1037
|
+
}
|
|
1038
|
+
else {
|
|
1039
|
+
params = {
|
|
1040
|
+
password: paramsOrFirst,
|
|
1041
|
+
oldPassword: rest[0]
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
const password = params.password;
|
|
1045
|
+
const oldPassword = params.oldPassword;
|
|
858
1046
|
if (typeof password === 'undefined') {
|
|
859
1047
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
860
1048
|
}
|
|
@@ -871,19 +1059,19 @@ class Account extends Service {
|
|
|
871
1059
|
'content-type': 'application/json',
|
|
872
1060
|
}, payload);
|
|
873
1061
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1062
|
+
updatePhone(paramsOrFirst, ...rest) {
|
|
1063
|
+
let params;
|
|
1064
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1065
|
+
params = (paramsOrFirst || {});
|
|
1066
|
+
}
|
|
1067
|
+
else {
|
|
1068
|
+
params = {
|
|
1069
|
+
phone: paramsOrFirst,
|
|
1070
|
+
password: rest[0]
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
const phone = params.phone;
|
|
1074
|
+
const password = params.password;
|
|
887
1075
|
if (typeof phone === 'undefined') {
|
|
888
1076
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
889
1077
|
}
|
|
@@ -908,23 +1096,24 @@ class Account extends Service {
|
|
|
908
1096
|
*
|
|
909
1097
|
* @throws {AppwriteException}
|
|
910
1098
|
* @returns {Promise}
|
|
911
|
-
|
|
1099
|
+
*/
|
|
912
1100
|
getPrefs() {
|
|
913
1101
|
const apiPath = '/account/prefs';
|
|
914
1102
|
const payload = {};
|
|
915
1103
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
916
1104
|
return this.client.call('get', uri, {}, payload);
|
|
917
1105
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1106
|
+
updatePrefs(paramsOrFirst) {
|
|
1107
|
+
let params;
|
|
1108
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst)) {
|
|
1109
|
+
params = (paramsOrFirst || {});
|
|
1110
|
+
}
|
|
1111
|
+
else {
|
|
1112
|
+
params = {
|
|
1113
|
+
prefs: paramsOrFirst
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
const prefs = params.prefs;
|
|
928
1117
|
if (typeof prefs === 'undefined') {
|
|
929
1118
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
930
1119
|
}
|
|
@@ -938,22 +1127,19 @@ class Account extends Service {
|
|
|
938
1127
|
'content-type': 'application/json',
|
|
939
1128
|
}, payload);
|
|
940
1129
|
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
* @returns {Promise}
|
|
955
|
-
*/
|
|
956
|
-
createRecovery(email, url) {
|
|
1130
|
+
createRecovery(paramsOrFirst, ...rest) {
|
|
1131
|
+
let params;
|
|
1132
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1133
|
+
params = (paramsOrFirst || {});
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
params = {
|
|
1137
|
+
email: paramsOrFirst,
|
|
1138
|
+
url: rest[0]
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
const email = params.email;
|
|
1142
|
+
const url = params.url;
|
|
957
1143
|
if (typeof email === 'undefined') {
|
|
958
1144
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
959
1145
|
}
|
|
@@ -973,25 +1159,21 @@ class Account extends Service {
|
|
|
973
1159
|
'content-type': 'application/json',
|
|
974
1160
|
}, payload);
|
|
975
1161
|
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
* @throws {AppwriteException}
|
|
992
|
-
* @returns {Promise}
|
|
993
|
-
*/
|
|
994
|
-
updateRecovery(userId, secret, password) {
|
|
1162
|
+
updateRecovery(paramsOrFirst, ...rest) {
|
|
1163
|
+
let params;
|
|
1164
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1165
|
+
params = (paramsOrFirst || {});
|
|
1166
|
+
}
|
|
1167
|
+
else {
|
|
1168
|
+
params = {
|
|
1169
|
+
userId: paramsOrFirst,
|
|
1170
|
+
secret: rest[0],
|
|
1171
|
+
password: rest[1]
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
const userId = params.userId;
|
|
1175
|
+
const secret = params.secret;
|
|
1176
|
+
const password = params.password;
|
|
995
1177
|
if (typeof userId === 'undefined') {
|
|
996
1178
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
997
1179
|
}
|
|
@@ -1018,12 +1200,11 @@ class Account extends Service {
|
|
|
1018
1200
|
}, payload);
|
|
1019
1201
|
}
|
|
1020
1202
|
/**
|
|
1021
|
-
* Get the list of active sessions across different devices for the currently
|
|
1022
|
-
* logged in user.
|
|
1203
|
+
* Get the list of active sessions across different devices for the currently logged in user.
|
|
1023
1204
|
*
|
|
1024
1205
|
* @throws {AppwriteException}
|
|
1025
1206
|
* @returns {Promise}
|
|
1026
|
-
|
|
1207
|
+
*/
|
|
1027
1208
|
listSessions() {
|
|
1028
1209
|
const apiPath = '/account/sessions';
|
|
1029
1210
|
const payload = {};
|
|
@@ -1031,12 +1212,11 @@ class Account extends Service {
|
|
|
1031
1212
|
return this.client.call('get', uri, {}, payload);
|
|
1032
1213
|
}
|
|
1033
1214
|
/**
|
|
1034
|
-
* Delete all sessions from the user account and remove any sessions cookies
|
|
1035
|
-
* from the end client.
|
|
1215
|
+
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
|
1036
1216
|
*
|
|
1037
1217
|
* @throws {AppwriteException}
|
|
1038
1218
|
* @returns {Promise}
|
|
1039
|
-
|
|
1219
|
+
*/
|
|
1040
1220
|
deleteSessions() {
|
|
1041
1221
|
const apiPath = '/account/sessions';
|
|
1042
1222
|
const payload = {};
|
|
@@ -1046,17 +1226,11 @@ class Account extends Service {
|
|
|
1046
1226
|
}, payload);
|
|
1047
1227
|
}
|
|
1048
1228
|
/**
|
|
1049
|
-
* Use this endpoint to allow a new user to register an anonymous account in
|
|
1050
|
-
* your project. This route will also create a new session for the user. To
|
|
1051
|
-
* allow the new user to convert an anonymous account to a normal account, you
|
|
1052
|
-
* need to update its [email and
|
|
1053
|
-
* password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
|
|
1054
|
-
* or create an [OAuth2
|
|
1055
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
1229
|
+
* 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).
|
|
1056
1230
|
*
|
|
1057
1231
|
* @throws {AppwriteException}
|
|
1058
1232
|
* @returns {Promise}
|
|
1059
|
-
|
|
1233
|
+
*/
|
|
1060
1234
|
createAnonymousSession() {
|
|
1061
1235
|
const apiPath = '/account/sessions/anonymous';
|
|
1062
1236
|
const payload = {};
|
|
@@ -1065,20 +1239,19 @@ class Account extends Service {
|
|
|
1065
1239
|
'content-type': 'application/json',
|
|
1066
1240
|
}, payload);
|
|
1067
1241
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
createEmailPasswordSession(email, password) {
|
|
1242
|
+
createEmailPasswordSession(paramsOrFirst, ...rest) {
|
|
1243
|
+
let params;
|
|
1244
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1245
|
+
params = (paramsOrFirst || {});
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
params = {
|
|
1249
|
+
email: paramsOrFirst,
|
|
1250
|
+
password: rest[0]
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
const email = params.email;
|
|
1254
|
+
const password = params.password;
|
|
1082
1255
|
if (typeof email === 'undefined') {
|
|
1083
1256
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
1084
1257
|
}
|
|
@@ -1098,17 +1271,19 @@ class Account extends Service {
|
|
|
1098
1271
|
'content-type': 'application/json',
|
|
1099
1272
|
}, payload);
|
|
1100
1273
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1274
|
+
updateMagicURLSession(paramsOrFirst, ...rest) {
|
|
1275
|
+
let params;
|
|
1276
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1277
|
+
params = (paramsOrFirst || {});
|
|
1278
|
+
}
|
|
1279
|
+
else {
|
|
1280
|
+
params = {
|
|
1281
|
+
userId: paramsOrFirst,
|
|
1282
|
+
secret: rest[0]
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
const userId = params.userId;
|
|
1286
|
+
const secret = params.secret;
|
|
1112
1287
|
if (typeof userId === 'undefined') {
|
|
1113
1288
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1114
1289
|
}
|
|
@@ -1128,32 +1303,23 @@ class Account extends Service {
|
|
|
1128
1303
|
'content-type': 'application/json',
|
|
1129
1304
|
}, payload);
|
|
1130
1305
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
*
|
|
1149
|
-
* @param {OAuthProvider} provider
|
|
1150
|
-
* @param {string} success
|
|
1151
|
-
* @param {string} failure
|
|
1152
|
-
* @param {string[]} scopes
|
|
1153
|
-
* @throws {AppwriteException}
|
|
1154
|
-
* @returns {void|string}
|
|
1155
|
-
*/
|
|
1156
|
-
createOAuth2Session(provider, success, failure, scopes) {
|
|
1306
|
+
createOAuth2Session(paramsOrFirst, ...rest) {
|
|
1307
|
+
let params;
|
|
1308
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
1309
|
+
params = (paramsOrFirst || {});
|
|
1310
|
+
}
|
|
1311
|
+
else {
|
|
1312
|
+
params = {
|
|
1313
|
+
provider: paramsOrFirst,
|
|
1314
|
+
success: rest[0],
|
|
1315
|
+
failure: rest[1],
|
|
1316
|
+
scopes: rest[2]
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
const provider = params.provider;
|
|
1320
|
+
const success = params.success;
|
|
1321
|
+
const failure = params.failure;
|
|
1322
|
+
const scopes = params.scopes;
|
|
1157
1323
|
if (typeof provider === 'undefined') {
|
|
1158
1324
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1159
1325
|
}
|
|
@@ -1175,17 +1341,19 @@ class Account extends Service {
|
|
|
1175
1341
|
}
|
|
1176
1342
|
return uri;
|
|
1177
1343
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1344
|
+
updatePhoneSession(paramsOrFirst, ...rest) {
|
|
1345
|
+
let params;
|
|
1346
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1347
|
+
params = (paramsOrFirst || {});
|
|
1348
|
+
}
|
|
1349
|
+
else {
|
|
1350
|
+
params = {
|
|
1351
|
+
userId: paramsOrFirst,
|
|
1352
|
+
secret: rest[0]
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
const userId = params.userId;
|
|
1356
|
+
const secret = params.secret;
|
|
1189
1357
|
if (typeof userId === 'undefined') {
|
|
1190
1358
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1191
1359
|
}
|
|
@@ -1205,17 +1373,19 @@ class Account extends Service {
|
|
|
1205
1373
|
'content-type': 'application/json',
|
|
1206
1374
|
}, payload);
|
|
1207
1375
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1376
|
+
createSession(paramsOrFirst, ...rest) {
|
|
1377
|
+
let params;
|
|
1378
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1379
|
+
params = (paramsOrFirst || {});
|
|
1380
|
+
}
|
|
1381
|
+
else {
|
|
1382
|
+
params = {
|
|
1383
|
+
userId: paramsOrFirst,
|
|
1384
|
+
secret: rest[0]
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
const userId = params.userId;
|
|
1388
|
+
const secret = params.secret;
|
|
1219
1389
|
if (typeof userId === 'undefined') {
|
|
1220
1390
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1221
1391
|
}
|
|
@@ -1235,15 +1405,17 @@ class Account extends Service {
|
|
|
1235
1405
|
'content-type': 'application/json',
|
|
1236
1406
|
}, payload);
|
|
1237
1407
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1408
|
+
getSession(paramsOrFirst) {
|
|
1409
|
+
let params;
|
|
1410
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1411
|
+
params = (paramsOrFirst || {});
|
|
1412
|
+
}
|
|
1413
|
+
else {
|
|
1414
|
+
params = {
|
|
1415
|
+
sessionId: paramsOrFirst
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
const sessionId = params.sessionId;
|
|
1247
1419
|
if (typeof sessionId === 'undefined') {
|
|
1248
1420
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1249
1421
|
}
|
|
@@ -1252,16 +1424,17 @@ class Account extends Service {
|
|
|
1252
1424
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1253
1425
|
return this.client.call('get', uri, {}, payload);
|
|
1254
1426
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1427
|
+
updateSession(paramsOrFirst) {
|
|
1428
|
+
let params;
|
|
1429
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1430
|
+
params = (paramsOrFirst || {});
|
|
1431
|
+
}
|
|
1432
|
+
else {
|
|
1433
|
+
params = {
|
|
1434
|
+
sessionId: paramsOrFirst
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
const sessionId = params.sessionId;
|
|
1265
1438
|
if (typeof sessionId === 'undefined') {
|
|
1266
1439
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1267
1440
|
}
|
|
@@ -1272,18 +1445,17 @@ class Account extends Service {
|
|
|
1272
1445
|
'content-type': 'application/json',
|
|
1273
1446
|
}, payload);
|
|
1274
1447
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
deleteSession(sessionId) {
|
|
1448
|
+
deleteSession(paramsOrFirst) {
|
|
1449
|
+
let params;
|
|
1450
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1451
|
+
params = (paramsOrFirst || {});
|
|
1452
|
+
}
|
|
1453
|
+
else {
|
|
1454
|
+
params = {
|
|
1455
|
+
sessionId: paramsOrFirst
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
const sessionId = params.sessionId;
|
|
1287
1459
|
if (typeof sessionId === 'undefined') {
|
|
1288
1460
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1289
1461
|
}
|
|
@@ -1295,13 +1467,11 @@ class Account extends Service {
|
|
|
1295
1467
|
}, payload);
|
|
1296
1468
|
}
|
|
1297
1469
|
/**
|
|
1298
|
-
* Block the currently logged in user account. Behind the scene, the user
|
|
1299
|
-
* record is not deleted but permanently blocked from any access. To
|
|
1300
|
-
* completely delete a user, use the Users API instead.
|
|
1470
|
+
* 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.
|
|
1301
1471
|
*
|
|
1302
1472
|
* @throws {AppwriteException}
|
|
1303
1473
|
* @returns {Promise}
|
|
1304
|
-
|
|
1474
|
+
*/
|
|
1305
1475
|
updateStatus() {
|
|
1306
1476
|
const apiPath = '/account/status';
|
|
1307
1477
|
const payload = {};
|
|
@@ -1310,20 +1480,21 @@ class Account extends Service {
|
|
|
1310
1480
|
'content-type': 'application/json',
|
|
1311
1481
|
}, payload);
|
|
1312
1482
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1483
|
+
createPushTarget(paramsOrFirst, ...rest) {
|
|
1484
|
+
let params;
|
|
1485
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1486
|
+
params = (paramsOrFirst || {});
|
|
1487
|
+
}
|
|
1488
|
+
else {
|
|
1489
|
+
params = {
|
|
1490
|
+
targetId: paramsOrFirst,
|
|
1491
|
+
identifier: rest[0],
|
|
1492
|
+
providerId: rest[1]
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
const targetId = params.targetId;
|
|
1496
|
+
const identifier = params.identifier;
|
|
1497
|
+
const providerId = params.providerId;
|
|
1327
1498
|
if (typeof targetId === 'undefined') {
|
|
1328
1499
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1329
1500
|
}
|
|
@@ -1346,19 +1517,19 @@ class Account extends Service {
|
|
|
1346
1517
|
'content-type': 'application/json',
|
|
1347
1518
|
}, payload);
|
|
1348
1519
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1520
|
+
updatePushTarget(paramsOrFirst, ...rest) {
|
|
1521
|
+
let params;
|
|
1522
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1523
|
+
params = (paramsOrFirst || {});
|
|
1524
|
+
}
|
|
1525
|
+
else {
|
|
1526
|
+
params = {
|
|
1527
|
+
targetId: paramsOrFirst,
|
|
1528
|
+
identifier: rest[0]
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
const targetId = params.targetId;
|
|
1532
|
+
const identifier = params.identifier;
|
|
1362
1533
|
if (typeof targetId === 'undefined') {
|
|
1363
1534
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1364
1535
|
}
|
|
@@ -1375,16 +1546,17 @@ class Account extends Service {
|
|
|
1375
1546
|
'content-type': 'application/json',
|
|
1376
1547
|
}, payload);
|
|
1377
1548
|
}
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1549
|
+
deletePushTarget(paramsOrFirst) {
|
|
1550
|
+
let params;
|
|
1551
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1552
|
+
params = (paramsOrFirst || {});
|
|
1553
|
+
}
|
|
1554
|
+
else {
|
|
1555
|
+
params = {
|
|
1556
|
+
targetId: paramsOrFirst
|
|
1557
|
+
};
|
|
1558
|
+
}
|
|
1559
|
+
const targetId = params.targetId;
|
|
1388
1560
|
if (typeof targetId === 'undefined') {
|
|
1389
1561
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1390
1562
|
}
|
|
@@ -1395,25 +1567,21 @@ class Account extends Service {
|
|
|
1395
1567
|
'content-type': 'application/json',
|
|
1396
1568
|
}, payload);
|
|
1397
1569
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
* @throws {AppwriteException}
|
|
1414
|
-
* @returns {Promise}
|
|
1415
|
-
*/
|
|
1416
|
-
createEmailToken(userId, email, phrase) {
|
|
1570
|
+
createEmailToken(paramsOrFirst, ...rest) {
|
|
1571
|
+
let params;
|
|
1572
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1573
|
+
params = (paramsOrFirst || {});
|
|
1574
|
+
}
|
|
1575
|
+
else {
|
|
1576
|
+
params = {
|
|
1577
|
+
userId: paramsOrFirst,
|
|
1578
|
+
email: rest[0],
|
|
1579
|
+
phrase: rest[1]
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
const userId = params.userId;
|
|
1583
|
+
const email = params.email;
|
|
1584
|
+
const phrase = params.phrase;
|
|
1417
1585
|
if (typeof userId === 'undefined') {
|
|
1418
1586
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1419
1587
|
}
|
|
@@ -1436,30 +1604,23 @@ class Account extends Service {
|
|
|
1436
1604
|
'content-type': 'application/json',
|
|
1437
1605
|
}, payload);
|
|
1438
1606
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
* @param {string} email
|
|
1457
|
-
* @param {string} url
|
|
1458
|
-
* @param {boolean} phrase
|
|
1459
|
-
* @throws {AppwriteException}
|
|
1460
|
-
* @returns {Promise}
|
|
1461
|
-
*/
|
|
1462
|
-
createMagicURLToken(userId, email, url, phrase) {
|
|
1607
|
+
createMagicURLToken(paramsOrFirst, ...rest) {
|
|
1608
|
+
let params;
|
|
1609
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1610
|
+
params = (paramsOrFirst || {});
|
|
1611
|
+
}
|
|
1612
|
+
else {
|
|
1613
|
+
params = {
|
|
1614
|
+
userId: paramsOrFirst,
|
|
1615
|
+
email: rest[0],
|
|
1616
|
+
url: rest[1],
|
|
1617
|
+
phrase: rest[2]
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
const userId = params.userId;
|
|
1621
|
+
const email = params.email;
|
|
1622
|
+
const url = params.url;
|
|
1623
|
+
const phrase = params.phrase;
|
|
1463
1624
|
if (typeof userId === 'undefined') {
|
|
1464
1625
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1465
1626
|
}
|
|
@@ -1485,30 +1646,23 @@ class Account extends Service {
|
|
|
1485
1646
|
'content-type': 'application/json',
|
|
1486
1647
|
}, payload);
|
|
1487
1648
|
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
* @param {string} success
|
|
1506
|
-
* @param {string} failure
|
|
1507
|
-
* @param {string[]} scopes
|
|
1508
|
-
* @throws {AppwriteException}
|
|
1509
|
-
* @returns {void|string}
|
|
1510
|
-
*/
|
|
1511
|
-
createOAuth2Token(provider, success, failure, scopes) {
|
|
1649
|
+
createOAuth2Token(paramsOrFirst, ...rest) {
|
|
1650
|
+
let params;
|
|
1651
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
1652
|
+
params = (paramsOrFirst || {});
|
|
1653
|
+
}
|
|
1654
|
+
else {
|
|
1655
|
+
params = {
|
|
1656
|
+
provider: paramsOrFirst,
|
|
1657
|
+
success: rest[0],
|
|
1658
|
+
failure: rest[1],
|
|
1659
|
+
scopes: rest[2]
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
const provider = params.provider;
|
|
1663
|
+
const success = params.success;
|
|
1664
|
+
const failure = params.failure;
|
|
1665
|
+
const scopes = params.scopes;
|
|
1512
1666
|
if (typeof provider === 'undefined') {
|
|
1513
1667
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1514
1668
|
}
|
|
@@ -1530,24 +1684,19 @@ class Account extends Service {
|
|
|
1530
1684
|
}
|
|
1531
1685
|
return uri;
|
|
1532
1686
|
}
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
* @param {string} phone
|
|
1547
|
-
* @throws {AppwriteException}
|
|
1548
|
-
* @returns {Promise}
|
|
1549
|
-
*/
|
|
1550
|
-
createPhoneToken(userId, phone) {
|
|
1687
|
+
createPhoneToken(paramsOrFirst, ...rest) {
|
|
1688
|
+
let params;
|
|
1689
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1690
|
+
params = (paramsOrFirst || {});
|
|
1691
|
+
}
|
|
1692
|
+
else {
|
|
1693
|
+
params = {
|
|
1694
|
+
userId: paramsOrFirst,
|
|
1695
|
+
phone: rest[0]
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
const userId = params.userId;
|
|
1699
|
+
const phone = params.phone;
|
|
1551
1700
|
if (typeof userId === 'undefined') {
|
|
1552
1701
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1553
1702
|
}
|
|
@@ -1567,28 +1716,17 @@ class Account extends Service {
|
|
|
1567
1716
|
'content-type': 'application/json',
|
|
1568
1717
|
}, payload);
|
|
1569
1718
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
* Please note that in order to avoid a [Redirect
|
|
1582
|
-
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
|
|
1583
|
-
* the only valid redirect URLs are the ones from domains you have set when
|
|
1584
|
-
* adding your platforms in the console interface.
|
|
1585
|
-
*
|
|
1586
|
-
*
|
|
1587
|
-
* @param {string} url
|
|
1588
|
-
* @throws {AppwriteException}
|
|
1589
|
-
* @returns {Promise}
|
|
1590
|
-
*/
|
|
1591
|
-
createVerification(url) {
|
|
1719
|
+
createVerification(paramsOrFirst) {
|
|
1720
|
+
let params;
|
|
1721
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1722
|
+
params = (paramsOrFirst || {});
|
|
1723
|
+
}
|
|
1724
|
+
else {
|
|
1725
|
+
params = {
|
|
1726
|
+
url: paramsOrFirst
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1729
|
+
const url = params.url;
|
|
1592
1730
|
if (typeof url === 'undefined') {
|
|
1593
1731
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1594
1732
|
}
|
|
@@ -1602,18 +1740,19 @@ class Account extends Service {
|
|
|
1602
1740
|
'content-type': 'application/json',
|
|
1603
1741
|
}, payload);
|
|
1604
1742
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1743
|
+
updateVerification(paramsOrFirst, ...rest) {
|
|
1744
|
+
let params;
|
|
1745
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1746
|
+
params = (paramsOrFirst || {});
|
|
1747
|
+
}
|
|
1748
|
+
else {
|
|
1749
|
+
params = {
|
|
1750
|
+
userId: paramsOrFirst,
|
|
1751
|
+
secret: rest[0]
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
const userId = params.userId;
|
|
1755
|
+
const secret = params.secret;
|
|
1617
1756
|
if (typeof userId === 'undefined') {
|
|
1618
1757
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1619
1758
|
}
|
|
@@ -1634,18 +1773,11 @@ class Account extends Service {
|
|
|
1634
1773
|
}, payload);
|
|
1635
1774
|
}
|
|
1636
1775
|
/**
|
|
1637
|
-
* Use this endpoint to send a verification SMS to the currently logged in
|
|
1638
|
-
* user. This endpoint is meant for use after updating a user's phone number
|
|
1639
|
-
* using the
|
|
1640
|
-
* [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
|
|
1641
|
-
* endpoint. Learn more about how to [complete the verification
|
|
1642
|
-
* process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
|
|
1643
|
-
* The verification code sent to the user's phone number is valid for 15
|
|
1644
|
-
* minutes.
|
|
1776
|
+
* 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.
|
|
1645
1777
|
*
|
|
1646
1778
|
* @throws {AppwriteException}
|
|
1647
1779
|
* @returns {Promise}
|
|
1648
|
-
|
|
1780
|
+
*/
|
|
1649
1781
|
createPhoneVerification() {
|
|
1650
1782
|
const apiPath = '/account/verification/phone';
|
|
1651
1783
|
const payload = {};
|
|
@@ -1654,18 +1786,19 @@ class Account extends Service {
|
|
|
1654
1786
|
'content-type': 'application/json',
|
|
1655
1787
|
}, payload);
|
|
1656
1788
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1789
|
+
updatePhoneVerification(paramsOrFirst, ...rest) {
|
|
1790
|
+
let params;
|
|
1791
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1792
|
+
params = (paramsOrFirst || {});
|
|
1793
|
+
}
|
|
1794
|
+
else {
|
|
1795
|
+
params = {
|
|
1796
|
+
userId: paramsOrFirst,
|
|
1797
|
+
secret: rest[0]
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
const userId = params.userId;
|
|
1801
|
+
const secret = params.secret;
|
|
1669
1802
|
if (typeof userId === 'undefined') {
|
|
1670
1803
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1671
1804
|
}
|
|
@@ -1691,26 +1824,23 @@ class Avatars extends Service {
|
|
|
1691
1824
|
constructor(client) {
|
|
1692
1825
|
super(client);
|
|
1693
1826
|
}
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
* @returns {ArrayBuffer}
|
|
1712
|
-
*/
|
|
1713
|
-
getBrowser(code, width, height, quality) {
|
|
1827
|
+
getBrowser(paramsOrFirst, ...rest) {
|
|
1828
|
+
let params;
|
|
1829
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
1830
|
+
params = (paramsOrFirst || {});
|
|
1831
|
+
}
|
|
1832
|
+
else {
|
|
1833
|
+
params = {
|
|
1834
|
+
code: paramsOrFirst,
|
|
1835
|
+
width: rest[0],
|
|
1836
|
+
height: rest[1],
|
|
1837
|
+
quality: rest[2]
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
const code = params.code;
|
|
1841
|
+
const width = params.width;
|
|
1842
|
+
const height = params.height;
|
|
1843
|
+
const quality = params.quality;
|
|
1714
1844
|
if (typeof code === 'undefined') {
|
|
1715
1845
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
1716
1846
|
}
|
|
@@ -1732,25 +1862,23 @@ class Avatars extends Service {
|
|
|
1732
1862
|
}
|
|
1733
1863
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1734
1864
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
*/
|
|
1753
|
-
getCreditCard(code, width, height, quality) {
|
|
1865
|
+
getCreditCard(paramsOrFirst, ...rest) {
|
|
1866
|
+
let params;
|
|
1867
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
1868
|
+
params = (paramsOrFirst || {});
|
|
1869
|
+
}
|
|
1870
|
+
else {
|
|
1871
|
+
params = {
|
|
1872
|
+
code: paramsOrFirst,
|
|
1873
|
+
width: rest[0],
|
|
1874
|
+
height: rest[1],
|
|
1875
|
+
quality: rest[2]
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
const code = params.code;
|
|
1879
|
+
const width = params.width;
|
|
1880
|
+
const height = params.height;
|
|
1881
|
+
const quality = params.quality;
|
|
1754
1882
|
if (typeof code === 'undefined') {
|
|
1755
1883
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
1756
1884
|
}
|
|
@@ -1772,17 +1900,17 @@ class Avatars extends Service {
|
|
|
1772
1900
|
}
|
|
1773
1901
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1774
1902
|
}
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1903
|
+
getFavicon(paramsOrFirst) {
|
|
1904
|
+
let params;
|
|
1905
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1906
|
+
params = (paramsOrFirst || {});
|
|
1907
|
+
}
|
|
1908
|
+
else {
|
|
1909
|
+
params = {
|
|
1910
|
+
url: paramsOrFirst
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
const url = params.url;
|
|
1786
1914
|
if (typeof url === 'undefined') {
|
|
1787
1915
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1788
1916
|
}
|
|
@@ -1798,26 +1926,23 @@ class Avatars extends Service {
|
|
|
1798
1926
|
}
|
|
1799
1927
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1800
1928
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
* @returns {ArrayBuffer}
|
|
1819
|
-
*/
|
|
1820
|
-
getFlag(code, width, height, quality) {
|
|
1929
|
+
getFlag(paramsOrFirst, ...rest) {
|
|
1930
|
+
let params;
|
|
1931
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
|
|
1932
|
+
params = (paramsOrFirst || {});
|
|
1933
|
+
}
|
|
1934
|
+
else {
|
|
1935
|
+
params = {
|
|
1936
|
+
code: paramsOrFirst,
|
|
1937
|
+
width: rest[0],
|
|
1938
|
+
height: rest[1],
|
|
1939
|
+
quality: rest[2]
|
|
1940
|
+
};
|
|
1941
|
+
}
|
|
1942
|
+
const code = params.code;
|
|
1943
|
+
const width = params.width;
|
|
1944
|
+
const height = params.height;
|
|
1945
|
+
const quality = params.quality;
|
|
1821
1946
|
if (typeof code === 'undefined') {
|
|
1822
1947
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
1823
1948
|
}
|
|
@@ -1839,26 +1964,21 @@ class Avatars extends Service {
|
|
|
1839
1964
|
}
|
|
1840
1965
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1841
1966
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
* @param {number} height
|
|
1858
|
-
* @throws {AppwriteException}
|
|
1859
|
-
* @returns {ArrayBuffer}
|
|
1860
|
-
*/
|
|
1861
|
-
getImage(url, width, height) {
|
|
1967
|
+
getImage(paramsOrFirst, ...rest) {
|
|
1968
|
+
let params;
|
|
1969
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1970
|
+
params = (paramsOrFirst || {});
|
|
1971
|
+
}
|
|
1972
|
+
else {
|
|
1973
|
+
params = {
|
|
1974
|
+
url: paramsOrFirst,
|
|
1975
|
+
width: rest[0],
|
|
1976
|
+
height: rest[1]
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
const url = params.url;
|
|
1980
|
+
const width = params.width;
|
|
1981
|
+
const height = params.height;
|
|
1862
1982
|
if (typeof url === 'undefined') {
|
|
1863
1983
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1864
1984
|
}
|
|
@@ -1880,32 +2000,23 @@ class Avatars extends Service {
|
|
|
1880
2000
|
}
|
|
1881
2001
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1882
2002
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
*
|
|
1901
|
-
* @param {string} name
|
|
1902
|
-
* @param {number} width
|
|
1903
|
-
* @param {number} height
|
|
1904
|
-
* @param {string} background
|
|
1905
|
-
* @throws {AppwriteException}
|
|
1906
|
-
* @returns {ArrayBuffer}
|
|
1907
|
-
*/
|
|
1908
|
-
getInitials(name, width, height, background) {
|
|
2003
|
+
getInitials(paramsOrFirst, ...rest) {
|
|
2004
|
+
let params;
|
|
2005
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2006
|
+
params = (paramsOrFirst || {});
|
|
2007
|
+
}
|
|
2008
|
+
else {
|
|
2009
|
+
params = {
|
|
2010
|
+
name: paramsOrFirst,
|
|
2011
|
+
width: rest[0],
|
|
2012
|
+
height: rest[1],
|
|
2013
|
+
background: rest[2]
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
const name = params.name;
|
|
2017
|
+
const width = params.width;
|
|
2018
|
+
const height = params.height;
|
|
2019
|
+
const background = params.background;
|
|
1909
2020
|
const apiPath = '/avatars/initials';
|
|
1910
2021
|
const payload = {};
|
|
1911
2022
|
if (typeof name !== 'undefined') {
|
|
@@ -1927,19 +2038,23 @@ class Avatars extends Service {
|
|
|
1927
2038
|
}
|
|
1928
2039
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
1929
2040
|
}
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
2041
|
+
getQR(paramsOrFirst, ...rest) {
|
|
2042
|
+
let params;
|
|
2043
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2044
|
+
params = (paramsOrFirst || {});
|
|
2045
|
+
}
|
|
2046
|
+
else {
|
|
2047
|
+
params = {
|
|
2048
|
+
text: paramsOrFirst,
|
|
2049
|
+
size: rest[0],
|
|
2050
|
+
margin: rest[1],
|
|
2051
|
+
download: rest[2]
|
|
2052
|
+
};
|
|
2053
|
+
}
|
|
2054
|
+
const text = params.text;
|
|
2055
|
+
const size = params.size;
|
|
2056
|
+
const margin = params.margin;
|
|
2057
|
+
const download = params.download;
|
|
1943
2058
|
if (typeof text === 'undefined') {
|
|
1944
2059
|
throw new AppwriteException('Missing required parameter: "text"');
|
|
1945
2060
|
}
|
|
@@ -2225,17 +2340,21 @@ class Databases extends Service {
|
|
|
2225
2340
|
constructor(client) {
|
|
2226
2341
|
super(client);
|
|
2227
2342
|
}
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2343
|
+
listDocuments(paramsOrFirst, ...rest) {
|
|
2344
|
+
let params;
|
|
2345
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2346
|
+
params = (paramsOrFirst || {});
|
|
2347
|
+
}
|
|
2348
|
+
else {
|
|
2349
|
+
params = {
|
|
2350
|
+
databaseId: paramsOrFirst,
|
|
2351
|
+
collectionId: rest[0],
|
|
2352
|
+
queries: rest[1]
|
|
2353
|
+
};
|
|
2354
|
+
}
|
|
2355
|
+
const databaseId = params.databaseId;
|
|
2356
|
+
const collectionId = params.collectionId;
|
|
2357
|
+
const queries = params.queries;
|
|
2239
2358
|
if (typeof databaseId === 'undefined') {
|
|
2240
2359
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2241
2360
|
}
|
|
@@ -2250,21 +2369,25 @@ class Databases extends Service {
|
|
|
2250
2369
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2251
2370
|
return this.client.call('get', uri, {}, payload);
|
|
2252
2371
|
}
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2372
|
+
createDocument(paramsOrFirst, ...rest) {
|
|
2373
|
+
let params;
|
|
2374
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2375
|
+
params = (paramsOrFirst || {});
|
|
2376
|
+
}
|
|
2377
|
+
else {
|
|
2378
|
+
params = {
|
|
2379
|
+
databaseId: paramsOrFirst,
|
|
2380
|
+
collectionId: rest[0],
|
|
2381
|
+
documentId: rest[1],
|
|
2382
|
+
data: rest[2],
|
|
2383
|
+
permissions: rest[3]
|
|
2384
|
+
};
|
|
2385
|
+
}
|
|
2386
|
+
const databaseId = params.databaseId;
|
|
2387
|
+
const collectionId = params.collectionId;
|
|
2388
|
+
const documentId = params.documentId;
|
|
2389
|
+
const data = params.data;
|
|
2390
|
+
const permissions = params.permissions;
|
|
2268
2391
|
if (typeof databaseId === 'undefined') {
|
|
2269
2392
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2270
2393
|
}
|
|
@@ -2277,6 +2400,9 @@ class Databases extends Service {
|
|
|
2277
2400
|
if (typeof data === 'undefined') {
|
|
2278
2401
|
throw new AppwriteException('Missing required parameter: "data"');
|
|
2279
2402
|
}
|
|
2403
|
+
data === null || data === void 0 ? true : delete data.$sequence;
|
|
2404
|
+
data === null || data === void 0 ? true : delete data.$collectionId;
|
|
2405
|
+
data === null || data === void 0 ? true : delete data.$databaseId;
|
|
2280
2406
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
2281
2407
|
const payload = {};
|
|
2282
2408
|
if (typeof documentId !== 'undefined') {
|
|
@@ -2293,18 +2419,23 @@ class Databases extends Service {
|
|
|
2293
2419
|
'content-type': 'application/json',
|
|
2294
2420
|
}, payload);
|
|
2295
2421
|
}
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2422
|
+
getDocument(paramsOrFirst, ...rest) {
|
|
2423
|
+
let params;
|
|
2424
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2425
|
+
params = (paramsOrFirst || {});
|
|
2426
|
+
}
|
|
2427
|
+
else {
|
|
2428
|
+
params = {
|
|
2429
|
+
databaseId: paramsOrFirst,
|
|
2430
|
+
collectionId: rest[0],
|
|
2431
|
+
documentId: rest[1],
|
|
2432
|
+
queries: rest[2]
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
const databaseId = params.databaseId;
|
|
2436
|
+
const collectionId = params.collectionId;
|
|
2437
|
+
const documentId = params.documentId;
|
|
2438
|
+
const queries = params.queries;
|
|
2308
2439
|
if (typeof databaseId === 'undefined') {
|
|
2309
2440
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2310
2441
|
}
|
|
@@ -2322,25 +2453,25 @@ class Databases extends Service {
|
|
|
2322
2453
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2323
2454
|
return this.client.call('get', uri, {}, payload);
|
|
2324
2455
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2456
|
+
upsertDocument(paramsOrFirst, ...rest) {
|
|
2457
|
+
let params;
|
|
2458
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2459
|
+
params = (paramsOrFirst || {});
|
|
2460
|
+
}
|
|
2461
|
+
else {
|
|
2462
|
+
params = {
|
|
2463
|
+
databaseId: paramsOrFirst,
|
|
2464
|
+
collectionId: rest[0],
|
|
2465
|
+
documentId: rest[1],
|
|
2466
|
+
data: rest[2],
|
|
2467
|
+
permissions: rest[3]
|
|
2468
|
+
};
|
|
2469
|
+
}
|
|
2470
|
+
const databaseId = params.databaseId;
|
|
2471
|
+
const collectionId = params.collectionId;
|
|
2472
|
+
const documentId = params.documentId;
|
|
2473
|
+
const data = params.data;
|
|
2474
|
+
const permissions = params.permissions;
|
|
2344
2475
|
if (typeof databaseId === 'undefined') {
|
|
2345
2476
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2346
2477
|
}
|
|
@@ -2353,6 +2484,9 @@ class Databases extends Service {
|
|
|
2353
2484
|
if (typeof data === 'undefined') {
|
|
2354
2485
|
throw new AppwriteException('Missing required parameter: "data"');
|
|
2355
2486
|
}
|
|
2487
|
+
data === null || data === void 0 ? true : delete data.$sequence;
|
|
2488
|
+
data === null || data === void 0 ? true : delete data.$collectionId;
|
|
2489
|
+
data === null || data === void 0 ? true : delete data.$databaseId;
|
|
2356
2490
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2357
2491
|
const payload = {};
|
|
2358
2492
|
if (typeof data !== 'undefined') {
|
|
@@ -2366,19 +2500,25 @@ class Databases extends Service {
|
|
|
2366
2500
|
'content-type': 'application/json',
|
|
2367
2501
|
}, payload);
|
|
2368
2502
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2503
|
+
updateDocument(paramsOrFirst, ...rest) {
|
|
2504
|
+
let params;
|
|
2505
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2506
|
+
params = (paramsOrFirst || {});
|
|
2507
|
+
}
|
|
2508
|
+
else {
|
|
2509
|
+
params = {
|
|
2510
|
+
databaseId: paramsOrFirst,
|
|
2511
|
+
collectionId: rest[0],
|
|
2512
|
+
documentId: rest[1],
|
|
2513
|
+
data: rest[2],
|
|
2514
|
+
permissions: rest[3]
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2517
|
+
const databaseId = params.databaseId;
|
|
2518
|
+
const collectionId = params.collectionId;
|
|
2519
|
+
const documentId = params.documentId;
|
|
2520
|
+
const data = params.data;
|
|
2521
|
+
const permissions = params.permissions;
|
|
2382
2522
|
if (typeof databaseId === 'undefined') {
|
|
2383
2523
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2384
2524
|
}
|
|
@@ -2388,6 +2528,9 @@ class Databases extends Service {
|
|
|
2388
2528
|
if (typeof documentId === 'undefined') {
|
|
2389
2529
|
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2390
2530
|
}
|
|
2531
|
+
data === null || data === void 0 ? true : delete data.$sequence;
|
|
2532
|
+
data === null || data === void 0 ? true : delete data.$collectionId;
|
|
2533
|
+
data === null || data === void 0 ? true : delete data.$databaseId;
|
|
2391
2534
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2392
2535
|
const payload = {};
|
|
2393
2536
|
if (typeof data !== 'undefined') {
|
|
@@ -2401,16 +2544,21 @@ class Databases extends Service {
|
|
|
2401
2544
|
'content-type': 'application/json',
|
|
2402
2545
|
}, payload);
|
|
2403
2546
|
}
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2547
|
+
deleteDocument(paramsOrFirst, ...rest) {
|
|
2548
|
+
let params;
|
|
2549
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2550
|
+
params = (paramsOrFirst || {});
|
|
2551
|
+
}
|
|
2552
|
+
else {
|
|
2553
|
+
params = {
|
|
2554
|
+
databaseId: paramsOrFirst,
|
|
2555
|
+
collectionId: rest[0],
|
|
2556
|
+
documentId: rest[1]
|
|
2557
|
+
};
|
|
2558
|
+
}
|
|
2559
|
+
const databaseId = params.databaseId;
|
|
2560
|
+
const collectionId = params.collectionId;
|
|
2561
|
+
const documentId = params.documentId;
|
|
2414
2562
|
if (typeof databaseId === 'undefined') {
|
|
2415
2563
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2416
2564
|
}
|
|
@@ -2427,22 +2575,117 @@ class Databases extends Service {
|
|
|
2427
2575
|
'content-type': 'application/json',
|
|
2428
2576
|
}, payload);
|
|
2429
2577
|
}
|
|
2578
|
+
decrementDocumentAttribute(paramsOrFirst, ...rest) {
|
|
2579
|
+
let params;
|
|
2580
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2581
|
+
params = (paramsOrFirst || {});
|
|
2582
|
+
}
|
|
2583
|
+
else {
|
|
2584
|
+
params = {
|
|
2585
|
+
databaseId: paramsOrFirst,
|
|
2586
|
+
collectionId: rest[0],
|
|
2587
|
+
documentId: rest[1],
|
|
2588
|
+
attribute: rest[2],
|
|
2589
|
+
value: rest[3],
|
|
2590
|
+
min: rest[4]
|
|
2591
|
+
};
|
|
2592
|
+
}
|
|
2593
|
+
const databaseId = params.databaseId;
|
|
2594
|
+
const collectionId = params.collectionId;
|
|
2595
|
+
const documentId = params.documentId;
|
|
2596
|
+
const attribute = params.attribute;
|
|
2597
|
+
const value = params.value;
|
|
2598
|
+
const min = params.min;
|
|
2599
|
+
if (typeof databaseId === 'undefined') {
|
|
2600
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2601
|
+
}
|
|
2602
|
+
if (typeof collectionId === 'undefined') {
|
|
2603
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2604
|
+
}
|
|
2605
|
+
if (typeof documentId === 'undefined') {
|
|
2606
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2607
|
+
}
|
|
2608
|
+
if (typeof attribute === 'undefined') {
|
|
2609
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
2610
|
+
}
|
|
2611
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
2612
|
+
const payload = {};
|
|
2613
|
+
if (typeof value !== 'undefined') {
|
|
2614
|
+
payload['value'] = value;
|
|
2615
|
+
}
|
|
2616
|
+
if (typeof min !== 'undefined') {
|
|
2617
|
+
payload['min'] = min;
|
|
2618
|
+
}
|
|
2619
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2620
|
+
return this.client.call('patch', uri, {
|
|
2621
|
+
'content-type': 'application/json',
|
|
2622
|
+
}, payload);
|
|
2623
|
+
}
|
|
2624
|
+
incrementDocumentAttribute(paramsOrFirst, ...rest) {
|
|
2625
|
+
let params;
|
|
2626
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2627
|
+
params = (paramsOrFirst || {});
|
|
2628
|
+
}
|
|
2629
|
+
else {
|
|
2630
|
+
params = {
|
|
2631
|
+
databaseId: paramsOrFirst,
|
|
2632
|
+
collectionId: rest[0],
|
|
2633
|
+
documentId: rest[1],
|
|
2634
|
+
attribute: rest[2],
|
|
2635
|
+
value: rest[3],
|
|
2636
|
+
max: rest[4]
|
|
2637
|
+
};
|
|
2638
|
+
}
|
|
2639
|
+
const databaseId = params.databaseId;
|
|
2640
|
+
const collectionId = params.collectionId;
|
|
2641
|
+
const documentId = params.documentId;
|
|
2642
|
+
const attribute = params.attribute;
|
|
2643
|
+
const value = params.value;
|
|
2644
|
+
const max = params.max;
|
|
2645
|
+
if (typeof databaseId === 'undefined') {
|
|
2646
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2647
|
+
}
|
|
2648
|
+
if (typeof collectionId === 'undefined') {
|
|
2649
|
+
throw new AppwriteException('Missing required parameter: "collectionId"');
|
|
2650
|
+
}
|
|
2651
|
+
if (typeof documentId === 'undefined') {
|
|
2652
|
+
throw new AppwriteException('Missing required parameter: "documentId"');
|
|
2653
|
+
}
|
|
2654
|
+
if (typeof attribute === 'undefined') {
|
|
2655
|
+
throw new AppwriteException('Missing required parameter: "attribute"');
|
|
2656
|
+
}
|
|
2657
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
|
|
2658
|
+
const payload = {};
|
|
2659
|
+
if (typeof value !== 'undefined') {
|
|
2660
|
+
payload['value'] = value;
|
|
2661
|
+
}
|
|
2662
|
+
if (typeof max !== 'undefined') {
|
|
2663
|
+
payload['max'] = max;
|
|
2664
|
+
}
|
|
2665
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2666
|
+
return this.client.call('patch', uri, {
|
|
2667
|
+
'content-type': 'application/json',
|
|
2668
|
+
}, payload);
|
|
2669
|
+
}
|
|
2430
2670
|
}
|
|
2431
2671
|
|
|
2432
2672
|
class Functions extends Service {
|
|
2433
2673
|
constructor(client) {
|
|
2434
2674
|
super(client);
|
|
2435
2675
|
}
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2676
|
+
listExecutions(paramsOrFirst, ...rest) {
|
|
2677
|
+
let params;
|
|
2678
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2679
|
+
params = (paramsOrFirst || {});
|
|
2680
|
+
}
|
|
2681
|
+
else {
|
|
2682
|
+
params = {
|
|
2683
|
+
functionId: paramsOrFirst,
|
|
2684
|
+
queries: rest[0]
|
|
2685
|
+
};
|
|
2686
|
+
}
|
|
2687
|
+
const functionId = params.functionId;
|
|
2688
|
+
const queries = params.queries;
|
|
2446
2689
|
if (typeof functionId === 'undefined') {
|
|
2447
2690
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2448
2691
|
}
|
|
@@ -2454,23 +2697,29 @@ class Functions extends Service {
|
|
|
2454
2697
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2455
2698
|
return this.client.call('get', uri, {}, payload);
|
|
2456
2699
|
}
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2700
|
+
createExecution(paramsOrFirst, ...rest) {
|
|
2701
|
+
let params;
|
|
2702
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2703
|
+
params = (paramsOrFirst || {});
|
|
2704
|
+
}
|
|
2705
|
+
else {
|
|
2706
|
+
params = {
|
|
2707
|
+
functionId: paramsOrFirst,
|
|
2708
|
+
body: rest[0],
|
|
2709
|
+
async: rest[1],
|
|
2710
|
+
xpath: rest[2],
|
|
2711
|
+
method: rest[3],
|
|
2712
|
+
headers: rest[4],
|
|
2713
|
+
scheduledAt: rest[5]
|
|
2714
|
+
};
|
|
2715
|
+
}
|
|
2716
|
+
const functionId = params.functionId;
|
|
2717
|
+
const body = params.body;
|
|
2718
|
+
const async = params.async;
|
|
2719
|
+
const xpath = params.xpath;
|
|
2720
|
+
const method = params.method;
|
|
2721
|
+
const headers = params.headers;
|
|
2722
|
+
const scheduledAt = params.scheduledAt;
|
|
2474
2723
|
if (typeof functionId === 'undefined') {
|
|
2475
2724
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2476
2725
|
}
|
|
@@ -2499,15 +2748,19 @@ class Functions extends Service {
|
|
|
2499
2748
|
'content-type': 'application/json',
|
|
2500
2749
|
}, payload);
|
|
2501
2750
|
}
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2751
|
+
getExecution(paramsOrFirst, ...rest) {
|
|
2752
|
+
let params;
|
|
2753
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2754
|
+
params = (paramsOrFirst || {});
|
|
2755
|
+
}
|
|
2756
|
+
else {
|
|
2757
|
+
params = {
|
|
2758
|
+
functionId: paramsOrFirst,
|
|
2759
|
+
executionId: rest[0]
|
|
2760
|
+
};
|
|
2761
|
+
}
|
|
2762
|
+
const functionId = params.functionId;
|
|
2763
|
+
const executionId = params.executionId;
|
|
2511
2764
|
if (typeof functionId === 'undefined') {
|
|
2512
2765
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
2513
2766
|
}
|
|
@@ -2525,14 +2778,17 @@ class Graphql extends Service {
|
|
|
2525
2778
|
constructor(client) {
|
|
2526
2779
|
super(client);
|
|
2527
2780
|
}
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2781
|
+
query(paramsOrFirst) {
|
|
2782
|
+
let params;
|
|
2783
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
|
|
2784
|
+
params = (paramsOrFirst || {});
|
|
2785
|
+
}
|
|
2786
|
+
else {
|
|
2787
|
+
params = {
|
|
2788
|
+
query: paramsOrFirst
|
|
2789
|
+
};
|
|
2790
|
+
}
|
|
2791
|
+
const query = params.query;
|
|
2536
2792
|
if (typeof query === 'undefined') {
|
|
2537
2793
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
2538
2794
|
}
|
|
@@ -2547,14 +2803,17 @@ class Graphql extends Service {
|
|
|
2547
2803
|
'content-type': 'application/json',
|
|
2548
2804
|
}, payload);
|
|
2549
2805
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2806
|
+
mutation(paramsOrFirst) {
|
|
2807
|
+
let params;
|
|
2808
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
|
|
2809
|
+
params = (paramsOrFirst || {});
|
|
2810
|
+
}
|
|
2811
|
+
else {
|
|
2812
|
+
params = {
|
|
2813
|
+
query: paramsOrFirst
|
|
2814
|
+
};
|
|
2815
|
+
}
|
|
2816
|
+
const query = params.query;
|
|
2558
2817
|
if (typeof query === 'undefined') {
|
|
2559
2818
|
throw new AppwriteException('Missing required parameter: "query"');
|
|
2560
2819
|
}
|
|
@@ -2576,16 +2835,13 @@ class Locale extends Service {
|
|
|
2576
2835
|
super(client);
|
|
2577
2836
|
}
|
|
2578
2837
|
/**
|
|
2579
|
-
* Get the current user location based on IP. Returns an object with user
|
|
2580
|
-
* country code, country name, continent name, continent code, ip address and
|
|
2581
|
-
* suggested currency. You can use the locale header to get the data in a
|
|
2582
|
-
* supported language.
|
|
2838
|
+
* 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.
|
|
2583
2839
|
*
|
|
2584
2840
|
* ([IP Geolocation by DB-IP](https://db-ip.com))
|
|
2585
2841
|
*
|
|
2586
2842
|
* @throws {AppwriteException}
|
|
2587
2843
|
* @returns {Promise}
|
|
2588
|
-
|
|
2844
|
+
*/
|
|
2589
2845
|
get() {
|
|
2590
2846
|
const apiPath = '/locale';
|
|
2591
2847
|
const payload = {};
|
|
@@ -2593,12 +2849,11 @@ class Locale extends Service {
|
|
|
2593
2849
|
return this.client.call('get', uri, {}, payload);
|
|
2594
2850
|
}
|
|
2595
2851
|
/**
|
|
2596
|
-
* List of all locale codes in [ISO
|
|
2597
|
-
* 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
|
|
2852
|
+
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
|
|
2598
2853
|
*
|
|
2599
2854
|
* @throws {AppwriteException}
|
|
2600
2855
|
* @returns {Promise}
|
|
2601
|
-
|
|
2856
|
+
*/
|
|
2602
2857
|
listCodes() {
|
|
2603
2858
|
const apiPath = '/locale/codes';
|
|
2604
2859
|
const payload = {};
|
|
@@ -2606,12 +2861,11 @@ class Locale extends Service {
|
|
|
2606
2861
|
return this.client.call('get', uri, {}, payload);
|
|
2607
2862
|
}
|
|
2608
2863
|
/**
|
|
2609
|
-
* List of all continents. You can use the locale header to get the data in a
|
|
2610
|
-
* supported language.
|
|
2864
|
+
* List of all continents. You can use the locale header to get the data in a supported language.
|
|
2611
2865
|
*
|
|
2612
2866
|
* @throws {AppwriteException}
|
|
2613
2867
|
* @returns {Promise}
|
|
2614
|
-
|
|
2868
|
+
*/
|
|
2615
2869
|
listContinents() {
|
|
2616
2870
|
const apiPath = '/locale/continents';
|
|
2617
2871
|
const payload = {};
|
|
@@ -2619,12 +2873,11 @@ class Locale extends Service {
|
|
|
2619
2873
|
return this.client.call('get', uri, {}, payload);
|
|
2620
2874
|
}
|
|
2621
2875
|
/**
|
|
2622
|
-
* List of all countries. You can use the locale header to get the data in a
|
|
2623
|
-
* supported language.
|
|
2876
|
+
* List of all countries. You can use the locale header to get the data in a supported language.
|
|
2624
2877
|
*
|
|
2625
2878
|
* @throws {AppwriteException}
|
|
2626
2879
|
* @returns {Promise}
|
|
2627
|
-
|
|
2880
|
+
*/
|
|
2628
2881
|
listCountries() {
|
|
2629
2882
|
const apiPath = '/locale/countries';
|
|
2630
2883
|
const payload = {};
|
|
@@ -2632,12 +2885,11 @@ class Locale extends Service {
|
|
|
2632
2885
|
return this.client.call('get', uri, {}, payload);
|
|
2633
2886
|
}
|
|
2634
2887
|
/**
|
|
2635
|
-
* List of all countries that are currently members of the EU. You can use the
|
|
2636
|
-
* locale header to get the data in a supported language.
|
|
2888
|
+
* 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.
|
|
2637
2889
|
*
|
|
2638
2890
|
* @throws {AppwriteException}
|
|
2639
2891
|
* @returns {Promise}
|
|
2640
|
-
|
|
2892
|
+
*/
|
|
2641
2893
|
listCountriesEU() {
|
|
2642
2894
|
const apiPath = '/locale/countries/eu';
|
|
2643
2895
|
const payload = {};
|
|
@@ -2645,12 +2897,11 @@ class Locale extends Service {
|
|
|
2645
2897
|
return this.client.call('get', uri, {}, payload);
|
|
2646
2898
|
}
|
|
2647
2899
|
/**
|
|
2648
|
-
* List of all countries phone codes. You can use the locale header to get the
|
|
2649
|
-
* data in a supported language.
|
|
2900
|
+
* List of all countries phone codes. You can use the locale header to get the data in a supported language.
|
|
2650
2901
|
*
|
|
2651
2902
|
* @throws {AppwriteException}
|
|
2652
2903
|
* @returns {Promise}
|
|
2653
|
-
|
|
2904
|
+
*/
|
|
2654
2905
|
listCountriesPhones() {
|
|
2655
2906
|
const apiPath = '/locale/countries/phones';
|
|
2656
2907
|
const payload = {};
|
|
@@ -2658,13 +2909,11 @@ class Locale extends Service {
|
|
|
2658
2909
|
return this.client.call('get', uri, {}, payload);
|
|
2659
2910
|
}
|
|
2660
2911
|
/**
|
|
2661
|
-
* List of all currencies, including currency symbol, name, plural, and
|
|
2662
|
-
* decimal digits for all major and minor currencies. You can use the locale
|
|
2663
|
-
* header to get the data in a supported language.
|
|
2912
|
+
* 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.
|
|
2664
2913
|
*
|
|
2665
2914
|
* @throws {AppwriteException}
|
|
2666
2915
|
* @returns {Promise}
|
|
2667
|
-
|
|
2916
|
+
*/
|
|
2668
2917
|
listCurrencies() {
|
|
2669
2918
|
const apiPath = '/locale/currencies';
|
|
2670
2919
|
const payload = {};
|
|
@@ -2672,12 +2921,11 @@ class Locale extends Service {
|
|
|
2672
2921
|
return this.client.call('get', uri, {}, payload);
|
|
2673
2922
|
}
|
|
2674
2923
|
/**
|
|
2675
|
-
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
2676
|
-
* in English, and name in the respective language.
|
|
2924
|
+
* List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
|
|
2677
2925
|
*
|
|
2678
2926
|
* @throws {AppwriteException}
|
|
2679
2927
|
* @returns {Promise}
|
|
2680
|
-
|
|
2928
|
+
*/
|
|
2681
2929
|
listLanguages() {
|
|
2682
2930
|
const apiPath = '/locale/languages';
|
|
2683
2931
|
const payload = {};
|
|
@@ -2690,16 +2938,21 @@ class Messaging extends Service {
|
|
|
2690
2938
|
constructor(client) {
|
|
2691
2939
|
super(client);
|
|
2692
2940
|
}
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2941
|
+
createSubscriber(paramsOrFirst, ...rest) {
|
|
2942
|
+
let params;
|
|
2943
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2944
|
+
params = (paramsOrFirst || {});
|
|
2945
|
+
}
|
|
2946
|
+
else {
|
|
2947
|
+
params = {
|
|
2948
|
+
topicId: paramsOrFirst,
|
|
2949
|
+
subscriberId: rest[0],
|
|
2950
|
+
targetId: rest[1]
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
const topicId = params.topicId;
|
|
2954
|
+
const subscriberId = params.subscriberId;
|
|
2955
|
+
const targetId = params.targetId;
|
|
2703
2956
|
if (typeof topicId === 'undefined') {
|
|
2704
2957
|
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
2705
2958
|
}
|
|
@@ -2722,15 +2975,19 @@ class Messaging extends Service {
|
|
|
2722
2975
|
'content-type': 'application/json',
|
|
2723
2976
|
}, payload);
|
|
2724
2977
|
}
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2978
|
+
deleteSubscriber(paramsOrFirst, ...rest) {
|
|
2979
|
+
let params;
|
|
2980
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2981
|
+
params = (paramsOrFirst || {});
|
|
2982
|
+
}
|
|
2983
|
+
else {
|
|
2984
|
+
params = {
|
|
2985
|
+
topicId: paramsOrFirst,
|
|
2986
|
+
subscriberId: rest[0]
|
|
2987
|
+
};
|
|
2988
|
+
}
|
|
2989
|
+
const topicId = params.topicId;
|
|
2990
|
+
const subscriberId = params.subscriberId;
|
|
2734
2991
|
if (typeof topicId === 'undefined') {
|
|
2735
2992
|
throw new AppwriteException('Missing required parameter: "topicId"');
|
|
2736
2993
|
}
|
|
@@ -2750,17 +3007,21 @@ class Storage extends Service {
|
|
|
2750
3007
|
constructor(client) {
|
|
2751
3008
|
super(client);
|
|
2752
3009
|
}
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
3010
|
+
listFiles(paramsOrFirst, ...rest) {
|
|
3011
|
+
let params;
|
|
3012
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3013
|
+
params = (paramsOrFirst || {});
|
|
3014
|
+
}
|
|
3015
|
+
else {
|
|
3016
|
+
params = {
|
|
3017
|
+
bucketId: paramsOrFirst,
|
|
3018
|
+
queries: rest[0],
|
|
3019
|
+
search: rest[1]
|
|
3020
|
+
};
|
|
3021
|
+
}
|
|
3022
|
+
const bucketId = params.bucketId;
|
|
3023
|
+
const queries = params.queries;
|
|
3024
|
+
const search = params.search;
|
|
2764
3025
|
if (typeof bucketId === 'undefined') {
|
|
2765
3026
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2766
3027
|
}
|
|
@@ -2775,35 +3036,27 @@ class Storage extends Service {
|
|
|
2775
3036
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2776
3037
|
return this.client.call('get', uri, {}, payload);
|
|
2777
3038
|
}
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
* @param {string} fileId
|
|
2800
|
-
* @param {{name: string, type: string, size: number, uri: string}} file
|
|
2801
|
-
* @param {string[]} permissions
|
|
2802
|
-
* @throws {AppwriteException}
|
|
2803
|
-
* @returns {Promise}
|
|
2804
|
-
*/
|
|
2805
|
-
createFile(bucketId_1, fileId_1, file_1, permissions_1) {
|
|
2806
|
-
return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
|
|
3039
|
+
createFile(paramsOrFirst, ...rest) {
|
|
3040
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3041
|
+
let params;
|
|
3042
|
+
let onProgress;
|
|
3043
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3044
|
+
params = (paramsOrFirst || {});
|
|
3045
|
+
onProgress = paramsOrFirst === null || paramsOrFirst === void 0 ? void 0 : paramsOrFirst.onProgress;
|
|
3046
|
+
}
|
|
3047
|
+
else {
|
|
3048
|
+
params = {
|
|
3049
|
+
bucketId: paramsOrFirst,
|
|
3050
|
+
fileId: rest[0],
|
|
3051
|
+
file: rest[1],
|
|
3052
|
+
permissions: rest[2]
|
|
3053
|
+
};
|
|
3054
|
+
onProgress = rest[3];
|
|
3055
|
+
}
|
|
3056
|
+
const bucketId = params.bucketId;
|
|
3057
|
+
const fileId = params.fileId;
|
|
3058
|
+
const file = params.file;
|
|
3059
|
+
const permissions = params.permissions;
|
|
2807
3060
|
if (typeof bucketId === 'undefined') {
|
|
2808
3061
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2809
3062
|
}
|
|
@@ -2875,16 +3128,19 @@ class Storage extends Service {
|
|
|
2875
3128
|
return response;
|
|
2876
3129
|
});
|
|
2877
3130
|
}
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
3131
|
+
getFile(paramsOrFirst, ...rest) {
|
|
3132
|
+
let params;
|
|
3133
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3134
|
+
params = (paramsOrFirst || {});
|
|
3135
|
+
}
|
|
3136
|
+
else {
|
|
3137
|
+
params = {
|
|
3138
|
+
bucketId: paramsOrFirst,
|
|
3139
|
+
fileId: rest[0]
|
|
3140
|
+
};
|
|
3141
|
+
}
|
|
3142
|
+
const bucketId = params.bucketId;
|
|
3143
|
+
const fileId = params.fileId;
|
|
2888
3144
|
if (typeof bucketId === 'undefined') {
|
|
2889
3145
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2890
3146
|
}
|
|
@@ -2896,18 +3152,23 @@ class Storage extends Service {
|
|
|
2896
3152
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2897
3153
|
return this.client.call('get', uri, {}, payload);
|
|
2898
3154
|
}
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
3155
|
+
updateFile(paramsOrFirst, ...rest) {
|
|
3156
|
+
let params;
|
|
3157
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3158
|
+
params = (paramsOrFirst || {});
|
|
3159
|
+
}
|
|
3160
|
+
else {
|
|
3161
|
+
params = {
|
|
3162
|
+
bucketId: paramsOrFirst,
|
|
3163
|
+
fileId: rest[0],
|
|
3164
|
+
name: rest[1],
|
|
3165
|
+
permissions: rest[2]
|
|
3166
|
+
};
|
|
3167
|
+
}
|
|
3168
|
+
const bucketId = params.bucketId;
|
|
3169
|
+
const fileId = params.fileId;
|
|
3170
|
+
const name = params.name;
|
|
3171
|
+
const permissions = params.permissions;
|
|
2911
3172
|
if (typeof bucketId === 'undefined') {
|
|
2912
3173
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2913
3174
|
}
|
|
@@ -2927,16 +3188,19 @@ class Storage extends Service {
|
|
|
2927
3188
|
'content-type': 'application/json',
|
|
2928
3189
|
}, payload);
|
|
2929
3190
|
}
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
3191
|
+
deleteFile(paramsOrFirst, ...rest) {
|
|
3192
|
+
let params;
|
|
3193
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3194
|
+
params = (paramsOrFirst || {});
|
|
3195
|
+
}
|
|
3196
|
+
else {
|
|
3197
|
+
params = {
|
|
3198
|
+
bucketId: paramsOrFirst,
|
|
3199
|
+
fileId: rest[0]
|
|
3200
|
+
};
|
|
3201
|
+
}
|
|
3202
|
+
const bucketId = params.bucketId;
|
|
3203
|
+
const fileId = params.fileId;
|
|
2940
3204
|
if (typeof bucketId === 'undefined') {
|
|
2941
3205
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2942
3206
|
}
|
|
@@ -2950,18 +3214,21 @@ class Storage extends Service {
|
|
|
2950
3214
|
'content-type': 'application/json',
|
|
2951
3215
|
}, payload);
|
|
2952
3216
|
}
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
3217
|
+
getFileDownload(paramsOrFirst, ...rest) {
|
|
3218
|
+
let params;
|
|
3219
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3220
|
+
params = (paramsOrFirst || {});
|
|
3221
|
+
}
|
|
3222
|
+
else {
|
|
3223
|
+
params = {
|
|
3224
|
+
bucketId: paramsOrFirst,
|
|
3225
|
+
fileId: rest[0],
|
|
3226
|
+
token: rest[1]
|
|
3227
|
+
};
|
|
3228
|
+
}
|
|
3229
|
+
const bucketId = params.bucketId;
|
|
3230
|
+
const fileId = params.fileId;
|
|
3231
|
+
const token = params.token;
|
|
2965
3232
|
if (typeof bucketId === 'undefined') {
|
|
2966
3233
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
2967
3234
|
}
|
|
@@ -2980,31 +3247,43 @@ class Storage extends Service {
|
|
|
2980
3247
|
}
|
|
2981
3248
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
2982
3249
|
}
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3250
|
+
getFilePreview(paramsOrFirst, ...rest) {
|
|
3251
|
+
let params;
|
|
3252
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3253
|
+
params = (paramsOrFirst || {});
|
|
3254
|
+
}
|
|
3255
|
+
else {
|
|
3256
|
+
params = {
|
|
3257
|
+
bucketId: paramsOrFirst,
|
|
3258
|
+
fileId: rest[0],
|
|
3259
|
+
width: rest[1],
|
|
3260
|
+
height: rest[2],
|
|
3261
|
+
gravity: rest[3],
|
|
3262
|
+
quality: rest[4],
|
|
3263
|
+
borderWidth: rest[5],
|
|
3264
|
+
borderColor: rest[6],
|
|
3265
|
+
borderRadius: rest[7],
|
|
3266
|
+
opacity: rest[8],
|
|
3267
|
+
rotation: rest[9],
|
|
3268
|
+
background: rest[10],
|
|
3269
|
+
output: rest[11],
|
|
3270
|
+
token: rest[12]
|
|
3271
|
+
};
|
|
3272
|
+
}
|
|
3273
|
+
const bucketId = params.bucketId;
|
|
3274
|
+
const fileId = params.fileId;
|
|
3275
|
+
const width = params.width;
|
|
3276
|
+
const height = params.height;
|
|
3277
|
+
const gravity = params.gravity;
|
|
3278
|
+
const quality = params.quality;
|
|
3279
|
+
const borderWidth = params.borderWidth;
|
|
3280
|
+
const borderColor = params.borderColor;
|
|
3281
|
+
const borderRadius = params.borderRadius;
|
|
3282
|
+
const opacity = params.opacity;
|
|
3283
|
+
const rotation = params.rotation;
|
|
3284
|
+
const background = params.background;
|
|
3285
|
+
const output = params.output;
|
|
3286
|
+
const token = params.token;
|
|
3008
3287
|
if (typeof bucketId === 'undefined') {
|
|
3009
3288
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
3010
3289
|
}
|
|
@@ -3056,18 +3335,21 @@ class Storage extends Service {
|
|
|
3056
3335
|
}
|
|
3057
3336
|
return this.client.call('get', uri, {}, payload, 'arrayBuffer');
|
|
3058
3337
|
}
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3338
|
+
getFileView(paramsOrFirst, ...rest) {
|
|
3339
|
+
let params;
|
|
3340
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3341
|
+
params = (paramsOrFirst || {});
|
|
3342
|
+
}
|
|
3343
|
+
else {
|
|
3344
|
+
params = {
|
|
3345
|
+
bucketId: paramsOrFirst,
|
|
3346
|
+
fileId: rest[0],
|
|
3347
|
+
token: rest[1]
|
|
3348
|
+
};
|
|
3349
|
+
}
|
|
3350
|
+
const bucketId = params.bucketId;
|
|
3351
|
+
const fileId = params.fileId;
|
|
3352
|
+
const token = params.token;
|
|
3071
3353
|
if (typeof bucketId === 'undefined') {
|
|
3072
3354
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
3073
3355
|
}
|
|
@@ -3206,20 +3488,344 @@ class Storage extends Service {
|
|
|
3206
3488
|
}
|
|
3207
3489
|
}
|
|
3208
3490
|
|
|
3491
|
+
class TablesDB extends Service {
|
|
3492
|
+
constructor(client) {
|
|
3493
|
+
super(client);
|
|
3494
|
+
}
|
|
3495
|
+
listRows(paramsOrFirst, ...rest) {
|
|
3496
|
+
let params;
|
|
3497
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3498
|
+
params = (paramsOrFirst || {});
|
|
3499
|
+
}
|
|
3500
|
+
else {
|
|
3501
|
+
params = {
|
|
3502
|
+
databaseId: paramsOrFirst,
|
|
3503
|
+
tableId: rest[0],
|
|
3504
|
+
queries: rest[1]
|
|
3505
|
+
};
|
|
3506
|
+
}
|
|
3507
|
+
const databaseId = params.databaseId;
|
|
3508
|
+
const tableId = params.tableId;
|
|
3509
|
+
const queries = params.queries;
|
|
3510
|
+
if (typeof databaseId === 'undefined') {
|
|
3511
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3512
|
+
}
|
|
3513
|
+
if (typeof tableId === 'undefined') {
|
|
3514
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3515
|
+
}
|
|
3516
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
|
|
3517
|
+
const payload = {};
|
|
3518
|
+
if (typeof queries !== 'undefined') {
|
|
3519
|
+
payload['queries'] = queries;
|
|
3520
|
+
}
|
|
3521
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3522
|
+
return this.client.call('get', uri, {}, payload);
|
|
3523
|
+
}
|
|
3524
|
+
createRow(paramsOrFirst, ...rest) {
|
|
3525
|
+
let params;
|
|
3526
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3527
|
+
params = (paramsOrFirst || {});
|
|
3528
|
+
}
|
|
3529
|
+
else {
|
|
3530
|
+
params = {
|
|
3531
|
+
databaseId: paramsOrFirst,
|
|
3532
|
+
tableId: rest[0],
|
|
3533
|
+
rowId: rest[1],
|
|
3534
|
+
data: rest[2],
|
|
3535
|
+
permissions: rest[3]
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3538
|
+
const databaseId = params.databaseId;
|
|
3539
|
+
const tableId = params.tableId;
|
|
3540
|
+
const rowId = params.rowId;
|
|
3541
|
+
const data = params.data;
|
|
3542
|
+
const permissions = params.permissions;
|
|
3543
|
+
if (typeof databaseId === 'undefined') {
|
|
3544
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3545
|
+
}
|
|
3546
|
+
if (typeof tableId === 'undefined') {
|
|
3547
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3548
|
+
}
|
|
3549
|
+
if (typeof rowId === 'undefined') {
|
|
3550
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3551
|
+
}
|
|
3552
|
+
if (typeof data === 'undefined') {
|
|
3553
|
+
throw new AppwriteException('Missing required parameter: "data"');
|
|
3554
|
+
}
|
|
3555
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
|
|
3556
|
+
const payload = {};
|
|
3557
|
+
if (typeof rowId !== 'undefined') {
|
|
3558
|
+
payload['rowId'] = rowId;
|
|
3559
|
+
}
|
|
3560
|
+
if (typeof data !== 'undefined') {
|
|
3561
|
+
payload['data'] = data;
|
|
3562
|
+
}
|
|
3563
|
+
if (typeof permissions !== 'undefined') {
|
|
3564
|
+
payload['permissions'] = permissions;
|
|
3565
|
+
}
|
|
3566
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3567
|
+
return this.client.call('post', uri, {
|
|
3568
|
+
'content-type': 'application/json',
|
|
3569
|
+
}, payload);
|
|
3570
|
+
}
|
|
3571
|
+
getRow(paramsOrFirst, ...rest) {
|
|
3572
|
+
let params;
|
|
3573
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3574
|
+
params = (paramsOrFirst || {});
|
|
3575
|
+
}
|
|
3576
|
+
else {
|
|
3577
|
+
params = {
|
|
3578
|
+
databaseId: paramsOrFirst,
|
|
3579
|
+
tableId: rest[0],
|
|
3580
|
+
rowId: rest[1],
|
|
3581
|
+
queries: rest[2]
|
|
3582
|
+
};
|
|
3583
|
+
}
|
|
3584
|
+
const databaseId = params.databaseId;
|
|
3585
|
+
const tableId = params.tableId;
|
|
3586
|
+
const rowId = params.rowId;
|
|
3587
|
+
const queries = params.queries;
|
|
3588
|
+
if (typeof databaseId === 'undefined') {
|
|
3589
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3590
|
+
}
|
|
3591
|
+
if (typeof tableId === 'undefined') {
|
|
3592
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3593
|
+
}
|
|
3594
|
+
if (typeof rowId === 'undefined') {
|
|
3595
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3596
|
+
}
|
|
3597
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3598
|
+
const payload = {};
|
|
3599
|
+
if (typeof queries !== 'undefined') {
|
|
3600
|
+
payload['queries'] = queries;
|
|
3601
|
+
}
|
|
3602
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3603
|
+
return this.client.call('get', uri, {}, payload);
|
|
3604
|
+
}
|
|
3605
|
+
upsertRow(paramsOrFirst, ...rest) {
|
|
3606
|
+
let params;
|
|
3607
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3608
|
+
params = (paramsOrFirst || {});
|
|
3609
|
+
}
|
|
3610
|
+
else {
|
|
3611
|
+
params = {
|
|
3612
|
+
databaseId: paramsOrFirst,
|
|
3613
|
+
tableId: rest[0],
|
|
3614
|
+
rowId: rest[1],
|
|
3615
|
+
data: rest[2],
|
|
3616
|
+
permissions: rest[3]
|
|
3617
|
+
};
|
|
3618
|
+
}
|
|
3619
|
+
const databaseId = params.databaseId;
|
|
3620
|
+
const tableId = params.tableId;
|
|
3621
|
+
const rowId = params.rowId;
|
|
3622
|
+
const data = params.data;
|
|
3623
|
+
const permissions = params.permissions;
|
|
3624
|
+
if (typeof databaseId === 'undefined') {
|
|
3625
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3626
|
+
}
|
|
3627
|
+
if (typeof tableId === 'undefined') {
|
|
3628
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3629
|
+
}
|
|
3630
|
+
if (typeof rowId === 'undefined') {
|
|
3631
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3632
|
+
}
|
|
3633
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3634
|
+
const payload = {};
|
|
3635
|
+
if (typeof data !== 'undefined') {
|
|
3636
|
+
payload['data'] = data;
|
|
3637
|
+
}
|
|
3638
|
+
if (typeof permissions !== 'undefined') {
|
|
3639
|
+
payload['permissions'] = permissions;
|
|
3640
|
+
}
|
|
3641
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3642
|
+
return this.client.call('put', uri, {
|
|
3643
|
+
'content-type': 'application/json',
|
|
3644
|
+
}, payload);
|
|
3645
|
+
}
|
|
3646
|
+
updateRow(paramsOrFirst, ...rest) {
|
|
3647
|
+
let params;
|
|
3648
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3649
|
+
params = (paramsOrFirst || {});
|
|
3650
|
+
}
|
|
3651
|
+
else {
|
|
3652
|
+
params = {
|
|
3653
|
+
databaseId: paramsOrFirst,
|
|
3654
|
+
tableId: rest[0],
|
|
3655
|
+
rowId: rest[1],
|
|
3656
|
+
data: rest[2],
|
|
3657
|
+
permissions: rest[3]
|
|
3658
|
+
};
|
|
3659
|
+
}
|
|
3660
|
+
const databaseId = params.databaseId;
|
|
3661
|
+
const tableId = params.tableId;
|
|
3662
|
+
const rowId = params.rowId;
|
|
3663
|
+
const data = params.data;
|
|
3664
|
+
const permissions = params.permissions;
|
|
3665
|
+
if (typeof databaseId === 'undefined') {
|
|
3666
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3667
|
+
}
|
|
3668
|
+
if (typeof tableId === 'undefined') {
|
|
3669
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3670
|
+
}
|
|
3671
|
+
if (typeof rowId === 'undefined') {
|
|
3672
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3673
|
+
}
|
|
3674
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3675
|
+
const payload = {};
|
|
3676
|
+
if (typeof data !== 'undefined') {
|
|
3677
|
+
payload['data'] = data;
|
|
3678
|
+
}
|
|
3679
|
+
if (typeof permissions !== 'undefined') {
|
|
3680
|
+
payload['permissions'] = permissions;
|
|
3681
|
+
}
|
|
3682
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3683
|
+
return this.client.call('patch', uri, {
|
|
3684
|
+
'content-type': 'application/json',
|
|
3685
|
+
}, payload);
|
|
3686
|
+
}
|
|
3687
|
+
deleteRow(paramsOrFirst, ...rest) {
|
|
3688
|
+
let params;
|
|
3689
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3690
|
+
params = (paramsOrFirst || {});
|
|
3691
|
+
}
|
|
3692
|
+
else {
|
|
3693
|
+
params = {
|
|
3694
|
+
databaseId: paramsOrFirst,
|
|
3695
|
+
tableId: rest[0],
|
|
3696
|
+
rowId: rest[1]
|
|
3697
|
+
};
|
|
3698
|
+
}
|
|
3699
|
+
const databaseId = params.databaseId;
|
|
3700
|
+
const tableId = params.tableId;
|
|
3701
|
+
const rowId = params.rowId;
|
|
3702
|
+
if (typeof databaseId === 'undefined') {
|
|
3703
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3704
|
+
}
|
|
3705
|
+
if (typeof tableId === 'undefined') {
|
|
3706
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3707
|
+
}
|
|
3708
|
+
if (typeof rowId === 'undefined') {
|
|
3709
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3710
|
+
}
|
|
3711
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3712
|
+
const payload = {};
|
|
3713
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3714
|
+
return this.client.call('delete', uri, {
|
|
3715
|
+
'content-type': 'application/json',
|
|
3716
|
+
}, payload);
|
|
3717
|
+
}
|
|
3718
|
+
decrementRowColumn(paramsOrFirst, ...rest) {
|
|
3719
|
+
let params;
|
|
3720
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3721
|
+
params = (paramsOrFirst || {});
|
|
3722
|
+
}
|
|
3723
|
+
else {
|
|
3724
|
+
params = {
|
|
3725
|
+
databaseId: paramsOrFirst,
|
|
3726
|
+
tableId: rest[0],
|
|
3727
|
+
rowId: rest[1],
|
|
3728
|
+
column: rest[2],
|
|
3729
|
+
value: rest[3],
|
|
3730
|
+
min: rest[4]
|
|
3731
|
+
};
|
|
3732
|
+
}
|
|
3733
|
+
const databaseId = params.databaseId;
|
|
3734
|
+
const tableId = params.tableId;
|
|
3735
|
+
const rowId = params.rowId;
|
|
3736
|
+
const column = params.column;
|
|
3737
|
+
const value = params.value;
|
|
3738
|
+
const min = params.min;
|
|
3739
|
+
if (typeof databaseId === 'undefined') {
|
|
3740
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3741
|
+
}
|
|
3742
|
+
if (typeof tableId === 'undefined') {
|
|
3743
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3744
|
+
}
|
|
3745
|
+
if (typeof rowId === 'undefined') {
|
|
3746
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3747
|
+
}
|
|
3748
|
+
if (typeof column === 'undefined') {
|
|
3749
|
+
throw new AppwriteException('Missing required parameter: "column"');
|
|
3750
|
+
}
|
|
3751
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
|
|
3752
|
+
const payload = {};
|
|
3753
|
+
if (typeof value !== 'undefined') {
|
|
3754
|
+
payload['value'] = value;
|
|
3755
|
+
}
|
|
3756
|
+
if (typeof min !== 'undefined') {
|
|
3757
|
+
payload['min'] = min;
|
|
3758
|
+
}
|
|
3759
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3760
|
+
return this.client.call('patch', uri, {
|
|
3761
|
+
'content-type': 'application/json',
|
|
3762
|
+
}, payload);
|
|
3763
|
+
}
|
|
3764
|
+
incrementRowColumn(paramsOrFirst, ...rest) {
|
|
3765
|
+
let params;
|
|
3766
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3767
|
+
params = (paramsOrFirst || {});
|
|
3768
|
+
}
|
|
3769
|
+
else {
|
|
3770
|
+
params = {
|
|
3771
|
+
databaseId: paramsOrFirst,
|
|
3772
|
+
tableId: rest[0],
|
|
3773
|
+
rowId: rest[1],
|
|
3774
|
+
column: rest[2],
|
|
3775
|
+
value: rest[3],
|
|
3776
|
+
max: rest[4]
|
|
3777
|
+
};
|
|
3778
|
+
}
|
|
3779
|
+
const databaseId = params.databaseId;
|
|
3780
|
+
const tableId = params.tableId;
|
|
3781
|
+
const rowId = params.rowId;
|
|
3782
|
+
const column = params.column;
|
|
3783
|
+
const value = params.value;
|
|
3784
|
+
const max = params.max;
|
|
3785
|
+
if (typeof databaseId === 'undefined') {
|
|
3786
|
+
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3787
|
+
}
|
|
3788
|
+
if (typeof tableId === 'undefined') {
|
|
3789
|
+
throw new AppwriteException('Missing required parameter: "tableId"');
|
|
3790
|
+
}
|
|
3791
|
+
if (typeof rowId === 'undefined') {
|
|
3792
|
+
throw new AppwriteException('Missing required parameter: "rowId"');
|
|
3793
|
+
}
|
|
3794
|
+
if (typeof column === 'undefined') {
|
|
3795
|
+
throw new AppwriteException('Missing required parameter: "column"');
|
|
3796
|
+
}
|
|
3797
|
+
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
|
|
3798
|
+
const payload = {};
|
|
3799
|
+
if (typeof value !== 'undefined') {
|
|
3800
|
+
payload['value'] = value;
|
|
3801
|
+
}
|
|
3802
|
+
if (typeof max !== 'undefined') {
|
|
3803
|
+
payload['max'] = max;
|
|
3804
|
+
}
|
|
3805
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3806
|
+
return this.client.call('patch', uri, {
|
|
3807
|
+
'content-type': 'application/json',
|
|
3808
|
+
}, payload);
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3209
3812
|
class Teams extends Service {
|
|
3210
3813
|
constructor(client) {
|
|
3211
3814
|
super(client);
|
|
3212
3815
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3816
|
+
list(paramsOrFirst, ...rest) {
|
|
3817
|
+
let params;
|
|
3818
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3819
|
+
params = (paramsOrFirst || {});
|
|
3820
|
+
}
|
|
3821
|
+
else {
|
|
3822
|
+
params = {
|
|
3823
|
+
queries: paramsOrFirst,
|
|
3824
|
+
search: rest[0]
|
|
3825
|
+
};
|
|
3826
|
+
}
|
|
3827
|
+
const queries = params.queries;
|
|
3828
|
+
const search = params.search;
|
|
3223
3829
|
const apiPath = '/teams';
|
|
3224
3830
|
const payload = {};
|
|
3225
3831
|
if (typeof queries !== 'undefined') {
|
|
@@ -3231,18 +3837,21 @@ class Teams extends Service {
|
|
|
3231
3837
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3232
3838
|
return this.client.call('get', uri, {}, payload);
|
|
3233
3839
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3840
|
+
create(paramsOrFirst, ...rest) {
|
|
3841
|
+
let params;
|
|
3842
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3843
|
+
params = (paramsOrFirst || {});
|
|
3844
|
+
}
|
|
3845
|
+
else {
|
|
3846
|
+
params = {
|
|
3847
|
+
teamId: paramsOrFirst,
|
|
3848
|
+
name: rest[0],
|
|
3849
|
+
roles: rest[1]
|
|
3850
|
+
};
|
|
3851
|
+
}
|
|
3852
|
+
const teamId = params.teamId;
|
|
3853
|
+
const name = params.name;
|
|
3854
|
+
const roles = params.roles;
|
|
3246
3855
|
if (typeof teamId === 'undefined') {
|
|
3247
3856
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3248
3857
|
}
|
|
@@ -3265,14 +3874,17 @@ class Teams extends Service {
|
|
|
3265
3874
|
'content-type': 'application/json',
|
|
3266
3875
|
}, payload);
|
|
3267
3876
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3877
|
+
get(paramsOrFirst) {
|
|
3878
|
+
let params;
|
|
3879
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3880
|
+
params = (paramsOrFirst || {});
|
|
3881
|
+
}
|
|
3882
|
+
else {
|
|
3883
|
+
params = {
|
|
3884
|
+
teamId: paramsOrFirst
|
|
3885
|
+
};
|
|
3886
|
+
}
|
|
3887
|
+
const teamId = params.teamId;
|
|
3276
3888
|
if (typeof teamId === 'undefined') {
|
|
3277
3889
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3278
3890
|
}
|
|
@@ -3281,15 +3893,19 @@ class Teams extends Service {
|
|
|
3281
3893
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3282
3894
|
return this.client.call('get', uri, {}, payload);
|
|
3283
3895
|
}
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3896
|
+
updateName(paramsOrFirst, ...rest) {
|
|
3897
|
+
let params;
|
|
3898
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3899
|
+
params = (paramsOrFirst || {});
|
|
3900
|
+
}
|
|
3901
|
+
else {
|
|
3902
|
+
params = {
|
|
3903
|
+
teamId: paramsOrFirst,
|
|
3904
|
+
name: rest[0]
|
|
3905
|
+
};
|
|
3906
|
+
}
|
|
3907
|
+
const teamId = params.teamId;
|
|
3908
|
+
const name = params.name;
|
|
3293
3909
|
if (typeof teamId === 'undefined') {
|
|
3294
3910
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3295
3911
|
}
|
|
@@ -3306,15 +3922,17 @@ class Teams extends Service {
|
|
|
3306
3922
|
'content-type': 'application/json',
|
|
3307
3923
|
}, payload);
|
|
3308
3924
|
}
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3925
|
+
delete(paramsOrFirst) {
|
|
3926
|
+
let params;
|
|
3927
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3928
|
+
params = (paramsOrFirst || {});
|
|
3929
|
+
}
|
|
3930
|
+
else {
|
|
3931
|
+
params = {
|
|
3932
|
+
teamId: paramsOrFirst
|
|
3933
|
+
};
|
|
3934
|
+
}
|
|
3935
|
+
const teamId = params.teamId;
|
|
3318
3936
|
if (typeof teamId === 'undefined') {
|
|
3319
3937
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3320
3938
|
}
|
|
@@ -3325,18 +3943,21 @@ class Teams extends Service {
|
|
|
3325
3943
|
'content-type': 'application/json',
|
|
3326
3944
|
}, payload);
|
|
3327
3945
|
}
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3946
|
+
listMemberships(paramsOrFirst, ...rest) {
|
|
3947
|
+
let params;
|
|
3948
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3949
|
+
params = (paramsOrFirst || {});
|
|
3950
|
+
}
|
|
3951
|
+
else {
|
|
3952
|
+
params = {
|
|
3953
|
+
teamId: paramsOrFirst,
|
|
3954
|
+
queries: rest[0],
|
|
3955
|
+
search: rest[1]
|
|
3956
|
+
};
|
|
3957
|
+
}
|
|
3958
|
+
const teamId = params.teamId;
|
|
3959
|
+
const queries = params.queries;
|
|
3960
|
+
const search = params.search;
|
|
3340
3961
|
if (typeof teamId === 'undefined') {
|
|
3341
3962
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3342
3963
|
}
|
|
@@ -3351,40 +3972,29 @@ class Teams extends Service {
|
|
|
3351
3972
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3352
3973
|
return this.client.call('get', uri, {}, payload);
|
|
3353
3974
|
}
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
* @param {string} teamId
|
|
3378
|
-
* @param {string[]} roles
|
|
3379
|
-
* @param {string} email
|
|
3380
|
-
* @param {string} userId
|
|
3381
|
-
* @param {string} phone
|
|
3382
|
-
* @param {string} url
|
|
3383
|
-
* @param {string} name
|
|
3384
|
-
* @throws {AppwriteException}
|
|
3385
|
-
* @returns {Promise}
|
|
3386
|
-
*/
|
|
3387
|
-
createMembership(teamId, roles, email, userId, phone, url, name) {
|
|
3975
|
+
createMembership(paramsOrFirst, ...rest) {
|
|
3976
|
+
let params;
|
|
3977
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3978
|
+
params = (paramsOrFirst || {});
|
|
3979
|
+
}
|
|
3980
|
+
else {
|
|
3981
|
+
params = {
|
|
3982
|
+
teamId: paramsOrFirst,
|
|
3983
|
+
roles: rest[0],
|
|
3984
|
+
email: rest[1],
|
|
3985
|
+
userId: rest[2],
|
|
3986
|
+
phone: rest[3],
|
|
3987
|
+
url: rest[4],
|
|
3988
|
+
name: rest[5]
|
|
3989
|
+
};
|
|
3990
|
+
}
|
|
3991
|
+
const teamId = params.teamId;
|
|
3992
|
+
const roles = params.roles;
|
|
3993
|
+
const email = params.email;
|
|
3994
|
+
const userId = params.userId;
|
|
3995
|
+
const phone = params.phone;
|
|
3996
|
+
const url = params.url;
|
|
3997
|
+
const name = params.name;
|
|
3388
3998
|
if (typeof teamId === 'undefined') {
|
|
3389
3999
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3390
4000
|
}
|
|
@@ -3416,17 +4026,19 @@ class Teams extends Service {
|
|
|
3416
4026
|
'content-type': 'application/json',
|
|
3417
4027
|
}, payload);
|
|
3418
4028
|
}
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
4029
|
+
getMembership(paramsOrFirst, ...rest) {
|
|
4030
|
+
let params;
|
|
4031
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4032
|
+
params = (paramsOrFirst || {});
|
|
4033
|
+
}
|
|
4034
|
+
else {
|
|
4035
|
+
params = {
|
|
4036
|
+
teamId: paramsOrFirst,
|
|
4037
|
+
membershipId: rest[0]
|
|
4038
|
+
};
|
|
4039
|
+
}
|
|
4040
|
+
const teamId = params.teamId;
|
|
4041
|
+
const membershipId = params.membershipId;
|
|
3430
4042
|
if (typeof teamId === 'undefined') {
|
|
3431
4043
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3432
4044
|
}
|
|
@@ -3438,19 +4050,21 @@ class Teams extends Service {
|
|
|
3438
4050
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3439
4051
|
return this.client.call('get', uri, {}, payload);
|
|
3440
4052
|
}
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
4053
|
+
updateMembership(paramsOrFirst, ...rest) {
|
|
4054
|
+
let params;
|
|
4055
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4056
|
+
params = (paramsOrFirst || {});
|
|
4057
|
+
}
|
|
4058
|
+
else {
|
|
4059
|
+
params = {
|
|
4060
|
+
teamId: paramsOrFirst,
|
|
4061
|
+
membershipId: rest[0],
|
|
4062
|
+
roles: rest[1]
|
|
4063
|
+
};
|
|
4064
|
+
}
|
|
4065
|
+
const teamId = params.teamId;
|
|
4066
|
+
const membershipId = params.membershipId;
|
|
4067
|
+
const roles = params.roles;
|
|
3454
4068
|
if (typeof teamId === 'undefined') {
|
|
3455
4069
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3456
4070
|
}
|
|
@@ -3470,17 +4084,19 @@ class Teams extends Service {
|
|
|
3470
4084
|
'content-type': 'application/json',
|
|
3471
4085
|
}, payload);
|
|
3472
4086
|
}
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
4087
|
+
deleteMembership(paramsOrFirst, ...rest) {
|
|
4088
|
+
let params;
|
|
4089
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4090
|
+
params = (paramsOrFirst || {});
|
|
4091
|
+
}
|
|
4092
|
+
else {
|
|
4093
|
+
params = {
|
|
4094
|
+
teamId: paramsOrFirst,
|
|
4095
|
+
membershipId: rest[0]
|
|
4096
|
+
};
|
|
4097
|
+
}
|
|
4098
|
+
const teamId = params.teamId;
|
|
4099
|
+
const membershipId = params.membershipId;
|
|
3484
4100
|
if (typeof teamId === 'undefined') {
|
|
3485
4101
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3486
4102
|
}
|
|
@@ -3494,23 +4110,23 @@ class Teams extends Service {
|
|
|
3494
4110
|
'content-type': 'application/json',
|
|
3495
4111
|
}, payload);
|
|
3496
4112
|
}
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
4113
|
+
updateMembershipStatus(paramsOrFirst, ...rest) {
|
|
4114
|
+
let params;
|
|
4115
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4116
|
+
params = (paramsOrFirst || {});
|
|
4117
|
+
}
|
|
4118
|
+
else {
|
|
4119
|
+
params = {
|
|
4120
|
+
teamId: paramsOrFirst,
|
|
4121
|
+
membershipId: rest[0],
|
|
4122
|
+
userId: rest[1],
|
|
4123
|
+
secret: rest[2]
|
|
4124
|
+
};
|
|
4125
|
+
}
|
|
4126
|
+
const teamId = params.teamId;
|
|
4127
|
+
const membershipId = params.membershipId;
|
|
4128
|
+
const userId = params.userId;
|
|
4129
|
+
const secret = params.secret;
|
|
3514
4130
|
if (typeof teamId === 'undefined') {
|
|
3515
4131
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3516
4132
|
}
|
|
@@ -3536,16 +4152,17 @@ class Teams extends Service {
|
|
|
3536
4152
|
'content-type': 'application/json',
|
|
3537
4153
|
}, payload);
|
|
3538
4154
|
}
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
4155
|
+
getPrefs(paramsOrFirst) {
|
|
4156
|
+
let params;
|
|
4157
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4158
|
+
params = (paramsOrFirst || {});
|
|
4159
|
+
}
|
|
4160
|
+
else {
|
|
4161
|
+
params = {
|
|
4162
|
+
teamId: paramsOrFirst
|
|
4163
|
+
};
|
|
4164
|
+
}
|
|
4165
|
+
const teamId = params.teamId;
|
|
3549
4166
|
if (typeof teamId === 'undefined') {
|
|
3550
4167
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3551
4168
|
}
|
|
@@ -3554,17 +4171,19 @@ class Teams extends Service {
|
|
|
3554
4171
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3555
4172
|
return this.client.call('get', uri, {}, payload);
|
|
3556
4173
|
}
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
4174
|
+
updatePrefs(paramsOrFirst, ...rest) {
|
|
4175
|
+
let params;
|
|
4176
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
4177
|
+
params = (paramsOrFirst || {});
|
|
4178
|
+
}
|
|
4179
|
+
else {
|
|
4180
|
+
params = {
|
|
4181
|
+
teamId: paramsOrFirst,
|
|
4182
|
+
prefs: rest[0]
|
|
4183
|
+
};
|
|
4184
|
+
}
|
|
4185
|
+
const teamId = params.teamId;
|
|
4186
|
+
const prefs = params.prefs;
|
|
3568
4187
|
if (typeof teamId === 'undefined') {
|
|
3569
4188
|
throw new AppwriteException('Missing required parameter: "teamId"');
|
|
3570
4189
|
}
|
|
@@ -3623,7 +4242,84 @@ Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, document
|
|
|
3623
4242
|
Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
|
|
3624
4243
|
Query.limit = (limit) => new Query("limit", undefined, limit).toString();
|
|
3625
4244
|
Query.offset = (offset) => new Query("offset", undefined, offset).toString();
|
|
4245
|
+
/**
|
|
4246
|
+
* Filter resources where attribute contains the specified value.
|
|
4247
|
+
*
|
|
4248
|
+
* @param {string} attribute
|
|
4249
|
+
* @param {string | string[]} value
|
|
4250
|
+
* @returns {string}
|
|
4251
|
+
*/
|
|
3626
4252
|
Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
|
|
4253
|
+
/**
|
|
4254
|
+
* Filter resources where attribute does not contain the specified value.
|
|
4255
|
+
*
|
|
4256
|
+
* @param {string} attribute
|
|
4257
|
+
* @param {string | string[]} value
|
|
4258
|
+
* @returns {string}
|
|
4259
|
+
*/
|
|
4260
|
+
Query.notContains = (attribute, value) => new Query("notContains", attribute, value).toString();
|
|
4261
|
+
/**
|
|
4262
|
+
* Filter resources by searching attribute for value (inverse of search).
|
|
4263
|
+
* A fulltext index on attribute is required for this query to work.
|
|
4264
|
+
*
|
|
4265
|
+
* @param {string} attribute
|
|
4266
|
+
* @param {string} value
|
|
4267
|
+
* @returns {string}
|
|
4268
|
+
*/
|
|
4269
|
+
Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value).toString();
|
|
4270
|
+
/**
|
|
4271
|
+
* Filter resources where attribute is not between start and end (exclusive).
|
|
4272
|
+
*
|
|
4273
|
+
* @param {string} attribute
|
|
4274
|
+
* @param {string | number} start
|
|
4275
|
+
* @param {string | number} end
|
|
4276
|
+
* @returns {string}
|
|
4277
|
+
*/
|
|
4278
|
+
Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
|
|
4279
|
+
/**
|
|
4280
|
+
* Filter resources where attribute does not start with value.
|
|
4281
|
+
*
|
|
4282
|
+
* @param {string} attribute
|
|
4283
|
+
* @param {string} value
|
|
4284
|
+
* @returns {string}
|
|
4285
|
+
*/
|
|
4286
|
+
Query.notStartsWith = (attribute, value) => new Query("notStartsWith", attribute, value).toString();
|
|
4287
|
+
/**
|
|
4288
|
+
* Filter resources where attribute does not end with value.
|
|
4289
|
+
*
|
|
4290
|
+
* @param {string} attribute
|
|
4291
|
+
* @param {string} value
|
|
4292
|
+
* @returns {string}
|
|
4293
|
+
*/
|
|
4294
|
+
Query.notEndsWith = (attribute, value) => new Query("notEndsWith", attribute, value).toString();
|
|
4295
|
+
/**
|
|
4296
|
+
* Filter resources where document was created before date.
|
|
4297
|
+
*
|
|
4298
|
+
* @param {string} value
|
|
4299
|
+
* @returns {string}
|
|
4300
|
+
*/
|
|
4301
|
+
Query.createdBefore = (value) => new Query("createdBefore", undefined, value).toString();
|
|
4302
|
+
/**
|
|
4303
|
+
* Filter resources where document was created after date.
|
|
4304
|
+
*
|
|
4305
|
+
* @param {string} value
|
|
4306
|
+
* @returns {string}
|
|
4307
|
+
*/
|
|
4308
|
+
Query.createdAfter = (value) => new Query("createdAfter", undefined, value).toString();
|
|
4309
|
+
/**
|
|
4310
|
+
* Filter resources where document was updated before date.
|
|
4311
|
+
*
|
|
4312
|
+
* @param {string} value
|
|
4313
|
+
* @returns {string}
|
|
4314
|
+
*/
|
|
4315
|
+
Query.updatedBefore = (value) => new Query("updatedBefore", undefined, value).toString();
|
|
4316
|
+
/**
|
|
4317
|
+
* Filter resources where document was updated after date.
|
|
4318
|
+
*
|
|
4319
|
+
* @param {string} value
|
|
4320
|
+
* @returns {string}
|
|
4321
|
+
*/
|
|
4322
|
+
Query.updatedAfter = (value) => new Query("updatedAfter", undefined, value).toString();
|
|
3627
4323
|
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
3628
4324
|
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
|
|
3629
4325
|
|
|
@@ -4093,5 +4789,5 @@ var ImageFormat;
|
|
|
4093
4789
|
ImageFormat["Gif"] = "gif";
|
|
4094
4790
|
})(ImageFormat || (ImageFormat = {}));
|
|
4095
4791
|
|
|
4096
|
-
export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Permission, Query, Role, Storage, Teams };
|
|
4792
|
+
export { Account, AppwriteException, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, ID, ImageFormat, ImageGravity, Locale, Messaging, OAuthProvider, Permission, Query, Role, Storage, TablesDB, Teams };
|
|
4097
4793
|
//# sourceMappingURL=sdk.js.map
|