node-appwrite 15.0.0 → 15.0.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/client.js +7 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +7 -4
- package/dist/client.mjs.map +1 -1
- package/dist/models.d.mts +2 -2
- package/dist/models.d.ts +2 -2
- package/dist/services/account.d.mts +0 -86
- package/dist/services/account.d.ts +0 -86
- package/dist/services/account.js +86 -172
- package/dist/services/account.js.map +1 -1
- package/dist/services/account.mjs +86 -172
- package/dist/services/account.mjs.map +1 -1
- package/dist/services/avatars.d.mts +0 -14
- package/dist/services/avatars.d.ts +0 -14
- package/dist/services/avatars.js +14 -28
- package/dist/services/avatars.js.map +1 -1
- package/dist/services/avatars.mjs +14 -28
- package/dist/services/avatars.mjs.map +1 -1
- package/dist/services/databases.d.mts +0 -84
- package/dist/services/databases.d.ts +0 -84
- package/dist/services/databases.js +84 -168
- package/dist/services/databases.js.map +1 -1
- package/dist/services/databases.mjs +84 -168
- package/dist/services/databases.mjs.map +1 -1
- package/dist/services/functions.d.mts +0 -48
- package/dist/services/functions.d.ts +0 -48
- package/dist/services/functions.js +48 -96
- package/dist/services/functions.js.map +1 -1
- package/dist/services/functions.mjs +48 -96
- package/dist/services/functions.mjs.map +1 -1
- package/dist/services/graphql.d.mts +0 -4
- package/dist/services/graphql.d.ts +0 -4
- package/dist/services/graphql.js +4 -8
- package/dist/services/graphql.js.map +1 -1
- package/dist/services/graphql.mjs +4 -8
- package/dist/services/graphql.mjs.map +1 -1
- package/dist/services/health.d.mts +0 -46
- package/dist/services/health.d.ts +0 -46
- package/dist/services/health.js +46 -92
- package/dist/services/health.js.map +1 -1
- package/dist/services/health.mjs +46 -92
- package/dist/services/health.mjs.map +1 -1
- package/dist/services/locale.d.mts +0 -16
- package/dist/services/locale.d.ts +0 -16
- package/dist/services/locale.js +16 -32
- package/dist/services/locale.js.map +1 -1
- package/dist/services/locale.mjs +16 -32
- package/dist/services/locale.mjs.map +1 -1
- package/dist/services/messaging.d.mts +3 -95
- package/dist/services/messaging.d.ts +3 -95
- package/dist/services/messaging.js +95 -187
- package/dist/services/messaging.js.map +1 -1
- package/dist/services/messaging.mjs +95 -187
- package/dist/services/messaging.mjs.map +1 -1
- package/dist/services/storage.d.mts +0 -26
- package/dist/services/storage.d.ts +0 -26
- package/dist/services/storage.js +26 -52
- package/dist/services/storage.js.map +1 -1
- package/dist/services/storage.mjs +26 -52
- package/dist/services/storage.mjs.map +1 -1
- package/dist/services/teams.d.mts +0 -26
- package/dist/services/teams.d.ts +0 -26
- package/dist/services/teams.js +26 -52
- package/dist/services/teams.js.map +1 -1
- package/dist/services/teams.mjs +26 -52
- package/dist/services/teams.mjs.map +1 -1
- package/dist/services/users.d.mts +0 -84
- package/dist/services/users.d.ts +0 -84
- package/dist/services/users.js +84 -168
- package/dist/services/users.js.map +1 -1
- package/dist/services/users.mjs +84 -168
- package/dist/services/users.mjs.map +1 -1
- package/package.json +1 -1
package/dist/services/account.js
CHANGED
|
@@ -7,21 +7,19 @@ class Account {
|
|
|
7
7
|
this.client = client;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Get account
|
|
11
|
-
*
|
|
12
10
|
* Get the currently logged in user.
|
|
13
11
|
*
|
|
14
12
|
* @throws {AppwriteException}
|
|
15
13
|
* @returns {Promise<Models.User<Preferences>>}
|
|
16
14
|
*/
|
|
17
|
-
|
|
15
|
+
get() {
|
|
18
16
|
const apiPath = "/account";
|
|
19
17
|
const payload = {};
|
|
20
18
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
21
19
|
const apiHeaders = {
|
|
22
20
|
"content-type": "application/json"
|
|
23
21
|
};
|
|
24
|
-
return
|
|
22
|
+
return this.client.call(
|
|
25
23
|
"get",
|
|
26
24
|
uri,
|
|
27
25
|
apiHeaders,
|
|
@@ -29,8 +27,6 @@ class Account {
|
|
|
29
27
|
);
|
|
30
28
|
}
|
|
31
29
|
/**
|
|
32
|
-
* Create account
|
|
33
|
-
*
|
|
34
30
|
* 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).
|
|
35
31
|
*
|
|
36
32
|
* @param {string} userId
|
|
@@ -40,7 +36,7 @@ class Account {
|
|
|
40
36
|
* @throws {AppwriteException}
|
|
41
37
|
* @returns {Promise<Models.User<Preferences>>}
|
|
42
38
|
*/
|
|
43
|
-
|
|
39
|
+
create(userId, email, password, name) {
|
|
44
40
|
if (typeof userId === "undefined") {
|
|
45
41
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
46
42
|
}
|
|
@@ -68,7 +64,7 @@ class Account {
|
|
|
68
64
|
const apiHeaders = {
|
|
69
65
|
"content-type": "application/json"
|
|
70
66
|
};
|
|
71
|
-
return
|
|
67
|
+
return this.client.call(
|
|
72
68
|
"post",
|
|
73
69
|
uri,
|
|
74
70
|
apiHeaders,
|
|
@@ -76,8 +72,6 @@ class Account {
|
|
|
76
72
|
);
|
|
77
73
|
}
|
|
78
74
|
/**
|
|
79
|
-
* Update email
|
|
80
|
-
*
|
|
81
75
|
* 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.
|
|
82
76
|
This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
83
77
|
|
|
@@ -87,7 +81,7 @@ class Account {
|
|
|
87
81
|
* @throws {AppwriteException}
|
|
88
82
|
* @returns {Promise<Models.User<Preferences>>}
|
|
89
83
|
*/
|
|
90
|
-
|
|
84
|
+
updateEmail(email, password) {
|
|
91
85
|
if (typeof email === "undefined") {
|
|
92
86
|
throw new client.AppwriteException('Missing required parameter: "email"');
|
|
93
87
|
}
|
|
@@ -106,7 +100,7 @@ class Account {
|
|
|
106
100
|
const apiHeaders = {
|
|
107
101
|
"content-type": "application/json"
|
|
108
102
|
};
|
|
109
|
-
return
|
|
103
|
+
return this.client.call(
|
|
110
104
|
"patch",
|
|
111
105
|
uri,
|
|
112
106
|
apiHeaders,
|
|
@@ -114,15 +108,13 @@ class Account {
|
|
|
114
108
|
);
|
|
115
109
|
}
|
|
116
110
|
/**
|
|
117
|
-
* List identities
|
|
118
|
-
*
|
|
119
111
|
* Get the list of identities for the currently logged in user.
|
|
120
112
|
*
|
|
121
113
|
* @param {string[]} queries
|
|
122
114
|
* @throws {AppwriteException}
|
|
123
115
|
* @returns {Promise<Models.IdentityList>}
|
|
124
116
|
*/
|
|
125
|
-
|
|
117
|
+
listIdentities(queries) {
|
|
126
118
|
const apiPath = "/account/identities";
|
|
127
119
|
const payload = {};
|
|
128
120
|
if (typeof queries !== "undefined") {
|
|
@@ -132,7 +124,7 @@ class Account {
|
|
|
132
124
|
const apiHeaders = {
|
|
133
125
|
"content-type": "application/json"
|
|
134
126
|
};
|
|
135
|
-
return
|
|
127
|
+
return this.client.call(
|
|
136
128
|
"get",
|
|
137
129
|
uri,
|
|
138
130
|
apiHeaders,
|
|
@@ -140,15 +132,13 @@ class Account {
|
|
|
140
132
|
);
|
|
141
133
|
}
|
|
142
134
|
/**
|
|
143
|
-
* Delete identity
|
|
144
|
-
*
|
|
145
135
|
* Delete an identity by its unique ID.
|
|
146
136
|
*
|
|
147
137
|
* @param {string} identityId
|
|
148
138
|
* @throws {AppwriteException}
|
|
149
139
|
* @returns {Promise<{}>}
|
|
150
140
|
*/
|
|
151
|
-
|
|
141
|
+
deleteIdentity(identityId) {
|
|
152
142
|
if (typeof identityId === "undefined") {
|
|
153
143
|
throw new client.AppwriteException('Missing required parameter: "identityId"');
|
|
154
144
|
}
|
|
@@ -158,7 +148,7 @@ class Account {
|
|
|
158
148
|
const apiHeaders = {
|
|
159
149
|
"content-type": "application/json"
|
|
160
150
|
};
|
|
161
|
-
return
|
|
151
|
+
return this.client.call(
|
|
162
152
|
"delete",
|
|
163
153
|
uri,
|
|
164
154
|
apiHeaders,
|
|
@@ -166,21 +156,19 @@ class Account {
|
|
|
166
156
|
);
|
|
167
157
|
}
|
|
168
158
|
/**
|
|
169
|
-
* Create JWT
|
|
170
|
-
*
|
|
171
159
|
* 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.
|
|
172
160
|
*
|
|
173
161
|
* @throws {AppwriteException}
|
|
174
162
|
* @returns {Promise<Models.Jwt>}
|
|
175
163
|
*/
|
|
176
|
-
|
|
164
|
+
createJWT() {
|
|
177
165
|
const apiPath = "/account/jwts";
|
|
178
166
|
const payload = {};
|
|
179
167
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
180
168
|
const apiHeaders = {
|
|
181
169
|
"content-type": "application/json"
|
|
182
170
|
};
|
|
183
|
-
return
|
|
171
|
+
return this.client.call(
|
|
184
172
|
"post",
|
|
185
173
|
uri,
|
|
186
174
|
apiHeaders,
|
|
@@ -188,15 +176,13 @@ class Account {
|
|
|
188
176
|
);
|
|
189
177
|
}
|
|
190
178
|
/**
|
|
191
|
-
* List logs
|
|
192
|
-
*
|
|
193
179
|
* 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.
|
|
194
180
|
*
|
|
195
181
|
* @param {string[]} queries
|
|
196
182
|
* @throws {AppwriteException}
|
|
197
183
|
* @returns {Promise<Models.LogList>}
|
|
198
184
|
*/
|
|
199
|
-
|
|
185
|
+
listLogs(queries) {
|
|
200
186
|
const apiPath = "/account/logs";
|
|
201
187
|
const payload = {};
|
|
202
188
|
if (typeof queries !== "undefined") {
|
|
@@ -206,7 +192,7 @@ class Account {
|
|
|
206
192
|
const apiHeaders = {
|
|
207
193
|
"content-type": "application/json"
|
|
208
194
|
};
|
|
209
|
-
return
|
|
195
|
+
return this.client.call(
|
|
210
196
|
"get",
|
|
211
197
|
uri,
|
|
212
198
|
apiHeaders,
|
|
@@ -214,15 +200,13 @@ class Account {
|
|
|
214
200
|
);
|
|
215
201
|
}
|
|
216
202
|
/**
|
|
217
|
-
* Update MFA
|
|
218
|
-
*
|
|
219
203
|
* Enable or disable MFA on an account.
|
|
220
204
|
*
|
|
221
205
|
* @param {boolean} mfa
|
|
222
206
|
* @throws {AppwriteException}
|
|
223
207
|
* @returns {Promise<Models.User<Preferences>>}
|
|
224
208
|
*/
|
|
225
|
-
|
|
209
|
+
updateMFA(mfa) {
|
|
226
210
|
if (typeof mfa === "undefined") {
|
|
227
211
|
throw new client.AppwriteException('Missing required parameter: "mfa"');
|
|
228
212
|
}
|
|
@@ -235,7 +219,7 @@ class Account {
|
|
|
235
219
|
const apiHeaders = {
|
|
236
220
|
"content-type": "application/json"
|
|
237
221
|
};
|
|
238
|
-
return
|
|
222
|
+
return this.client.call(
|
|
239
223
|
"patch",
|
|
240
224
|
uri,
|
|
241
225
|
apiHeaders,
|
|
@@ -243,15 +227,13 @@ class Account {
|
|
|
243
227
|
);
|
|
244
228
|
}
|
|
245
229
|
/**
|
|
246
|
-
* Create authenticator
|
|
247
|
-
*
|
|
248
230
|
* 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.
|
|
249
231
|
*
|
|
250
232
|
* @param {AuthenticatorType} type
|
|
251
233
|
* @throws {AppwriteException}
|
|
252
234
|
* @returns {Promise<Models.MfaType>}
|
|
253
235
|
*/
|
|
254
|
-
|
|
236
|
+
createMfaAuthenticator(type) {
|
|
255
237
|
if (typeof type === "undefined") {
|
|
256
238
|
throw new client.AppwriteException('Missing required parameter: "type"');
|
|
257
239
|
}
|
|
@@ -261,7 +243,7 @@ class Account {
|
|
|
261
243
|
const apiHeaders = {
|
|
262
244
|
"content-type": "application/json"
|
|
263
245
|
};
|
|
264
|
-
return
|
|
246
|
+
return this.client.call(
|
|
265
247
|
"post",
|
|
266
248
|
uri,
|
|
267
249
|
apiHeaders,
|
|
@@ -269,8 +251,6 @@ class Account {
|
|
|
269
251
|
);
|
|
270
252
|
}
|
|
271
253
|
/**
|
|
272
|
-
* Verify authenticator
|
|
273
|
-
*
|
|
274
254
|
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
275
255
|
*
|
|
276
256
|
* @param {AuthenticatorType} type
|
|
@@ -278,7 +258,7 @@ class Account {
|
|
|
278
258
|
* @throws {AppwriteException}
|
|
279
259
|
* @returns {Promise<Models.User<Preferences>>}
|
|
280
260
|
*/
|
|
281
|
-
|
|
261
|
+
updateMfaAuthenticator(type, otp) {
|
|
282
262
|
if (typeof type === "undefined") {
|
|
283
263
|
throw new client.AppwriteException('Missing required parameter: "type"');
|
|
284
264
|
}
|
|
@@ -294,7 +274,7 @@ class Account {
|
|
|
294
274
|
const apiHeaders = {
|
|
295
275
|
"content-type": "application/json"
|
|
296
276
|
};
|
|
297
|
-
return
|
|
277
|
+
return this.client.call(
|
|
298
278
|
"put",
|
|
299
279
|
uri,
|
|
300
280
|
apiHeaders,
|
|
@@ -302,15 +282,13 @@ class Account {
|
|
|
302
282
|
);
|
|
303
283
|
}
|
|
304
284
|
/**
|
|
305
|
-
* Delete authenticator
|
|
306
|
-
*
|
|
307
285
|
* Delete an authenticator for a user by ID.
|
|
308
286
|
*
|
|
309
287
|
* @param {AuthenticatorType} type
|
|
310
288
|
* @throws {AppwriteException}
|
|
311
289
|
* @returns {Promise<{}>}
|
|
312
290
|
*/
|
|
313
|
-
|
|
291
|
+
deleteMfaAuthenticator(type) {
|
|
314
292
|
if (typeof type === "undefined") {
|
|
315
293
|
throw new client.AppwriteException('Missing required parameter: "type"');
|
|
316
294
|
}
|
|
@@ -320,7 +298,7 @@ class Account {
|
|
|
320
298
|
const apiHeaders = {
|
|
321
299
|
"content-type": "application/json"
|
|
322
300
|
};
|
|
323
|
-
return
|
|
301
|
+
return this.client.call(
|
|
324
302
|
"delete",
|
|
325
303
|
uri,
|
|
326
304
|
apiHeaders,
|
|
@@ -328,15 +306,13 @@ class Account {
|
|
|
328
306
|
);
|
|
329
307
|
}
|
|
330
308
|
/**
|
|
331
|
-
* Create MFA challenge
|
|
332
|
-
*
|
|
333
309
|
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
334
310
|
*
|
|
335
311
|
* @param {AuthenticationFactor} factor
|
|
336
312
|
* @throws {AppwriteException}
|
|
337
313
|
* @returns {Promise<Models.MfaChallenge>}
|
|
338
314
|
*/
|
|
339
|
-
|
|
315
|
+
createMfaChallenge(factor) {
|
|
340
316
|
if (typeof factor === "undefined") {
|
|
341
317
|
throw new client.AppwriteException('Missing required parameter: "factor"');
|
|
342
318
|
}
|
|
@@ -349,7 +325,7 @@ class Account {
|
|
|
349
325
|
const apiHeaders = {
|
|
350
326
|
"content-type": "application/json"
|
|
351
327
|
};
|
|
352
|
-
return
|
|
328
|
+
return this.client.call(
|
|
353
329
|
"post",
|
|
354
330
|
uri,
|
|
355
331
|
apiHeaders,
|
|
@@ -357,8 +333,6 @@ class Account {
|
|
|
357
333
|
);
|
|
358
334
|
}
|
|
359
335
|
/**
|
|
360
|
-
* Create MFA challenge (confirmation)
|
|
361
|
-
*
|
|
362
336
|
* 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.
|
|
363
337
|
*
|
|
364
338
|
* @param {string} challengeId
|
|
@@ -366,7 +340,7 @@ class Account {
|
|
|
366
340
|
* @throws {AppwriteException}
|
|
367
341
|
* @returns {Promise<Models.Session>}
|
|
368
342
|
*/
|
|
369
|
-
|
|
343
|
+
updateMfaChallenge(challengeId, otp) {
|
|
370
344
|
if (typeof challengeId === "undefined") {
|
|
371
345
|
throw new client.AppwriteException('Missing required parameter: "challengeId"');
|
|
372
346
|
}
|
|
@@ -385,7 +359,7 @@ class Account {
|
|
|
385
359
|
const apiHeaders = {
|
|
386
360
|
"content-type": "application/json"
|
|
387
361
|
};
|
|
388
|
-
return
|
|
362
|
+
return this.client.call(
|
|
389
363
|
"put",
|
|
390
364
|
uri,
|
|
391
365
|
apiHeaders,
|
|
@@ -393,21 +367,19 @@ class Account {
|
|
|
393
367
|
);
|
|
394
368
|
}
|
|
395
369
|
/**
|
|
396
|
-
* List factors
|
|
397
|
-
*
|
|
398
370
|
* List the factors available on the account to be used as a MFA challange.
|
|
399
371
|
*
|
|
400
372
|
* @throws {AppwriteException}
|
|
401
373
|
* @returns {Promise<Models.MfaFactors>}
|
|
402
374
|
*/
|
|
403
|
-
|
|
375
|
+
listMfaFactors() {
|
|
404
376
|
const apiPath = "/account/mfa/factors";
|
|
405
377
|
const payload = {};
|
|
406
378
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
407
379
|
const apiHeaders = {
|
|
408
380
|
"content-type": "application/json"
|
|
409
381
|
};
|
|
410
|
-
return
|
|
382
|
+
return this.client.call(
|
|
411
383
|
"get",
|
|
412
384
|
uri,
|
|
413
385
|
apiHeaders,
|
|
@@ -415,21 +387,19 @@ class Account {
|
|
|
415
387
|
);
|
|
416
388
|
}
|
|
417
389
|
/**
|
|
418
|
-
* Get MFA recovery codes
|
|
419
|
-
*
|
|
420
390
|
* 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.
|
|
421
391
|
*
|
|
422
392
|
* @throws {AppwriteException}
|
|
423
393
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
424
394
|
*/
|
|
425
|
-
|
|
395
|
+
getMfaRecoveryCodes() {
|
|
426
396
|
const apiPath = "/account/mfa/recovery-codes";
|
|
427
397
|
const payload = {};
|
|
428
398
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
429
399
|
const apiHeaders = {
|
|
430
400
|
"content-type": "application/json"
|
|
431
401
|
};
|
|
432
|
-
return
|
|
402
|
+
return this.client.call(
|
|
433
403
|
"get",
|
|
434
404
|
uri,
|
|
435
405
|
apiHeaders,
|
|
@@ -437,21 +407,19 @@ class Account {
|
|
|
437
407
|
);
|
|
438
408
|
}
|
|
439
409
|
/**
|
|
440
|
-
* Create MFA recovery codes
|
|
441
|
-
*
|
|
442
410
|
* 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.
|
|
443
411
|
*
|
|
444
412
|
* @throws {AppwriteException}
|
|
445
413
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
446
414
|
*/
|
|
447
|
-
|
|
415
|
+
createMfaRecoveryCodes() {
|
|
448
416
|
const apiPath = "/account/mfa/recovery-codes";
|
|
449
417
|
const payload = {};
|
|
450
418
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
451
419
|
const apiHeaders = {
|
|
452
420
|
"content-type": "application/json"
|
|
453
421
|
};
|
|
454
|
-
return
|
|
422
|
+
return this.client.call(
|
|
455
423
|
"post",
|
|
456
424
|
uri,
|
|
457
425
|
apiHeaders,
|
|
@@ -459,21 +427,19 @@ class Account {
|
|
|
459
427
|
);
|
|
460
428
|
}
|
|
461
429
|
/**
|
|
462
|
-
* Regenerate MFA recovery codes
|
|
463
|
-
*
|
|
464
430
|
* 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.
|
|
465
431
|
*
|
|
466
432
|
* @throws {AppwriteException}
|
|
467
433
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
468
434
|
*/
|
|
469
|
-
|
|
435
|
+
updateMfaRecoveryCodes() {
|
|
470
436
|
const apiPath = "/account/mfa/recovery-codes";
|
|
471
437
|
const payload = {};
|
|
472
438
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
473
439
|
const apiHeaders = {
|
|
474
440
|
"content-type": "application/json"
|
|
475
441
|
};
|
|
476
|
-
return
|
|
442
|
+
return this.client.call(
|
|
477
443
|
"patch",
|
|
478
444
|
uri,
|
|
479
445
|
apiHeaders,
|
|
@@ -481,15 +447,13 @@ class Account {
|
|
|
481
447
|
);
|
|
482
448
|
}
|
|
483
449
|
/**
|
|
484
|
-
* Update name
|
|
485
|
-
*
|
|
486
450
|
* Update currently logged in user account name.
|
|
487
451
|
*
|
|
488
452
|
* @param {string} name
|
|
489
453
|
* @throws {AppwriteException}
|
|
490
454
|
* @returns {Promise<Models.User<Preferences>>}
|
|
491
455
|
*/
|
|
492
|
-
|
|
456
|
+
updateName(name) {
|
|
493
457
|
if (typeof name === "undefined") {
|
|
494
458
|
throw new client.AppwriteException('Missing required parameter: "name"');
|
|
495
459
|
}
|
|
@@ -502,7 +466,7 @@ class Account {
|
|
|
502
466
|
const apiHeaders = {
|
|
503
467
|
"content-type": "application/json"
|
|
504
468
|
};
|
|
505
|
-
return
|
|
469
|
+
return this.client.call(
|
|
506
470
|
"patch",
|
|
507
471
|
uri,
|
|
508
472
|
apiHeaders,
|
|
@@ -510,8 +474,6 @@ class Account {
|
|
|
510
474
|
);
|
|
511
475
|
}
|
|
512
476
|
/**
|
|
513
|
-
* Update password
|
|
514
|
-
*
|
|
515
477
|
* 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.
|
|
516
478
|
*
|
|
517
479
|
* @param {string} password
|
|
@@ -519,7 +481,7 @@ class Account {
|
|
|
519
481
|
* @throws {AppwriteException}
|
|
520
482
|
* @returns {Promise<Models.User<Preferences>>}
|
|
521
483
|
*/
|
|
522
|
-
|
|
484
|
+
updatePassword(password, oldPassword) {
|
|
523
485
|
if (typeof password === "undefined") {
|
|
524
486
|
throw new client.AppwriteException('Missing required parameter: "password"');
|
|
525
487
|
}
|
|
@@ -535,7 +497,7 @@ class Account {
|
|
|
535
497
|
const apiHeaders = {
|
|
536
498
|
"content-type": "application/json"
|
|
537
499
|
};
|
|
538
|
-
return
|
|
500
|
+
return this.client.call(
|
|
539
501
|
"patch",
|
|
540
502
|
uri,
|
|
541
503
|
apiHeaders,
|
|
@@ -543,8 +505,6 @@ class Account {
|
|
|
543
505
|
);
|
|
544
506
|
}
|
|
545
507
|
/**
|
|
546
|
-
* Update phone
|
|
547
|
-
*
|
|
548
508
|
* 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.
|
|
549
509
|
*
|
|
550
510
|
* @param {string} phone
|
|
@@ -552,7 +512,7 @@ class Account {
|
|
|
552
512
|
* @throws {AppwriteException}
|
|
553
513
|
* @returns {Promise<Models.User<Preferences>>}
|
|
554
514
|
*/
|
|
555
|
-
|
|
515
|
+
updatePhone(phone, password) {
|
|
556
516
|
if (typeof phone === "undefined") {
|
|
557
517
|
throw new client.AppwriteException('Missing required parameter: "phone"');
|
|
558
518
|
}
|
|
@@ -571,7 +531,7 @@ class Account {
|
|
|
571
531
|
const apiHeaders = {
|
|
572
532
|
"content-type": "application/json"
|
|
573
533
|
};
|
|
574
|
-
return
|
|
534
|
+
return this.client.call(
|
|
575
535
|
"patch",
|
|
576
536
|
uri,
|
|
577
537
|
apiHeaders,
|
|
@@ -579,21 +539,19 @@ class Account {
|
|
|
579
539
|
);
|
|
580
540
|
}
|
|
581
541
|
/**
|
|
582
|
-
* Get account preferences
|
|
583
|
-
*
|
|
584
542
|
* Get the preferences as a key-value object for the currently logged in user.
|
|
585
543
|
*
|
|
586
544
|
* @throws {AppwriteException}
|
|
587
545
|
* @returns {Promise<Preferences>}
|
|
588
546
|
*/
|
|
589
|
-
|
|
547
|
+
getPrefs() {
|
|
590
548
|
const apiPath = "/account/prefs";
|
|
591
549
|
const payload = {};
|
|
592
550
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
593
551
|
const apiHeaders = {
|
|
594
552
|
"content-type": "application/json"
|
|
595
553
|
};
|
|
596
|
-
return
|
|
554
|
+
return this.client.call(
|
|
597
555
|
"get",
|
|
598
556
|
uri,
|
|
599
557
|
apiHeaders,
|
|
@@ -601,15 +559,13 @@ class Account {
|
|
|
601
559
|
);
|
|
602
560
|
}
|
|
603
561
|
/**
|
|
604
|
-
* Update preferences
|
|
605
|
-
*
|
|
606
562
|
* 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.
|
|
607
563
|
*
|
|
608
564
|
* @param {Partial<Preferences>} prefs
|
|
609
565
|
* @throws {AppwriteException}
|
|
610
566
|
* @returns {Promise<Models.User<Preferences>>}
|
|
611
567
|
*/
|
|
612
|
-
|
|
568
|
+
updatePrefs(prefs) {
|
|
613
569
|
if (typeof prefs === "undefined") {
|
|
614
570
|
throw new client.AppwriteException('Missing required parameter: "prefs"');
|
|
615
571
|
}
|
|
@@ -622,7 +578,7 @@ class Account {
|
|
|
622
578
|
const apiHeaders = {
|
|
623
579
|
"content-type": "application/json"
|
|
624
580
|
};
|
|
625
|
-
return
|
|
581
|
+
return this.client.call(
|
|
626
582
|
"patch",
|
|
627
583
|
uri,
|
|
628
584
|
apiHeaders,
|
|
@@ -630,8 +586,6 @@ class Account {
|
|
|
630
586
|
);
|
|
631
587
|
}
|
|
632
588
|
/**
|
|
633
|
-
* Create password recovery
|
|
634
|
-
*
|
|
635
589
|
* 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.
|
|
636
590
|
*
|
|
637
591
|
* @param {string} email
|
|
@@ -639,7 +593,7 @@ class Account {
|
|
|
639
593
|
* @throws {AppwriteException}
|
|
640
594
|
* @returns {Promise<Models.Token>}
|
|
641
595
|
*/
|
|
642
|
-
|
|
596
|
+
createRecovery(email, url) {
|
|
643
597
|
if (typeof email === "undefined") {
|
|
644
598
|
throw new client.AppwriteException('Missing required parameter: "email"');
|
|
645
599
|
}
|
|
@@ -658,7 +612,7 @@ class Account {
|
|
|
658
612
|
const apiHeaders = {
|
|
659
613
|
"content-type": "application/json"
|
|
660
614
|
};
|
|
661
|
-
return
|
|
615
|
+
return this.client.call(
|
|
662
616
|
"post",
|
|
663
617
|
uri,
|
|
664
618
|
apiHeaders,
|
|
@@ -666,8 +620,6 @@ class Account {
|
|
|
666
620
|
);
|
|
667
621
|
}
|
|
668
622
|
/**
|
|
669
|
-
* Create password recovery (confirmation)
|
|
670
|
-
*
|
|
671
623
|
* 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.
|
|
672
624
|
|
|
673
625
|
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.
|
|
@@ -678,7 +630,7 @@ class Account {
|
|
|
678
630
|
* @throws {AppwriteException}
|
|
679
631
|
* @returns {Promise<Models.Token>}
|
|
680
632
|
*/
|
|
681
|
-
|
|
633
|
+
updateRecovery(userId, secret, password) {
|
|
682
634
|
if (typeof userId === "undefined") {
|
|
683
635
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
684
636
|
}
|
|
@@ -703,7 +655,7 @@ class Account {
|
|
|
703
655
|
const apiHeaders = {
|
|
704
656
|
"content-type": "application/json"
|
|
705
657
|
};
|
|
706
|
-
return
|
|
658
|
+
return this.client.call(
|
|
707
659
|
"put",
|
|
708
660
|
uri,
|
|
709
661
|
apiHeaders,
|
|
@@ -711,21 +663,19 @@ class Account {
|
|
|
711
663
|
);
|
|
712
664
|
}
|
|
713
665
|
/**
|
|
714
|
-
* List sessions
|
|
715
|
-
*
|
|
716
666
|
* Get the list of active sessions across different devices for the currently logged in user.
|
|
717
667
|
*
|
|
718
668
|
* @throws {AppwriteException}
|
|
719
669
|
* @returns {Promise<Models.SessionList>}
|
|
720
670
|
*/
|
|
721
|
-
|
|
671
|
+
listSessions() {
|
|
722
672
|
const apiPath = "/account/sessions";
|
|
723
673
|
const payload = {};
|
|
724
674
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
725
675
|
const apiHeaders = {
|
|
726
676
|
"content-type": "application/json"
|
|
727
677
|
};
|
|
728
|
-
return
|
|
678
|
+
return this.client.call(
|
|
729
679
|
"get",
|
|
730
680
|
uri,
|
|
731
681
|
apiHeaders,
|
|
@@ -733,21 +683,19 @@ class Account {
|
|
|
733
683
|
);
|
|
734
684
|
}
|
|
735
685
|
/**
|
|
736
|
-
* Delete sessions
|
|
737
|
-
*
|
|
738
686
|
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
|
739
687
|
*
|
|
740
688
|
* @throws {AppwriteException}
|
|
741
689
|
* @returns {Promise<{}>}
|
|
742
690
|
*/
|
|
743
|
-
|
|
691
|
+
deleteSessions() {
|
|
744
692
|
const apiPath = "/account/sessions";
|
|
745
693
|
const payload = {};
|
|
746
694
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
747
695
|
const apiHeaders = {
|
|
748
696
|
"content-type": "application/json"
|
|
749
697
|
};
|
|
750
|
-
return
|
|
698
|
+
return this.client.call(
|
|
751
699
|
"delete",
|
|
752
700
|
uri,
|
|
753
701
|
apiHeaders,
|
|
@@ -755,21 +703,19 @@ class Account {
|
|
|
755
703
|
);
|
|
756
704
|
}
|
|
757
705
|
/**
|
|
758
|
-
* Create anonymous session
|
|
759
|
-
*
|
|
760
706
|
* 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).
|
|
761
707
|
*
|
|
762
708
|
* @throws {AppwriteException}
|
|
763
709
|
* @returns {Promise<Models.Session>}
|
|
764
710
|
*/
|
|
765
|
-
|
|
711
|
+
createAnonymousSession() {
|
|
766
712
|
const apiPath = "/account/sessions/anonymous";
|
|
767
713
|
const payload = {};
|
|
768
714
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
769
715
|
const apiHeaders = {
|
|
770
716
|
"content-type": "application/json"
|
|
771
717
|
};
|
|
772
|
-
return
|
|
718
|
+
return this.client.call(
|
|
773
719
|
"post",
|
|
774
720
|
uri,
|
|
775
721
|
apiHeaders,
|
|
@@ -777,8 +723,6 @@ class Account {
|
|
|
777
723
|
);
|
|
778
724
|
}
|
|
779
725
|
/**
|
|
780
|
-
* Create email password session
|
|
781
|
-
*
|
|
782
726
|
* 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.
|
|
783
727
|
|
|
784
728
|
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).
|
|
@@ -788,7 +732,7 @@ class Account {
|
|
|
788
732
|
* @throws {AppwriteException}
|
|
789
733
|
* @returns {Promise<Models.Session>}
|
|
790
734
|
*/
|
|
791
|
-
|
|
735
|
+
createEmailPasswordSession(email, password) {
|
|
792
736
|
if (typeof email === "undefined") {
|
|
793
737
|
throw new client.AppwriteException('Missing required parameter: "email"');
|
|
794
738
|
}
|
|
@@ -807,7 +751,7 @@ class Account {
|
|
|
807
751
|
const apiHeaders = {
|
|
808
752
|
"content-type": "application/json"
|
|
809
753
|
};
|
|
810
|
-
return
|
|
754
|
+
return this.client.call(
|
|
811
755
|
"post",
|
|
812
756
|
uri,
|
|
813
757
|
apiHeaders,
|
|
@@ -815,8 +759,6 @@ class Account {
|
|
|
815
759
|
);
|
|
816
760
|
}
|
|
817
761
|
/**
|
|
818
|
-
* Update magic URL session
|
|
819
|
-
*
|
|
820
762
|
* 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.
|
|
821
763
|
*
|
|
822
764
|
* @param {string} userId
|
|
@@ -824,7 +766,7 @@ class Account {
|
|
|
824
766
|
* @throws {AppwriteException}
|
|
825
767
|
* @returns {Promise<Models.Session>}
|
|
826
768
|
*/
|
|
827
|
-
|
|
769
|
+
updateMagicURLSession(userId, secret) {
|
|
828
770
|
if (typeof userId === "undefined") {
|
|
829
771
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
830
772
|
}
|
|
@@ -843,7 +785,7 @@ class Account {
|
|
|
843
785
|
const apiHeaders = {
|
|
844
786
|
"content-type": "application/json"
|
|
845
787
|
};
|
|
846
|
-
return
|
|
788
|
+
return this.client.call(
|
|
847
789
|
"put",
|
|
848
790
|
uri,
|
|
849
791
|
apiHeaders,
|
|
@@ -851,8 +793,6 @@ class Account {
|
|
|
851
793
|
);
|
|
852
794
|
}
|
|
853
795
|
/**
|
|
854
|
-
* Update phone session
|
|
855
|
-
*
|
|
856
796
|
* 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.
|
|
857
797
|
*
|
|
858
798
|
* @param {string} userId
|
|
@@ -860,7 +800,7 @@ class Account {
|
|
|
860
800
|
* @throws {AppwriteException}
|
|
861
801
|
* @returns {Promise<Models.Session>}
|
|
862
802
|
*/
|
|
863
|
-
|
|
803
|
+
updatePhoneSession(userId, secret) {
|
|
864
804
|
if (typeof userId === "undefined") {
|
|
865
805
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
866
806
|
}
|
|
@@ -879,7 +819,7 @@ class Account {
|
|
|
879
819
|
const apiHeaders = {
|
|
880
820
|
"content-type": "application/json"
|
|
881
821
|
};
|
|
882
|
-
return
|
|
822
|
+
return this.client.call(
|
|
883
823
|
"put",
|
|
884
824
|
uri,
|
|
885
825
|
apiHeaders,
|
|
@@ -887,8 +827,6 @@ class Account {
|
|
|
887
827
|
);
|
|
888
828
|
}
|
|
889
829
|
/**
|
|
890
|
-
* Create session
|
|
891
|
-
*
|
|
892
830
|
* 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.
|
|
893
831
|
*
|
|
894
832
|
* @param {string} userId
|
|
@@ -896,7 +834,7 @@ class Account {
|
|
|
896
834
|
* @throws {AppwriteException}
|
|
897
835
|
* @returns {Promise<Models.Session>}
|
|
898
836
|
*/
|
|
899
|
-
|
|
837
|
+
createSession(userId, secret) {
|
|
900
838
|
if (typeof userId === "undefined") {
|
|
901
839
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
902
840
|
}
|
|
@@ -915,7 +853,7 @@ class Account {
|
|
|
915
853
|
const apiHeaders = {
|
|
916
854
|
"content-type": "application/json"
|
|
917
855
|
};
|
|
918
|
-
return
|
|
856
|
+
return this.client.call(
|
|
919
857
|
"post",
|
|
920
858
|
uri,
|
|
921
859
|
apiHeaders,
|
|
@@ -923,15 +861,13 @@ class Account {
|
|
|
923
861
|
);
|
|
924
862
|
}
|
|
925
863
|
/**
|
|
926
|
-
* Get session
|
|
927
|
-
*
|
|
928
864
|
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
929
865
|
*
|
|
930
866
|
* @param {string} sessionId
|
|
931
867
|
* @throws {AppwriteException}
|
|
932
868
|
* @returns {Promise<Models.Session>}
|
|
933
869
|
*/
|
|
934
|
-
|
|
870
|
+
getSession(sessionId) {
|
|
935
871
|
if (typeof sessionId === "undefined") {
|
|
936
872
|
throw new client.AppwriteException('Missing required parameter: "sessionId"');
|
|
937
873
|
}
|
|
@@ -941,7 +877,7 @@ class Account {
|
|
|
941
877
|
const apiHeaders = {
|
|
942
878
|
"content-type": "application/json"
|
|
943
879
|
};
|
|
944
|
-
return
|
|
880
|
+
return this.client.call(
|
|
945
881
|
"get",
|
|
946
882
|
uri,
|
|
947
883
|
apiHeaders,
|
|
@@ -949,15 +885,13 @@ class Account {
|
|
|
949
885
|
);
|
|
950
886
|
}
|
|
951
887
|
/**
|
|
952
|
-
* Update session
|
|
953
|
-
*
|
|
954
888
|
* 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.
|
|
955
889
|
*
|
|
956
890
|
* @param {string} sessionId
|
|
957
891
|
* @throws {AppwriteException}
|
|
958
892
|
* @returns {Promise<Models.Session>}
|
|
959
893
|
*/
|
|
960
|
-
|
|
894
|
+
updateSession(sessionId) {
|
|
961
895
|
if (typeof sessionId === "undefined") {
|
|
962
896
|
throw new client.AppwriteException('Missing required parameter: "sessionId"');
|
|
963
897
|
}
|
|
@@ -967,7 +901,7 @@ class Account {
|
|
|
967
901
|
const apiHeaders = {
|
|
968
902
|
"content-type": "application/json"
|
|
969
903
|
};
|
|
970
|
-
return
|
|
904
|
+
return this.client.call(
|
|
971
905
|
"patch",
|
|
972
906
|
uri,
|
|
973
907
|
apiHeaders,
|
|
@@ -975,15 +909,13 @@ class Account {
|
|
|
975
909
|
);
|
|
976
910
|
}
|
|
977
911
|
/**
|
|
978
|
-
* Delete session
|
|
979
|
-
*
|
|
980
912
|
* 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.
|
|
981
913
|
*
|
|
982
914
|
* @param {string} sessionId
|
|
983
915
|
* @throws {AppwriteException}
|
|
984
916
|
* @returns {Promise<{}>}
|
|
985
917
|
*/
|
|
986
|
-
|
|
918
|
+
deleteSession(sessionId) {
|
|
987
919
|
if (typeof sessionId === "undefined") {
|
|
988
920
|
throw new client.AppwriteException('Missing required parameter: "sessionId"');
|
|
989
921
|
}
|
|
@@ -993,7 +925,7 @@ class Account {
|
|
|
993
925
|
const apiHeaders = {
|
|
994
926
|
"content-type": "application/json"
|
|
995
927
|
};
|
|
996
|
-
return
|
|
928
|
+
return this.client.call(
|
|
997
929
|
"delete",
|
|
998
930
|
uri,
|
|
999
931
|
apiHeaders,
|
|
@@ -1001,21 +933,19 @@ class Account {
|
|
|
1001
933
|
);
|
|
1002
934
|
}
|
|
1003
935
|
/**
|
|
1004
|
-
* Update status
|
|
1005
|
-
*
|
|
1006
936
|
* 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.
|
|
1007
937
|
*
|
|
1008
938
|
* @throws {AppwriteException}
|
|
1009
939
|
* @returns {Promise<Models.User<Preferences>>}
|
|
1010
940
|
*/
|
|
1011
|
-
|
|
941
|
+
updateStatus() {
|
|
1012
942
|
const apiPath = "/account/status";
|
|
1013
943
|
const payload = {};
|
|
1014
944
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1015
945
|
const apiHeaders = {
|
|
1016
946
|
"content-type": "application/json"
|
|
1017
947
|
};
|
|
1018
|
-
return
|
|
948
|
+
return this.client.call(
|
|
1019
949
|
"patch",
|
|
1020
950
|
uri,
|
|
1021
951
|
apiHeaders,
|
|
@@ -1023,8 +953,6 @@ class Account {
|
|
|
1023
953
|
);
|
|
1024
954
|
}
|
|
1025
955
|
/**
|
|
1026
|
-
* Create email token (OTP)
|
|
1027
|
-
*
|
|
1028
956
|
* 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.
|
|
1029
957
|
|
|
1030
958
|
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).
|
|
@@ -1035,7 +963,7 @@ class Account {
|
|
|
1035
963
|
* @throws {AppwriteException}
|
|
1036
964
|
* @returns {Promise<Models.Token>}
|
|
1037
965
|
*/
|
|
1038
|
-
|
|
966
|
+
createEmailToken(userId, email, phrase) {
|
|
1039
967
|
if (typeof userId === "undefined") {
|
|
1040
968
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
1041
969
|
}
|
|
@@ -1057,7 +985,7 @@ class Account {
|
|
|
1057
985
|
const apiHeaders = {
|
|
1058
986
|
"content-type": "application/json"
|
|
1059
987
|
};
|
|
1060
|
-
return
|
|
988
|
+
return this.client.call(
|
|
1061
989
|
"post",
|
|
1062
990
|
uri,
|
|
1063
991
|
apiHeaders,
|
|
@@ -1065,8 +993,6 @@ class Account {
|
|
|
1065
993
|
);
|
|
1066
994
|
}
|
|
1067
995
|
/**
|
|
1068
|
-
* Create magic URL token
|
|
1069
|
-
*
|
|
1070
996
|
* 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.
|
|
1071
997
|
|
|
1072
998
|
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).
|
|
@@ -1079,7 +1005,7 @@ class Account {
|
|
|
1079
1005
|
* @throws {AppwriteException}
|
|
1080
1006
|
* @returns {Promise<Models.Token>}
|
|
1081
1007
|
*/
|
|
1082
|
-
|
|
1008
|
+
createMagicURLToken(userId, email, url, phrase) {
|
|
1083
1009
|
if (typeof userId === "undefined") {
|
|
1084
1010
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
1085
1011
|
}
|
|
@@ -1104,7 +1030,7 @@ class Account {
|
|
|
1104
1030
|
const apiHeaders = {
|
|
1105
1031
|
"content-type": "application/json"
|
|
1106
1032
|
};
|
|
1107
|
-
return
|
|
1033
|
+
return this.client.call(
|
|
1108
1034
|
"post",
|
|
1109
1035
|
uri,
|
|
1110
1036
|
apiHeaders,
|
|
@@ -1112,8 +1038,6 @@ class Account {
|
|
|
1112
1038
|
);
|
|
1113
1039
|
}
|
|
1114
1040
|
/**
|
|
1115
|
-
* Create OAuth2 token
|
|
1116
|
-
*
|
|
1117
1041
|
* 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.
|
|
1118
1042
|
|
|
1119
1043
|
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.
|
|
@@ -1127,7 +1051,7 @@ class Account {
|
|
|
1127
1051
|
* @throws {AppwriteException}
|
|
1128
1052
|
* @returns {Promise<string>}
|
|
1129
1053
|
*/
|
|
1130
|
-
|
|
1054
|
+
createOAuth2Token(provider, success, failure, scopes) {
|
|
1131
1055
|
if (typeof provider === "undefined") {
|
|
1132
1056
|
throw new client.AppwriteException('Missing required parameter: "provider"');
|
|
1133
1057
|
}
|
|
@@ -1146,7 +1070,7 @@ class Account {
|
|
|
1146
1070
|
const apiHeaders = {
|
|
1147
1071
|
"content-type": "application/json"
|
|
1148
1072
|
};
|
|
1149
|
-
return
|
|
1073
|
+
return this.client.redirect(
|
|
1150
1074
|
"get",
|
|
1151
1075
|
uri,
|
|
1152
1076
|
apiHeaders,
|
|
@@ -1154,8 +1078,6 @@ class Account {
|
|
|
1154
1078
|
);
|
|
1155
1079
|
}
|
|
1156
1080
|
/**
|
|
1157
|
-
* Create phone token
|
|
1158
|
-
*
|
|
1159
1081
|
* 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.
|
|
1160
1082
|
|
|
1161
1083
|
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).
|
|
@@ -1165,7 +1087,7 @@ class Account {
|
|
|
1165
1087
|
* @throws {AppwriteException}
|
|
1166
1088
|
* @returns {Promise<Models.Token>}
|
|
1167
1089
|
*/
|
|
1168
|
-
|
|
1090
|
+
createPhoneToken(userId, phone) {
|
|
1169
1091
|
if (typeof userId === "undefined") {
|
|
1170
1092
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
1171
1093
|
}
|
|
@@ -1184,7 +1106,7 @@ class Account {
|
|
|
1184
1106
|
const apiHeaders = {
|
|
1185
1107
|
"content-type": "application/json"
|
|
1186
1108
|
};
|
|
1187
|
-
return
|
|
1109
|
+
return this.client.call(
|
|
1188
1110
|
"post",
|
|
1189
1111
|
uri,
|
|
1190
1112
|
apiHeaders,
|
|
@@ -1192,8 +1114,6 @@ class Account {
|
|
|
1192
1114
|
);
|
|
1193
1115
|
}
|
|
1194
1116
|
/**
|
|
1195
|
-
* Create email verification
|
|
1196
|
-
*
|
|
1197
1117
|
* 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.
|
|
1198
1118
|
|
|
1199
1119
|
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.
|
|
@@ -1203,7 +1123,7 @@ class Account {
|
|
|
1203
1123
|
* @throws {AppwriteException}
|
|
1204
1124
|
* @returns {Promise<Models.Token>}
|
|
1205
1125
|
*/
|
|
1206
|
-
|
|
1126
|
+
createVerification(url) {
|
|
1207
1127
|
if (typeof url === "undefined") {
|
|
1208
1128
|
throw new client.AppwriteException('Missing required parameter: "url"');
|
|
1209
1129
|
}
|
|
@@ -1216,7 +1136,7 @@ class Account {
|
|
|
1216
1136
|
const apiHeaders = {
|
|
1217
1137
|
"content-type": "application/json"
|
|
1218
1138
|
};
|
|
1219
|
-
return
|
|
1139
|
+
return this.client.call(
|
|
1220
1140
|
"post",
|
|
1221
1141
|
uri,
|
|
1222
1142
|
apiHeaders,
|
|
@@ -1224,8 +1144,6 @@ class Account {
|
|
|
1224
1144
|
);
|
|
1225
1145
|
}
|
|
1226
1146
|
/**
|
|
1227
|
-
* Create email verification (confirmation)
|
|
1228
|
-
*
|
|
1229
1147
|
* 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.
|
|
1230
1148
|
*
|
|
1231
1149
|
* @param {string} userId
|
|
@@ -1233,7 +1151,7 @@ class Account {
|
|
|
1233
1151
|
* @throws {AppwriteException}
|
|
1234
1152
|
* @returns {Promise<Models.Token>}
|
|
1235
1153
|
*/
|
|
1236
|
-
|
|
1154
|
+
updateVerification(userId, secret) {
|
|
1237
1155
|
if (typeof userId === "undefined") {
|
|
1238
1156
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
1239
1157
|
}
|
|
@@ -1252,7 +1170,7 @@ class Account {
|
|
|
1252
1170
|
const apiHeaders = {
|
|
1253
1171
|
"content-type": "application/json"
|
|
1254
1172
|
};
|
|
1255
|
-
return
|
|
1173
|
+
return this.client.call(
|
|
1256
1174
|
"put",
|
|
1257
1175
|
uri,
|
|
1258
1176
|
apiHeaders,
|
|
@@ -1260,21 +1178,19 @@ class Account {
|
|
|
1260
1178
|
);
|
|
1261
1179
|
}
|
|
1262
1180
|
/**
|
|
1263
|
-
* Create phone verification
|
|
1264
|
-
*
|
|
1265
1181
|
* 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.
|
|
1266
1182
|
*
|
|
1267
1183
|
* @throws {AppwriteException}
|
|
1268
1184
|
* @returns {Promise<Models.Token>}
|
|
1269
1185
|
*/
|
|
1270
|
-
|
|
1186
|
+
createPhoneVerification() {
|
|
1271
1187
|
const apiPath = "/account/verification/phone";
|
|
1272
1188
|
const payload = {};
|
|
1273
1189
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1274
1190
|
const apiHeaders = {
|
|
1275
1191
|
"content-type": "application/json"
|
|
1276
1192
|
};
|
|
1277
|
-
return
|
|
1193
|
+
return this.client.call(
|
|
1278
1194
|
"post",
|
|
1279
1195
|
uri,
|
|
1280
1196
|
apiHeaders,
|
|
@@ -1282,8 +1198,6 @@ class Account {
|
|
|
1282
1198
|
);
|
|
1283
1199
|
}
|
|
1284
1200
|
/**
|
|
1285
|
-
* Update phone verification (confirmation)
|
|
1286
|
-
*
|
|
1287
1201
|
* 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.
|
|
1288
1202
|
*
|
|
1289
1203
|
* @param {string} userId
|
|
@@ -1291,7 +1205,7 @@ class Account {
|
|
|
1291
1205
|
* @throws {AppwriteException}
|
|
1292
1206
|
* @returns {Promise<Models.Token>}
|
|
1293
1207
|
*/
|
|
1294
|
-
|
|
1208
|
+
updatePhoneVerification(userId, secret) {
|
|
1295
1209
|
if (typeof userId === "undefined") {
|
|
1296
1210
|
throw new client.AppwriteException('Missing required parameter: "userId"');
|
|
1297
1211
|
}
|
|
@@ -1310,7 +1224,7 @@ class Account {
|
|
|
1310
1224
|
const apiHeaders = {
|
|
1311
1225
|
"content-type": "application/json"
|
|
1312
1226
|
};
|
|
1313
|
-
return
|
|
1227
|
+
return this.client.call(
|
|
1314
1228
|
"put",
|
|
1315
1229
|
uri,
|
|
1316
1230
|
apiHeaders,
|