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