@appwrite.io/console 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +1 -1
- package/CHANGELOG.md +45 -6
- package/README.md +82 -2
- package/dist/cjs/sdk.js +246 -193
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +246 -193
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +246 -193
- package/docs/examples/databases/create-document.md +1 -3
- package/docs/examples/databases/create-documents.md +1 -1
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/organizations/get-available-credits.md +13 -0
- package/docs/examples/organizations/update-projects.md +14 -0
- package/docs/examples/vcs/get-repository-contents.md +2 -1
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/models.ts +241 -9
- package/src/services/account.ts +97 -36
- package/src/services/avatars.ts +26 -20
- package/src/services/backups.ts +11 -0
- package/src/services/console.ts +8 -1
- package/src/services/databases.ts +97 -33
- package/src/services/domains.ts +111 -69
- package/src/services/functions.ts +37 -8
- package/src/services/graphql.ts +1 -0
- package/src/services/health.ts +26 -1
- package/src/services/locale.ts +9 -2
- package/src/services/messaging.ts +53 -8
- package/src/services/migrations.ts +12 -0
- package/src/services/organizations.ts +106 -16
- package/src/services/project.ts +5 -0
- package/src/services/projects.ts +50 -0
- package/src/services/proxy.ts +7 -0
- package/src/services/sites.ts +32 -4
- package/src/services/storage.ts +23 -9
- package/src/services/teams.ts +30 -17
- package/src/services/tokens.ts +4 -0
- package/src/services/users.ts +69 -27
- package/src/services/vcs.ts +16 -4
- package/types/models.d.ts +228 -192
- package/types/services/account.d.ts +36 -36
- package/types/services/avatars.d.ts +20 -20
- package/types/services/console.d.ts +1 -1
- package/types/services/databases.d.ts +43 -33
- package/types/services/domains.d.ts +69 -69
- package/types/services/functions.d.ts +8 -8
- package/types/services/health.d.ts +1 -1
- package/types/services/locale.d.ts +2 -2
- package/types/services/messaging.d.ts +8 -8
- package/types/services/organizations.d.ts +33 -16
- package/types/services/sites.d.ts +4 -4
- package/types/services/storage.d.ts +9 -9
- package/types/services/teams.d.ts +17 -17
- package/types/services/users.d.ts +27 -27
- package/types/services/vcs.d.ts +4 -4
package/src/services/account.ts
CHANGED
|
@@ -18,7 +18,7 @@ export class Account {
|
|
|
18
18
|
* @throws {AppwriteException}
|
|
19
19
|
* @returns {Promise<Models.User<Preferences>>}
|
|
20
20
|
*/
|
|
21
|
-
get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
21
|
+
get<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
|
|
22
22
|
const apiPath = '/account';
|
|
23
23
|
const payload: Payload = {};
|
|
24
24
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -33,6 +33,7 @@ export class Account {
|
|
|
33
33
|
payload
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
|
+
|
|
36
37
|
/**
|
|
37
38
|
* Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
38
39
|
*
|
|
@@ -43,7 +44,7 @@ export class Account {
|
|
|
43
44
|
* @throws {AppwriteException}
|
|
44
45
|
* @returns {Promise<Models.User<Preferences>>}
|
|
45
46
|
*/
|
|
46
|
-
create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
47
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
47
48
|
if (typeof userId === 'undefined') {
|
|
48
49
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
49
50
|
}
|
|
@@ -80,6 +81,7 @@ export class Account {
|
|
|
80
81
|
payload
|
|
81
82
|
);
|
|
82
83
|
}
|
|
84
|
+
|
|
83
85
|
/**
|
|
84
86
|
* Delete the currently logged in user.
|
|
85
87
|
*
|
|
@@ -102,6 +104,7 @@ export class Account {
|
|
|
102
104
|
payload
|
|
103
105
|
);
|
|
104
106
|
}
|
|
107
|
+
|
|
105
108
|
/**
|
|
106
109
|
* List all billing addresses for a user.
|
|
107
110
|
*
|
|
@@ -127,6 +130,7 @@ export class Account {
|
|
|
127
130
|
payload
|
|
128
131
|
);
|
|
129
132
|
}
|
|
133
|
+
|
|
130
134
|
/**
|
|
131
135
|
* Add a new billing address to a user's account.
|
|
132
136
|
*
|
|
@@ -185,6 +189,7 @@ export class Account {
|
|
|
185
189
|
payload
|
|
186
190
|
);
|
|
187
191
|
}
|
|
192
|
+
|
|
188
193
|
/**
|
|
189
194
|
* Get a specific billing address for a user using it's ID.
|
|
190
195
|
*
|
|
@@ -210,6 +215,7 @@ export class Account {
|
|
|
210
215
|
payload
|
|
211
216
|
);
|
|
212
217
|
}
|
|
218
|
+
|
|
213
219
|
/**
|
|
214
220
|
* Update a specific billing address using it's ID.
|
|
215
221
|
*
|
|
@@ -272,6 +278,7 @@ export class Account {
|
|
|
272
278
|
payload
|
|
273
279
|
);
|
|
274
280
|
}
|
|
281
|
+
|
|
275
282
|
/**
|
|
276
283
|
* Delete a specific billing address using it's ID.
|
|
277
284
|
*
|
|
@@ -298,6 +305,7 @@ export class Account {
|
|
|
298
305
|
payload
|
|
299
306
|
);
|
|
300
307
|
}
|
|
308
|
+
|
|
301
309
|
/**
|
|
302
310
|
* Get coupon details for an account.
|
|
303
311
|
*
|
|
@@ -323,17 +331,18 @@ export class Account {
|
|
|
323
331
|
payload
|
|
324
332
|
);
|
|
325
333
|
}
|
|
334
|
+
|
|
326
335
|
/**
|
|
327
336
|
* Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
|
|
328
|
-
This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
329
|
-
|
|
337
|
+
* This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
338
|
+
*
|
|
330
339
|
*
|
|
331
340
|
* @param {string} email
|
|
332
341
|
* @param {string} password
|
|
333
342
|
* @throws {AppwriteException}
|
|
334
343
|
* @returns {Promise<Models.User<Preferences>>}
|
|
335
344
|
*/
|
|
336
|
-
updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>> {
|
|
345
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>> {
|
|
337
346
|
if (typeof email === 'undefined') {
|
|
338
347
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
339
348
|
}
|
|
@@ -361,6 +370,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
361
370
|
payload
|
|
362
371
|
);
|
|
363
372
|
}
|
|
373
|
+
|
|
364
374
|
/**
|
|
365
375
|
* Get the list of identities for the currently logged in user.
|
|
366
376
|
*
|
|
@@ -386,6 +396,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
386
396
|
payload
|
|
387
397
|
);
|
|
388
398
|
}
|
|
399
|
+
|
|
389
400
|
/**
|
|
390
401
|
* Delete an identity by its unique ID.
|
|
391
402
|
*
|
|
@@ -412,6 +423,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
412
423
|
payload
|
|
413
424
|
);
|
|
414
425
|
}
|
|
426
|
+
|
|
415
427
|
/**
|
|
416
428
|
* List all invoices tied to an account.
|
|
417
429
|
*
|
|
@@ -437,6 +449,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
437
449
|
payload
|
|
438
450
|
);
|
|
439
451
|
}
|
|
452
|
+
|
|
440
453
|
/**
|
|
441
454
|
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
|
|
442
455
|
*
|
|
@@ -459,6 +472,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
459
472
|
payload
|
|
460
473
|
);
|
|
461
474
|
}
|
|
475
|
+
|
|
462
476
|
/**
|
|
463
477
|
* Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
|
|
464
478
|
*
|
|
@@ -484,6 +498,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
484
498
|
payload
|
|
485
499
|
);
|
|
486
500
|
}
|
|
501
|
+
|
|
487
502
|
/**
|
|
488
503
|
* Enable or disable MFA on an account.
|
|
489
504
|
*
|
|
@@ -491,7 +506,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
491
506
|
* @throws {AppwriteException}
|
|
492
507
|
* @returns {Promise<Models.User<Preferences>>}
|
|
493
508
|
*/
|
|
494
|
-
updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences>> {
|
|
509
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>> {
|
|
495
510
|
if (typeof mfa === 'undefined') {
|
|
496
511
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
497
512
|
}
|
|
@@ -513,6 +528,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
513
528
|
payload
|
|
514
529
|
);
|
|
515
530
|
}
|
|
531
|
+
|
|
516
532
|
/**
|
|
517
533
|
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
518
534
|
*
|
|
@@ -539,6 +555,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
539
555
|
payload
|
|
540
556
|
);
|
|
541
557
|
}
|
|
558
|
+
|
|
542
559
|
/**
|
|
543
560
|
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
544
561
|
*
|
|
@@ -547,7 +564,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
547
564
|
* @throws {AppwriteException}
|
|
548
565
|
* @returns {Promise<Models.User<Preferences>>}
|
|
549
566
|
*/
|
|
550
|
-
updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
|
|
567
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
|
|
551
568
|
if (typeof type === 'undefined') {
|
|
552
569
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
553
570
|
}
|
|
@@ -572,6 +589,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
572
589
|
payload
|
|
573
590
|
);
|
|
574
591
|
}
|
|
592
|
+
|
|
575
593
|
/**
|
|
576
594
|
* Delete an authenticator for a user by ID.
|
|
577
595
|
*
|
|
@@ -598,6 +616,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
598
616
|
payload
|
|
599
617
|
);
|
|
600
618
|
}
|
|
619
|
+
|
|
601
620
|
/**
|
|
602
621
|
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
603
622
|
*
|
|
@@ -627,6 +646,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
627
646
|
payload
|
|
628
647
|
);
|
|
629
648
|
}
|
|
649
|
+
|
|
630
650
|
/**
|
|
631
651
|
* Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
632
652
|
*
|
|
@@ -663,6 +683,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
663
683
|
payload
|
|
664
684
|
);
|
|
665
685
|
}
|
|
686
|
+
|
|
666
687
|
/**
|
|
667
688
|
* List the factors available on the account to be used as a MFA challange.
|
|
668
689
|
*
|
|
@@ -684,6 +705,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
684
705
|
payload
|
|
685
706
|
);
|
|
686
707
|
}
|
|
708
|
+
|
|
687
709
|
/**
|
|
688
710
|
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
|
|
689
711
|
*
|
|
@@ -705,6 +727,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
705
727
|
payload
|
|
706
728
|
);
|
|
707
729
|
}
|
|
730
|
+
|
|
708
731
|
/**
|
|
709
732
|
* Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
710
733
|
*
|
|
@@ -727,6 +750,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
727
750
|
payload
|
|
728
751
|
);
|
|
729
752
|
}
|
|
753
|
+
|
|
730
754
|
/**
|
|
731
755
|
* Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
|
|
732
756
|
*
|
|
@@ -749,6 +773,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
749
773
|
payload
|
|
750
774
|
);
|
|
751
775
|
}
|
|
776
|
+
|
|
752
777
|
/**
|
|
753
778
|
* Update currently logged in user account name.
|
|
754
779
|
*
|
|
@@ -756,7 +781,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
756
781
|
* @throws {AppwriteException}
|
|
757
782
|
* @returns {Promise<Models.User<Preferences>>}
|
|
758
783
|
*/
|
|
759
|
-
updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>> {
|
|
784
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>> {
|
|
760
785
|
if (typeof name === 'undefined') {
|
|
761
786
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
762
787
|
}
|
|
@@ -778,6 +803,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
778
803
|
payload
|
|
779
804
|
);
|
|
780
805
|
}
|
|
806
|
+
|
|
781
807
|
/**
|
|
782
808
|
* Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
783
809
|
*
|
|
@@ -786,7 +812,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
786
812
|
* @throws {AppwriteException}
|
|
787
813
|
* @returns {Promise<Models.User<Preferences>>}
|
|
788
814
|
*/
|
|
789
|
-
updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>> {
|
|
815
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>> {
|
|
790
816
|
if (typeof password === 'undefined') {
|
|
791
817
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
792
818
|
}
|
|
@@ -811,6 +837,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
811
837
|
payload
|
|
812
838
|
);
|
|
813
839
|
}
|
|
840
|
+
|
|
814
841
|
/**
|
|
815
842
|
* List payment methods for this account.
|
|
816
843
|
*
|
|
@@ -836,6 +863,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
836
863
|
payload
|
|
837
864
|
);
|
|
838
865
|
}
|
|
866
|
+
|
|
839
867
|
/**
|
|
840
868
|
* Create a new payment method for the current user account.
|
|
841
869
|
*
|
|
@@ -858,6 +886,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
858
886
|
payload
|
|
859
887
|
);
|
|
860
888
|
}
|
|
889
|
+
|
|
861
890
|
/**
|
|
862
891
|
* Get a specific payment method for the user.
|
|
863
892
|
*
|
|
@@ -883,6 +912,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
883
912
|
payload
|
|
884
913
|
);
|
|
885
914
|
}
|
|
915
|
+
|
|
886
916
|
/**
|
|
887
917
|
* Update a new payment method for the current user account.
|
|
888
918
|
*
|
|
@@ -923,6 +953,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
923
953
|
payload
|
|
924
954
|
);
|
|
925
955
|
}
|
|
956
|
+
|
|
926
957
|
/**
|
|
927
958
|
* Delete a specific payment method from a user's account.
|
|
928
959
|
*
|
|
@@ -949,6 +980,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
949
980
|
payload
|
|
950
981
|
);
|
|
951
982
|
}
|
|
983
|
+
|
|
952
984
|
/**
|
|
953
985
|
* Update payment method provider.
|
|
954
986
|
*
|
|
@@ -989,6 +1021,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
989
1021
|
payload
|
|
990
1022
|
);
|
|
991
1023
|
}
|
|
1024
|
+
|
|
992
1025
|
/**
|
|
993
1026
|
* Update payment method mandate options.
|
|
994
1027
|
*
|
|
@@ -1015,6 +1048,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1015
1048
|
payload
|
|
1016
1049
|
);
|
|
1017
1050
|
}
|
|
1051
|
+
|
|
1018
1052
|
/**
|
|
1019
1053
|
* Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
|
1020
1054
|
*
|
|
@@ -1023,7 +1057,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1023
1057
|
* @throws {AppwriteException}
|
|
1024
1058
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1025
1059
|
*/
|
|
1026
|
-
updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>> {
|
|
1060
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>> {
|
|
1027
1061
|
if (typeof phone === 'undefined') {
|
|
1028
1062
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
1029
1063
|
}
|
|
@@ -1051,13 +1085,14 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1051
1085
|
payload
|
|
1052
1086
|
);
|
|
1053
1087
|
}
|
|
1088
|
+
|
|
1054
1089
|
/**
|
|
1055
1090
|
* Get the preferences as a key-value object for the currently logged in user.
|
|
1056
1091
|
*
|
|
1057
1092
|
* @throws {AppwriteException}
|
|
1058
1093
|
* @returns {Promise<Preferences>}
|
|
1059
1094
|
*/
|
|
1060
|
-
getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
|
|
1095
|
+
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences> {
|
|
1061
1096
|
const apiPath = '/account/prefs';
|
|
1062
1097
|
const payload: Payload = {};
|
|
1063
1098
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1072,6 +1107,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1072
1107
|
payload
|
|
1073
1108
|
);
|
|
1074
1109
|
}
|
|
1110
|
+
|
|
1075
1111
|
/**
|
|
1076
1112
|
* Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
|
|
1077
1113
|
*
|
|
@@ -1079,7 +1115,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1079
1115
|
* @throws {AppwriteException}
|
|
1080
1116
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1081
1117
|
*/
|
|
1082
|
-
updatePrefs<Preferences extends Models.Preferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>> {
|
|
1118
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>> {
|
|
1083
1119
|
if (typeof prefs === 'undefined') {
|
|
1084
1120
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
1085
1121
|
}
|
|
@@ -1101,6 +1137,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1101
1137
|
payload
|
|
1102
1138
|
);
|
|
1103
1139
|
}
|
|
1140
|
+
|
|
1104
1141
|
/**
|
|
1105
1142
|
* Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
|
|
1106
1143
|
*
|
|
@@ -1137,10 +1174,11 @@ This endpoint can also be used to convert an anonymous account to a normal one,
|
|
|
1137
1174
|
payload
|
|
1138
1175
|
);
|
|
1139
1176
|
}
|
|
1177
|
+
|
|
1140
1178
|
/**
|
|
1141
1179
|
* Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
|
|
1142
|
-
|
|
1143
|
-
Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
1180
|
+
*
|
|
1181
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
1144
1182
|
*
|
|
1145
1183
|
* @param {string} userId
|
|
1146
1184
|
* @param {string} secret
|
|
@@ -1182,6 +1220,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1182
1220
|
payload
|
|
1183
1221
|
);
|
|
1184
1222
|
}
|
|
1223
|
+
|
|
1185
1224
|
/**
|
|
1186
1225
|
* Get the list of active sessions across different devices for the currently logged in user.
|
|
1187
1226
|
*
|
|
@@ -1203,6 +1242,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1203
1242
|
payload
|
|
1204
1243
|
);
|
|
1205
1244
|
}
|
|
1245
|
+
|
|
1206
1246
|
/**
|
|
1207
1247
|
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
|
1208
1248
|
*
|
|
@@ -1225,6 +1265,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1225
1265
|
payload
|
|
1226
1266
|
);
|
|
1227
1267
|
}
|
|
1268
|
+
|
|
1228
1269
|
/**
|
|
1229
1270
|
* Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
1230
1271
|
*
|
|
@@ -1247,10 +1288,11 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1247
1288
|
payload
|
|
1248
1289
|
);
|
|
1249
1290
|
}
|
|
1291
|
+
|
|
1250
1292
|
/**
|
|
1251
1293
|
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
|
|
1252
|
-
|
|
1253
|
-
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1294
|
+
*
|
|
1295
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1254
1296
|
*
|
|
1255
1297
|
* @param {string} email
|
|
1256
1298
|
* @param {string} password
|
|
@@ -1285,6 +1327,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1285
1327
|
payload
|
|
1286
1328
|
);
|
|
1287
1329
|
}
|
|
1330
|
+
|
|
1288
1331
|
/**
|
|
1289
1332
|
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
1290
1333
|
*
|
|
@@ -1321,13 +1364,14 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1321
1364
|
payload
|
|
1322
1365
|
);
|
|
1323
1366
|
}
|
|
1367
|
+
|
|
1324
1368
|
/**
|
|
1325
1369
|
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
|
1326
|
-
|
|
1327
|
-
If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
|
|
1328
|
-
|
|
1329
|
-
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1330
|
-
|
|
1370
|
+
*
|
|
1371
|
+
* If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
|
|
1372
|
+
*
|
|
1373
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1374
|
+
*
|
|
1331
1375
|
*
|
|
1332
1376
|
* @param {OAuthProvider} provider
|
|
1333
1377
|
* @param {string} success
|
|
@@ -1369,6 +1413,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1369
1413
|
return uri.toString();
|
|
1370
1414
|
}
|
|
1371
1415
|
}
|
|
1416
|
+
|
|
1372
1417
|
/**
|
|
1373
1418
|
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
1374
1419
|
*
|
|
@@ -1405,6 +1450,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1405
1450
|
payload
|
|
1406
1451
|
);
|
|
1407
1452
|
}
|
|
1453
|
+
|
|
1408
1454
|
/**
|
|
1409
1455
|
* Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
|
|
1410
1456
|
*
|
|
@@ -1441,6 +1487,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1441
1487
|
payload
|
|
1442
1488
|
);
|
|
1443
1489
|
}
|
|
1490
|
+
|
|
1444
1491
|
/**
|
|
1445
1492
|
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
1446
1493
|
*
|
|
@@ -1466,6 +1513,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1466
1513
|
payload
|
|
1467
1514
|
);
|
|
1468
1515
|
}
|
|
1516
|
+
|
|
1469
1517
|
/**
|
|
1470
1518
|
* Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
|
|
1471
1519
|
*
|
|
@@ -1492,6 +1540,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1492
1540
|
payload
|
|
1493
1541
|
);
|
|
1494
1542
|
}
|
|
1543
|
+
|
|
1495
1544
|
/**
|
|
1496
1545
|
* Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
|
1497
1546
|
*
|
|
@@ -1518,13 +1567,14 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1518
1567
|
payload
|
|
1519
1568
|
);
|
|
1520
1569
|
}
|
|
1570
|
+
|
|
1521
1571
|
/**
|
|
1522
1572
|
* Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
|
|
1523
1573
|
*
|
|
1524
1574
|
* @throws {AppwriteException}
|
|
1525
1575
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1526
1576
|
*/
|
|
1527
|
-
updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
1577
|
+
updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
|
|
1528
1578
|
const apiPath = '/account/status';
|
|
1529
1579
|
const payload: Payload = {};
|
|
1530
1580
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
@@ -1540,6 +1590,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1540
1590
|
payload
|
|
1541
1591
|
);
|
|
1542
1592
|
}
|
|
1593
|
+
|
|
1543
1594
|
/**
|
|
1544
1595
|
* Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
|
|
1545
1596
|
*
|
|
@@ -1580,6 +1631,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1580
1631
|
payload
|
|
1581
1632
|
);
|
|
1582
1633
|
}
|
|
1634
|
+
|
|
1583
1635
|
/**
|
|
1584
1636
|
* Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
|
|
1585
1637
|
*
|
|
@@ -1613,6 +1665,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1613
1665
|
payload
|
|
1614
1666
|
);
|
|
1615
1667
|
}
|
|
1668
|
+
|
|
1616
1669
|
/**
|
|
1617
1670
|
* Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
|
|
1618
1671
|
*
|
|
@@ -1639,10 +1692,11 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1639
1692
|
payload
|
|
1640
1693
|
);
|
|
1641
1694
|
}
|
|
1695
|
+
|
|
1642
1696
|
/**
|
|
1643
1697
|
* Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
|
|
1644
|
-
|
|
1645
|
-
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1698
|
+
*
|
|
1699
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1646
1700
|
*
|
|
1647
1701
|
* @param {string} userId
|
|
1648
1702
|
* @param {string} email
|
|
@@ -1681,11 +1735,12 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1681
1735
|
payload
|
|
1682
1736
|
);
|
|
1683
1737
|
}
|
|
1738
|
+
|
|
1684
1739
|
/**
|
|
1685
1740
|
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
|
|
1686
|
-
|
|
1687
|
-
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1688
|
-
|
|
1741
|
+
*
|
|
1742
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1743
|
+
*
|
|
1689
1744
|
*
|
|
1690
1745
|
* @param {string} userId
|
|
1691
1746
|
* @param {string} email
|
|
@@ -1728,12 +1783,13 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1728
1783
|
payload
|
|
1729
1784
|
);
|
|
1730
1785
|
}
|
|
1786
|
+
|
|
1731
1787
|
/**
|
|
1732
1788
|
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
|
1733
|
-
|
|
1734
|
-
If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
|
|
1735
|
-
|
|
1736
|
-
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1789
|
+
*
|
|
1790
|
+
* If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
|
|
1791
|
+
*
|
|
1792
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1737
1793
|
*
|
|
1738
1794
|
* @param {OAuthProvider} provider
|
|
1739
1795
|
* @param {string} success
|
|
@@ -1775,10 +1831,11 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1775
1831
|
return uri.toString();
|
|
1776
1832
|
}
|
|
1777
1833
|
}
|
|
1834
|
+
|
|
1778
1835
|
/**
|
|
1779
1836
|
* Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
|
|
1780
|
-
|
|
1781
|
-
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1837
|
+
*
|
|
1838
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1782
1839
|
*
|
|
1783
1840
|
* @param {string} userId
|
|
1784
1841
|
* @param {string} phone
|
|
@@ -1813,11 +1870,12 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
1813
1870
|
payload
|
|
1814
1871
|
);
|
|
1815
1872
|
}
|
|
1873
|
+
|
|
1816
1874
|
/**
|
|
1817
1875
|
* Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
1818
|
-
|
|
1819
|
-
Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
1820
|
-
|
|
1876
|
+
*
|
|
1877
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
1878
|
+
*
|
|
1821
1879
|
*
|
|
1822
1880
|
* @param {string} url
|
|
1823
1881
|
* @throws {AppwriteException}
|
|
@@ -1845,6 +1903,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1845
1903
|
payload
|
|
1846
1904
|
);
|
|
1847
1905
|
}
|
|
1906
|
+
|
|
1848
1907
|
/**
|
|
1849
1908
|
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1850
1909
|
*
|
|
@@ -1881,6 +1940,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1881
1940
|
payload
|
|
1882
1941
|
);
|
|
1883
1942
|
}
|
|
1943
|
+
|
|
1884
1944
|
/**
|
|
1885
1945
|
* Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
|
|
1886
1946
|
*
|
|
@@ -1903,6 +1963,7 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/
|
|
|
1903
1963
|
payload
|
|
1904
1964
|
);
|
|
1905
1965
|
}
|
|
1966
|
+
|
|
1906
1967
|
/**
|
|
1907
1968
|
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1908
1969
|
*
|