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