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