@appwrite.io/console 0.3.0 → 0.4.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/.github/workflows/publish.yml +2 -2
- package/README.md +3 -3
- package/dist/cjs/sdk.js +1354 -1197
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1354 -1197
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +1354 -1197
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/{projects/get-usage.md → health/get-queue-builds.md} +3 -3
- package/docs/examples/{account/create-with-invite-code.md → health/get-queue-databases.md} +3 -3
- package/docs/examples/health/get-queue-deletes.md +18 -0
- package/docs/examples/health/get-queue-mails.md +18 -0
- package/docs/examples/health/get-queue-messaging.md +18 -0
- package/docs/examples/health/get-queue-migrations.md +18 -0
- package/docs/examples/project/get-usage.md +1 -1
- package/docs/examples/teams/create-membership.md +1 -1
- package/package.json +3 -2
- package/src/client.ts +1 -1
- package/src/models.ts +147 -279
- package/src/query.ts +1 -1
- package/src/role.ts +72 -6
- package/src/services/account.ts +154 -204
- package/src/services/assistant.ts +3 -3
- package/src/services/avatars.ts +32 -31
- package/src/services/console.ts +4 -4
- package/src/services/databases.ts +195 -195
- package/src/services/functions.ts +117 -126
- package/src/services/graphql.ts +8 -8
- package/src/services/health.ts +219 -50
- package/src/services/locale.ts +31 -31
- package/src/services/migrations.ts +48 -48
- package/src/services/project.ts +40 -22
- package/src/services/projects.ts +143 -170
- package/src/services/proxy.ts +15 -15
- package/src/services/storage.ts +74 -84
- package/src/services/teams.ts +62 -66
- package/src/services/users.ts +132 -135
- package/src/services/vcs.ts +27 -27
- package/types/models.d.ts +147 -279
- package/types/role.d.ts +62 -0
- package/types/services/account.d.ts +61 -70
- package/types/services/avatars.d.ts +11 -10
- package/types/services/console.d.ts +1 -1
- package/types/services/databases.d.ts +51 -51
- package/types/services/functions.d.ts +32 -27
- package/types/services/graphql.d.ts +2 -2
- package/types/services/health.d.ts +85 -14
- package/types/services/locale.d.ts +7 -7
- package/types/services/project.d.ts +4 -2
- package/types/services/projects.d.ts +26 -36
- package/types/services/storage.d.ts +13 -13
- package/types/services/teams.d.ts +20 -20
- package/types/services/users.d.ts +45 -44
package/src/services/account.ts
CHANGED
|
@@ -11,7 +11,7 @@ export class Account extends Service {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Get
|
|
14
|
+
* Get account
|
|
15
15
|
*
|
|
16
16
|
* Get the currently logged in user.
|
|
17
17
|
*
|
|
@@ -19,24 +19,25 @@ export class Account extends Service {
|
|
|
19
19
|
* @returns {Promise}
|
|
20
20
|
*/
|
|
21
21
|
async get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const apiPath = '/account';
|
|
23
|
+
const payload: Payload = {};
|
|
24
24
|
|
|
25
|
-
const uri = new URL(this.client.config.endpoint +
|
|
25
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
26
26
|
return await this.client.call('get', uri, {
|
|
27
27
|
'content-type': 'application/json',
|
|
28
28
|
}, payload);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Create
|
|
32
|
+
* Create account
|
|
33
33
|
*
|
|
34
34
|
* Use this endpoint to allow a new user to register a new account in your
|
|
35
35
|
* project. After the user registration completes successfully, you can use
|
|
36
|
-
* the
|
|
36
|
+
* the
|
|
37
|
+
* [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
|
|
37
38
|
* route to start verifying the user email address. To allow the new user to
|
|
38
39
|
* login to their new account, you need to create a new [account
|
|
39
|
-
* session](/docs/client/account#
|
|
40
|
+
* session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
40
41
|
*
|
|
41
42
|
* @param {string} userId
|
|
42
43
|
* @param {string} email
|
|
@@ -58,8 +59,8 @@ export class Account extends Service {
|
|
|
58
59
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
const apiPath = '/account';
|
|
63
|
+
const payload: Payload = {};
|
|
63
64
|
|
|
64
65
|
if (typeof userId !== 'undefined') {
|
|
65
66
|
payload['userId'] = userId;
|
|
@@ -77,14 +78,14 @@ export class Account extends Service {
|
|
|
77
78
|
payload['name'] = name;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
const uri = new URL(this.client.config.endpoint +
|
|
81
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
81
82
|
return await this.client.call('post', uri, {
|
|
82
83
|
'content-type': 'application/json',
|
|
83
84
|
}, payload);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
|
-
* Update
|
|
88
|
+
* Update email
|
|
88
89
|
*
|
|
89
90
|
* Update currently logged in user account email address. After changing user
|
|
90
91
|
* address, the user confirmation status will get reset. A new confirmation
|
|
@@ -109,8 +110,8 @@ export class Account extends Service {
|
|
|
109
110
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
const apiPath = '/account/email';
|
|
114
|
+
const payload: Payload = {};
|
|
114
115
|
|
|
115
116
|
if (typeof email !== 'undefined') {
|
|
116
117
|
payload['email'] = email;
|
|
@@ -120,7 +121,7 @@ export class Account extends Service {
|
|
|
120
121
|
payload['password'] = password;
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
const uri = new URL(this.client.config.endpoint +
|
|
124
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
124
125
|
return await this.client.call('patch', uri, {
|
|
125
126
|
'content-type': 'application/json',
|
|
126
127
|
}, payload);
|
|
@@ -136,14 +137,14 @@ export class Account extends Service {
|
|
|
136
137
|
* @returns {Promise}
|
|
137
138
|
*/
|
|
138
139
|
async listIdentities(queries?: string): Promise<Models.IdentityList> {
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
const apiPath = '/account/identities';
|
|
141
|
+
const payload: Payload = {};
|
|
141
142
|
|
|
142
143
|
if (typeof queries !== 'undefined') {
|
|
143
144
|
payload['queries'] = queries;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
const uri = new URL(this.client.config.endpoint +
|
|
147
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
147
148
|
return await this.client.call('get', uri, {
|
|
148
149
|
'content-type': 'application/json',
|
|
149
150
|
}, payload);
|
|
@@ -163,75 +164,15 @@ export class Account extends Service {
|
|
|
163
164
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
|
|
167
|
-
|
|
167
|
+
const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
|
|
168
|
+
const payload: Payload = {};
|
|
168
169
|
|
|
169
|
-
const uri = new URL(this.client.config.endpoint +
|
|
170
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
170
171
|
return await this.client.call('delete', uri, {
|
|
171
172
|
'content-type': 'application/json',
|
|
172
173
|
}, payload);
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
/**
|
|
176
|
-
* Create account using an invite code
|
|
177
|
-
*
|
|
178
|
-
* Use this endpoint to allow a new user to register a new account in your
|
|
179
|
-
* project. After the user registration completes successfully, you can use
|
|
180
|
-
* the [/account/verfication](/docs/client/account#accountCreateVerification)
|
|
181
|
-
* route to start verifying the user email address. To allow the new user to
|
|
182
|
-
* login to their new account, you need to create a new [account
|
|
183
|
-
* session](/docs/client/account#accountCreateSession).
|
|
184
|
-
*
|
|
185
|
-
* @param {string} userId
|
|
186
|
-
* @param {string} email
|
|
187
|
-
* @param {string} password
|
|
188
|
-
* @param {string} name
|
|
189
|
-
* @param {string} code
|
|
190
|
-
* @throws {AppwriteException}
|
|
191
|
-
* @returns {Promise}
|
|
192
|
-
*/
|
|
193
|
-
async createWithInviteCode<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string, code?: string): Promise<Models.Account<Preferences>> {
|
|
194
|
-
if (typeof userId === 'undefined') {
|
|
195
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (typeof email === 'undefined') {
|
|
199
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (typeof password === 'undefined') {
|
|
203
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
let path = '/account/invite';
|
|
207
|
-
let payload: Payload = {};
|
|
208
|
-
|
|
209
|
-
if (typeof userId !== 'undefined') {
|
|
210
|
-
payload['userId'] = userId;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (typeof email !== 'undefined') {
|
|
214
|
-
payload['email'] = email;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (typeof password !== 'undefined') {
|
|
218
|
-
payload['password'] = password;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (typeof name !== 'undefined') {
|
|
222
|
-
payload['name'] = name;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (typeof code !== 'undefined') {
|
|
226
|
-
payload['code'] = code;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
230
|
-
return await this.client.call('post', uri, {
|
|
231
|
-
'content-type': 'application/json',
|
|
232
|
-
}, payload);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
176
|
/**
|
|
236
177
|
* Create JWT
|
|
237
178
|
*
|
|
@@ -245,17 +186,17 @@ export class Account extends Service {
|
|
|
245
186
|
* @returns {Promise}
|
|
246
187
|
*/
|
|
247
188
|
async createJWT(): Promise<Models.Jwt> {
|
|
248
|
-
|
|
249
|
-
|
|
189
|
+
const apiPath = '/account/jwt';
|
|
190
|
+
const payload: Payload = {};
|
|
250
191
|
|
|
251
|
-
const uri = new URL(this.client.config.endpoint +
|
|
192
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
252
193
|
return await this.client.call('post', uri, {
|
|
253
194
|
'content-type': 'application/json',
|
|
254
195
|
}, payload);
|
|
255
196
|
}
|
|
256
197
|
|
|
257
198
|
/**
|
|
258
|
-
* List
|
|
199
|
+
* List logs
|
|
259
200
|
*
|
|
260
201
|
* Get the list of latest security activity logs for the currently logged in
|
|
261
202
|
* user. Each log returns user IP address, location and date and time of log.
|
|
@@ -265,21 +206,21 @@ export class Account extends Service {
|
|
|
265
206
|
* @returns {Promise}
|
|
266
207
|
*/
|
|
267
208
|
async listLogs(queries?: string[]): Promise<Models.LogList> {
|
|
268
|
-
|
|
269
|
-
|
|
209
|
+
const apiPath = '/account/logs';
|
|
210
|
+
const payload: Payload = {};
|
|
270
211
|
|
|
271
212
|
if (typeof queries !== 'undefined') {
|
|
272
213
|
payload['queries'] = queries;
|
|
273
214
|
}
|
|
274
215
|
|
|
275
|
-
const uri = new URL(this.client.config.endpoint +
|
|
216
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
276
217
|
return await this.client.call('get', uri, {
|
|
277
218
|
'content-type': 'application/json',
|
|
278
219
|
}, payload);
|
|
279
220
|
}
|
|
280
221
|
|
|
281
222
|
/**
|
|
282
|
-
* Update
|
|
223
|
+
* Update name
|
|
283
224
|
*
|
|
284
225
|
* Update currently logged in user account name.
|
|
285
226
|
*
|
|
@@ -292,21 +233,21 @@ export class Account extends Service {
|
|
|
292
233
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
293
234
|
}
|
|
294
235
|
|
|
295
|
-
|
|
296
|
-
|
|
236
|
+
const apiPath = '/account/name';
|
|
237
|
+
const payload: Payload = {};
|
|
297
238
|
|
|
298
239
|
if (typeof name !== 'undefined') {
|
|
299
240
|
payload['name'] = name;
|
|
300
241
|
}
|
|
301
242
|
|
|
302
|
-
const uri = new URL(this.client.config.endpoint +
|
|
243
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
303
244
|
return await this.client.call('patch', uri, {
|
|
304
245
|
'content-type': 'application/json',
|
|
305
246
|
}, payload);
|
|
306
247
|
}
|
|
307
248
|
|
|
308
249
|
/**
|
|
309
|
-
* Update
|
|
250
|
+
* Update password
|
|
310
251
|
*
|
|
311
252
|
* Update currently logged in user password. For validation, user is required
|
|
312
253
|
* to pass in the new password, and the old password. For users created with
|
|
@@ -322,8 +263,8 @@ export class Account extends Service {
|
|
|
322
263
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
323
264
|
}
|
|
324
265
|
|
|
325
|
-
|
|
326
|
-
|
|
266
|
+
const apiPath = '/account/password';
|
|
267
|
+
const payload: Payload = {};
|
|
327
268
|
|
|
328
269
|
if (typeof password !== 'undefined') {
|
|
329
270
|
payload['password'] = password;
|
|
@@ -333,19 +274,19 @@ export class Account extends Service {
|
|
|
333
274
|
payload['oldPassword'] = oldPassword;
|
|
334
275
|
}
|
|
335
276
|
|
|
336
|
-
const uri = new URL(this.client.config.endpoint +
|
|
277
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
337
278
|
return await this.client.call('patch', uri, {
|
|
338
279
|
'content-type': 'application/json',
|
|
339
280
|
}, payload);
|
|
340
281
|
}
|
|
341
282
|
|
|
342
283
|
/**
|
|
343
|
-
* Update
|
|
284
|
+
* Update phone
|
|
344
285
|
*
|
|
345
286
|
* Update the currently logged in user's phone number. After updating the
|
|
346
287
|
* phone number, the phone verification status will be reset. A confirmation
|
|
347
288
|
* SMS is not sent automatically, however you can use the [POST
|
|
348
|
-
* /account/verification/phone](/docs/client/account#
|
|
289
|
+
* /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
|
|
349
290
|
* endpoint to send a confirmation SMS.
|
|
350
291
|
*
|
|
351
292
|
* @param {string} phone
|
|
@@ -362,8 +303,8 @@ export class Account extends Service {
|
|
|
362
303
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
363
304
|
}
|
|
364
305
|
|
|
365
|
-
|
|
366
|
-
|
|
306
|
+
const apiPath = '/account/phone';
|
|
307
|
+
const payload: Payload = {};
|
|
367
308
|
|
|
368
309
|
if (typeof phone !== 'undefined') {
|
|
369
310
|
payload['phone'] = phone;
|
|
@@ -373,14 +314,14 @@ export class Account extends Service {
|
|
|
373
314
|
payload['password'] = password;
|
|
374
315
|
}
|
|
375
316
|
|
|
376
|
-
const uri = new URL(this.client.config.endpoint +
|
|
317
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
377
318
|
return await this.client.call('patch', uri, {
|
|
378
319
|
'content-type': 'application/json',
|
|
379
320
|
}, payload);
|
|
380
321
|
}
|
|
381
322
|
|
|
382
323
|
/**
|
|
383
|
-
* Get
|
|
324
|
+
* Get account preferences
|
|
384
325
|
*
|
|
385
326
|
* Get the preferences as a key-value object for the currently logged in user.
|
|
386
327
|
*
|
|
@@ -388,17 +329,17 @@ export class Account extends Service {
|
|
|
388
329
|
* @returns {Promise}
|
|
389
330
|
*/
|
|
390
331
|
async getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
|
|
391
|
-
|
|
392
|
-
|
|
332
|
+
const apiPath = '/account/prefs';
|
|
333
|
+
const payload: Payload = {};
|
|
393
334
|
|
|
394
|
-
const uri = new URL(this.client.config.endpoint +
|
|
335
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
395
336
|
return await this.client.call('get', uri, {
|
|
396
337
|
'content-type': 'application/json',
|
|
397
338
|
}, payload);
|
|
398
339
|
}
|
|
399
340
|
|
|
400
341
|
/**
|
|
401
|
-
* Update
|
|
342
|
+
* Update preferences
|
|
402
343
|
*
|
|
403
344
|
* Update currently logged in user account preferences. The object you pass is
|
|
404
345
|
* stored as is, and replaces any previous value. The maximum allowed prefs
|
|
@@ -413,30 +354,30 @@ export class Account extends Service {
|
|
|
413
354
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
414
355
|
}
|
|
415
356
|
|
|
416
|
-
|
|
417
|
-
|
|
357
|
+
const apiPath = '/account/prefs';
|
|
358
|
+
const payload: Payload = {};
|
|
418
359
|
|
|
419
360
|
if (typeof prefs !== 'undefined') {
|
|
420
361
|
payload['prefs'] = prefs;
|
|
421
362
|
}
|
|
422
363
|
|
|
423
|
-
const uri = new URL(this.client.config.endpoint +
|
|
364
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
424
365
|
return await this.client.call('patch', uri, {
|
|
425
366
|
'content-type': 'application/json',
|
|
426
367
|
}, payload);
|
|
427
368
|
}
|
|
428
369
|
|
|
429
370
|
/**
|
|
430
|
-
* Create
|
|
371
|
+
* Create password recovery
|
|
431
372
|
*
|
|
432
373
|
* Sends the user an email with a temporary secret key for password reset.
|
|
433
374
|
* When the user clicks the confirmation link he is redirected back to your
|
|
434
375
|
* app password reset URL with the secret key and email address values
|
|
435
376
|
* attached to the URL query string. Use the query string params to submit a
|
|
436
377
|
* request to the [PUT
|
|
437
|
-
* /account/recovery](/docs/client/account#
|
|
438
|
-
* complete the process. The verification link sent to the user's
|
|
439
|
-
* address is valid for 1 hour.
|
|
378
|
+
* /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
|
|
379
|
+
* endpoint to complete the process. The verification link sent to the user's
|
|
380
|
+
* email address is valid for 1 hour.
|
|
440
381
|
*
|
|
441
382
|
* @param {string} email
|
|
442
383
|
* @param {string} url
|
|
@@ -452,8 +393,8 @@ export class Account extends Service {
|
|
|
452
393
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
453
394
|
}
|
|
454
395
|
|
|
455
|
-
|
|
456
|
-
|
|
396
|
+
const apiPath = '/account/recovery';
|
|
397
|
+
const payload: Payload = {};
|
|
457
398
|
|
|
458
399
|
if (typeof email !== 'undefined') {
|
|
459
400
|
payload['email'] = email;
|
|
@@ -463,19 +404,20 @@ export class Account extends Service {
|
|
|
463
404
|
payload['url'] = url;
|
|
464
405
|
}
|
|
465
406
|
|
|
466
|
-
const uri = new URL(this.client.config.endpoint +
|
|
407
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
467
408
|
return await this.client.call('post', uri, {
|
|
468
409
|
'content-type': 'application/json',
|
|
469
410
|
}, payload);
|
|
470
411
|
}
|
|
471
412
|
|
|
472
413
|
/**
|
|
473
|
-
* Create
|
|
414
|
+
* Create password recovery (confirmation)
|
|
474
415
|
*
|
|
475
416
|
* Use this endpoint to complete the user account password reset. Both the
|
|
476
417
|
* **userId** and **secret** arguments will be passed as query parameters to
|
|
477
418
|
* the redirect URL you have provided when sending your request to the [POST
|
|
478
|
-
* /account/recovery](/docs/client/account#
|
|
419
|
+
* /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
|
|
420
|
+
* endpoint.
|
|
479
421
|
*
|
|
480
422
|
* Please note that in order to avoid a [Redirect
|
|
481
423
|
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
|
@@ -506,8 +448,8 @@ export class Account extends Service {
|
|
|
506
448
|
throw new AppwriteException('Missing required parameter: "passwordAgain"');
|
|
507
449
|
}
|
|
508
450
|
|
|
509
|
-
|
|
510
|
-
|
|
451
|
+
const apiPath = '/account/recovery';
|
|
452
|
+
const payload: Payload = {};
|
|
511
453
|
|
|
512
454
|
if (typeof userId !== 'undefined') {
|
|
513
455
|
payload['userId'] = userId;
|
|
@@ -525,14 +467,14 @@ export class Account extends Service {
|
|
|
525
467
|
payload['passwordAgain'] = passwordAgain;
|
|
526
468
|
}
|
|
527
469
|
|
|
528
|
-
const uri = new URL(this.client.config.endpoint +
|
|
470
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
529
471
|
return await this.client.call('put', uri, {
|
|
530
472
|
'content-type': 'application/json',
|
|
531
473
|
}, payload);
|
|
532
474
|
}
|
|
533
475
|
|
|
534
476
|
/**
|
|
535
|
-
* List
|
|
477
|
+
* List sessions
|
|
536
478
|
*
|
|
537
479
|
* Get the list of active sessions across different devices for the currently
|
|
538
480
|
* logged in user.
|
|
@@ -541,17 +483,17 @@ export class Account extends Service {
|
|
|
541
483
|
* @returns {Promise}
|
|
542
484
|
*/
|
|
543
485
|
async listSessions(): Promise<Models.SessionList> {
|
|
544
|
-
|
|
545
|
-
|
|
486
|
+
const apiPath = '/account/sessions';
|
|
487
|
+
const payload: Payload = {};
|
|
546
488
|
|
|
547
|
-
const uri = new URL(this.client.config.endpoint +
|
|
489
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
548
490
|
return await this.client.call('get', uri, {
|
|
549
491
|
'content-type': 'application/json',
|
|
550
492
|
}, payload);
|
|
551
493
|
}
|
|
552
494
|
|
|
553
495
|
/**
|
|
554
|
-
* Delete
|
|
496
|
+
* Delete sessions
|
|
555
497
|
*
|
|
556
498
|
* Delete all sessions from the user account and remove any sessions cookies
|
|
557
499
|
* from the end client.
|
|
@@ -560,46 +502,48 @@ export class Account extends Service {
|
|
|
560
502
|
* @returns {Promise}
|
|
561
503
|
*/
|
|
562
504
|
async deleteSessions(): Promise<{}> {
|
|
563
|
-
|
|
564
|
-
|
|
505
|
+
const apiPath = '/account/sessions';
|
|
506
|
+
const payload: Payload = {};
|
|
565
507
|
|
|
566
|
-
const uri = new URL(this.client.config.endpoint +
|
|
508
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
567
509
|
return await this.client.call('delete', uri, {
|
|
568
510
|
'content-type': 'application/json',
|
|
569
511
|
}, payload);
|
|
570
512
|
}
|
|
571
513
|
|
|
572
514
|
/**
|
|
573
|
-
* Create
|
|
515
|
+
* Create anonymous session
|
|
574
516
|
*
|
|
575
517
|
* Use this endpoint to allow a new user to register an anonymous account in
|
|
576
518
|
* your project. This route will also create a new session for the user. To
|
|
577
519
|
* allow the new user to convert an anonymous account to a normal account, you
|
|
578
520
|
* need to update its [email and
|
|
579
|
-
* password](/docs/client/account#
|
|
580
|
-
*
|
|
521
|
+
* password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
|
|
522
|
+
* or create an [OAuth2
|
|
523
|
+
* session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
581
524
|
*
|
|
582
525
|
* @throws {AppwriteException}
|
|
583
526
|
* @returns {Promise}
|
|
584
527
|
*/
|
|
585
528
|
async createAnonymousSession(): Promise<Models.Session> {
|
|
586
|
-
|
|
587
|
-
|
|
529
|
+
const apiPath = '/account/sessions/anonymous';
|
|
530
|
+
const payload: Payload = {};
|
|
588
531
|
|
|
589
|
-
const uri = new URL(this.client.config.endpoint +
|
|
532
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
590
533
|
return await this.client.call('post', uri, {
|
|
591
534
|
'content-type': 'application/json',
|
|
592
535
|
}, payload);
|
|
593
536
|
}
|
|
594
537
|
|
|
595
538
|
/**
|
|
596
|
-
* Create
|
|
539
|
+
* Create email session
|
|
597
540
|
*
|
|
598
541
|
* Allow the user to login into their account by providing a valid email and
|
|
599
542
|
* password combination. This route will create a new session for the user.
|
|
600
543
|
*
|
|
601
544
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
602
|
-
* about session
|
|
545
|
+
* about session
|
|
546
|
+
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
603
547
|
*
|
|
604
548
|
* @param {string} email
|
|
605
549
|
* @param {string} password
|
|
@@ -615,8 +559,8 @@ export class Account extends Service {
|
|
|
615
559
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
616
560
|
}
|
|
617
561
|
|
|
618
|
-
|
|
619
|
-
|
|
562
|
+
const apiPath = '/account/sessions/email';
|
|
563
|
+
const payload: Payload = {};
|
|
620
564
|
|
|
621
565
|
if (typeof email !== 'undefined') {
|
|
622
566
|
payload['email'] = email;
|
|
@@ -626,14 +570,14 @@ export class Account extends Service {
|
|
|
626
570
|
payload['password'] = password;
|
|
627
571
|
}
|
|
628
572
|
|
|
629
|
-
const uri = new URL(this.client.config.endpoint +
|
|
573
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
630
574
|
return await this.client.call('post', uri, {
|
|
631
575
|
'content-type': 'application/json',
|
|
632
576
|
}, payload);
|
|
633
577
|
}
|
|
634
578
|
|
|
635
579
|
/**
|
|
636
|
-
* Create
|
|
580
|
+
* Create magic URL session
|
|
637
581
|
*
|
|
638
582
|
* Sends the user an email with a secret key for creating a session. If the
|
|
639
583
|
* provided user ID has not been registered, a new user will be created. When
|
|
@@ -641,14 +585,15 @@ export class Account extends Service {
|
|
|
641
585
|
* URL you provided with the secret key and userId values attached to the URL
|
|
642
586
|
* query string. Use the query string parameters to submit a request to the
|
|
643
587
|
* [PUT
|
|
644
|
-
* /account/sessions/magic-url](/docs/client/account#
|
|
588
|
+
* /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#updateMagicURLSession)
|
|
645
589
|
* endpoint to complete the login process. The link sent to the user's email
|
|
646
590
|
* address is valid for 1 hour. If you are on a mobile device you can leave
|
|
647
591
|
* the URL parameter empty, so that the login completion will be handled by
|
|
648
592
|
* your Appwrite instance by default.
|
|
649
593
|
*
|
|
650
594
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
651
|
-
* about session
|
|
595
|
+
* about session
|
|
596
|
+
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
652
597
|
*
|
|
653
598
|
*
|
|
654
599
|
* @param {string} userId
|
|
@@ -666,8 +611,8 @@ export class Account extends Service {
|
|
|
666
611
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
667
612
|
}
|
|
668
613
|
|
|
669
|
-
|
|
670
|
-
|
|
614
|
+
const apiPath = '/account/sessions/magic-url';
|
|
615
|
+
const payload: Payload = {};
|
|
671
616
|
|
|
672
617
|
if (typeof userId !== 'undefined') {
|
|
673
618
|
payload['userId'] = userId;
|
|
@@ -681,20 +626,20 @@ export class Account extends Service {
|
|
|
681
626
|
payload['url'] = url;
|
|
682
627
|
}
|
|
683
628
|
|
|
684
|
-
const uri = new URL(this.client.config.endpoint +
|
|
629
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
685
630
|
return await this.client.call('post', uri, {
|
|
686
631
|
'content-type': 'application/json',
|
|
687
632
|
}, payload);
|
|
688
633
|
}
|
|
689
634
|
|
|
690
635
|
/**
|
|
691
|
-
* Create
|
|
636
|
+
* Create magic URL session (confirmation)
|
|
692
637
|
*
|
|
693
638
|
* Use this endpoint to complete creating the session with the Magic URL. Both
|
|
694
639
|
* the **userId** and **secret** arguments will be passed as query parameters
|
|
695
640
|
* to the redirect URL you have provided when sending your request to the
|
|
696
641
|
* [POST
|
|
697
|
-
* /account/sessions/magic-url](/docs/client/account#
|
|
642
|
+
* /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#createMagicURLSession)
|
|
698
643
|
* endpoint.
|
|
699
644
|
*
|
|
700
645
|
* Please note that in order to avoid a [Redirect
|
|
@@ -716,8 +661,8 @@ export class Account extends Service {
|
|
|
716
661
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
717
662
|
}
|
|
718
663
|
|
|
719
|
-
|
|
720
|
-
|
|
664
|
+
const apiPath = '/account/sessions/magic-url';
|
|
665
|
+
const payload: Payload = {};
|
|
721
666
|
|
|
722
667
|
if (typeof userId !== 'undefined') {
|
|
723
668
|
payload['userId'] = userId;
|
|
@@ -727,14 +672,14 @@ export class Account extends Service {
|
|
|
727
672
|
payload['secret'] = secret;
|
|
728
673
|
}
|
|
729
674
|
|
|
730
|
-
const uri = new URL(this.client.config.endpoint +
|
|
675
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
731
676
|
return await this.client.call('put', uri, {
|
|
732
677
|
'content-type': 'application/json',
|
|
733
678
|
}, payload);
|
|
734
679
|
}
|
|
735
680
|
|
|
736
681
|
/**
|
|
737
|
-
* Create OAuth2
|
|
682
|
+
* Create OAuth2 session
|
|
738
683
|
*
|
|
739
684
|
* Allow the user to login to their account using the OAuth2 provider of their
|
|
740
685
|
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
@@ -749,7 +694,8 @@ export class Account extends Service {
|
|
|
749
694
|
* user.
|
|
750
695
|
*
|
|
751
696
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
752
|
-
* about session
|
|
697
|
+
* about session
|
|
698
|
+
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
753
699
|
*
|
|
754
700
|
*
|
|
755
701
|
* @param {string} provider
|
|
@@ -764,8 +710,8 @@ export class Account extends Service {
|
|
|
764
710
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
765
711
|
}
|
|
766
712
|
|
|
767
|
-
|
|
768
|
-
|
|
713
|
+
const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
|
|
714
|
+
const payload: Payload = {};
|
|
769
715
|
|
|
770
716
|
if (typeof success !== 'undefined') {
|
|
771
717
|
payload['success'] = success;
|
|
@@ -779,7 +725,7 @@ export class Account extends Service {
|
|
|
779
725
|
payload['scopes'] = scopes;
|
|
780
726
|
}
|
|
781
727
|
|
|
782
|
-
const uri = new URL(this.client.config.endpoint +
|
|
728
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
783
729
|
payload['project'] = this.client.config.project;
|
|
784
730
|
|
|
785
731
|
|
|
@@ -794,17 +740,18 @@ export class Account extends Service {
|
|
|
794
740
|
}
|
|
795
741
|
|
|
796
742
|
/**
|
|
797
|
-
* Create
|
|
743
|
+
* Create phone session
|
|
798
744
|
*
|
|
799
745
|
* Sends the user an SMS with a secret key for creating a session. If the
|
|
800
746
|
* provided user ID has not be registered, a new user will be created. Use the
|
|
801
747
|
* returned user ID and secret and submit a request to the [PUT
|
|
802
|
-
* /account/sessions/phone](/docs/client/account#
|
|
748
|
+
* /account/sessions/phone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneSession)
|
|
803
749
|
* endpoint to complete the login process. The secret sent to the user's phone
|
|
804
750
|
* is valid for 15 minutes.
|
|
805
751
|
*
|
|
806
752
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
807
|
-
* about session
|
|
753
|
+
* about session
|
|
754
|
+
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
808
755
|
*
|
|
809
756
|
* @param {string} userId
|
|
810
757
|
* @param {string} phone
|
|
@@ -820,8 +767,8 @@ export class Account extends Service {
|
|
|
820
767
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
821
768
|
}
|
|
822
769
|
|
|
823
|
-
|
|
824
|
-
|
|
770
|
+
const apiPath = '/account/sessions/phone';
|
|
771
|
+
const payload: Payload = {};
|
|
825
772
|
|
|
826
773
|
if (typeof userId !== 'undefined') {
|
|
827
774
|
payload['userId'] = userId;
|
|
@@ -831,18 +778,18 @@ export class Account extends Service {
|
|
|
831
778
|
payload['phone'] = phone;
|
|
832
779
|
}
|
|
833
780
|
|
|
834
|
-
const uri = new URL(this.client.config.endpoint +
|
|
781
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
835
782
|
return await this.client.call('post', uri, {
|
|
836
783
|
'content-type': 'application/json',
|
|
837
784
|
}, payload);
|
|
838
785
|
}
|
|
839
786
|
|
|
840
787
|
/**
|
|
841
|
-
* Create
|
|
788
|
+
* Create phone session (confirmation)
|
|
842
789
|
*
|
|
843
790
|
* Use this endpoint to complete creating a session with SMS. Use the
|
|
844
791
|
* **userId** from the
|
|
845
|
-
* [createPhoneSession](/docs/client/account#
|
|
792
|
+
* [createPhoneSession](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneSession)
|
|
846
793
|
* endpoint and the **secret** received via SMS to successfully update and
|
|
847
794
|
* confirm the phone session.
|
|
848
795
|
*
|
|
@@ -860,8 +807,8 @@ export class Account extends Service {
|
|
|
860
807
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
861
808
|
}
|
|
862
809
|
|
|
863
|
-
|
|
864
|
-
|
|
810
|
+
const apiPath = '/account/sessions/phone';
|
|
811
|
+
const payload: Payload = {};
|
|
865
812
|
|
|
866
813
|
if (typeof userId !== 'undefined') {
|
|
867
814
|
payload['userId'] = userId;
|
|
@@ -871,14 +818,14 @@ export class Account extends Service {
|
|
|
871
818
|
payload['secret'] = secret;
|
|
872
819
|
}
|
|
873
820
|
|
|
874
|
-
const uri = new URL(this.client.config.endpoint +
|
|
821
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
875
822
|
return await this.client.call('put', uri, {
|
|
876
823
|
'content-type': 'application/json',
|
|
877
824
|
}, payload);
|
|
878
825
|
}
|
|
879
826
|
|
|
880
827
|
/**
|
|
881
|
-
* Get
|
|
828
|
+
* Get session
|
|
882
829
|
*
|
|
883
830
|
* Use this endpoint to get a logged in user's session using a Session ID.
|
|
884
831
|
* Inputting 'current' will return the current session being used.
|
|
@@ -892,17 +839,17 @@ export class Account extends Service {
|
|
|
892
839
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
893
840
|
}
|
|
894
841
|
|
|
895
|
-
|
|
896
|
-
|
|
842
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
843
|
+
const payload: Payload = {};
|
|
897
844
|
|
|
898
|
-
const uri = new URL(this.client.config.endpoint +
|
|
845
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
899
846
|
return await this.client.call('get', uri, {
|
|
900
847
|
'content-type': 'application/json',
|
|
901
848
|
}, payload);
|
|
902
849
|
}
|
|
903
850
|
|
|
904
851
|
/**
|
|
905
|
-
* Update OAuth
|
|
852
|
+
* Update OAuth session (refresh tokens)
|
|
906
853
|
*
|
|
907
854
|
* Access tokens have limited lifespan and expire to mitigate security risks.
|
|
908
855
|
* If session was created using an OAuth provider, this route can be used to
|
|
@@ -917,22 +864,23 @@ export class Account extends Service {
|
|
|
917
864
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
918
865
|
}
|
|
919
866
|
|
|
920
|
-
|
|
921
|
-
|
|
867
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
868
|
+
const payload: Payload = {};
|
|
922
869
|
|
|
923
|
-
const uri = new URL(this.client.config.endpoint +
|
|
870
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
924
871
|
return await this.client.call('patch', uri, {
|
|
925
872
|
'content-type': 'application/json',
|
|
926
873
|
}, payload);
|
|
927
874
|
}
|
|
928
875
|
|
|
929
876
|
/**
|
|
930
|
-
* Delete
|
|
877
|
+
* Delete session
|
|
931
878
|
*
|
|
932
879
|
* Logout the user. Use 'current' as the session ID to logout on this device,
|
|
933
880
|
* use a session ID to logout on another device. If you're looking to logout
|
|
934
881
|
* the user on all devices, use [Delete
|
|
935
|
-
* Sessions](/docs/client/account#
|
|
882
|
+
* Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
|
|
883
|
+
* instead.
|
|
936
884
|
*
|
|
937
885
|
* @param {string} sessionId
|
|
938
886
|
* @throws {AppwriteException}
|
|
@@ -943,17 +891,17 @@ export class Account extends Service {
|
|
|
943
891
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
944
892
|
}
|
|
945
893
|
|
|
946
|
-
|
|
947
|
-
|
|
894
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
895
|
+
const payload: Payload = {};
|
|
948
896
|
|
|
949
|
-
const uri = new URL(this.client.config.endpoint +
|
|
897
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
950
898
|
return await this.client.call('delete', uri, {
|
|
951
899
|
'content-type': 'application/json',
|
|
952
900
|
}, payload);
|
|
953
901
|
}
|
|
954
902
|
|
|
955
903
|
/**
|
|
956
|
-
* Update
|
|
904
|
+
* Update status
|
|
957
905
|
*
|
|
958
906
|
* Block the currently logged in user account. Behind the scene, the user
|
|
959
907
|
* record is not deleted but permanently blocked from any access. To
|
|
@@ -963,17 +911,17 @@ export class Account extends Service {
|
|
|
963
911
|
* @returns {Promise}
|
|
964
912
|
*/
|
|
965
913
|
async updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
966
|
-
|
|
967
|
-
|
|
914
|
+
const apiPath = '/account/status';
|
|
915
|
+
const payload: Payload = {};
|
|
968
916
|
|
|
969
|
-
const uri = new URL(this.client.config.endpoint +
|
|
917
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
970
918
|
return await this.client.call('patch', uri, {
|
|
971
919
|
'content-type': 'application/json',
|
|
972
920
|
}, payload);
|
|
973
921
|
}
|
|
974
922
|
|
|
975
923
|
/**
|
|
976
|
-
* Create
|
|
924
|
+
* Create email verification
|
|
977
925
|
*
|
|
978
926
|
* Use this endpoint to send a verification message to your user email address
|
|
979
927
|
* to confirm they are the valid owners of that address. Both the **userId**
|
|
@@ -982,8 +930,8 @@ export class Account extends Service {
|
|
|
982
930
|
* should redirect the user back to your app and allow you to complete the
|
|
983
931
|
* verification process by verifying both the **userId** and **secret**
|
|
984
932
|
* parameters. Learn more about how to [complete the verification
|
|
985
|
-
* process](/docs/client/account#
|
|
986
|
-
* verification link sent to the user's email address is valid for 7 days.
|
|
933
|
+
* process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
|
|
934
|
+
* The verification link sent to the user's email address is valid for 7 days.
|
|
987
935
|
*
|
|
988
936
|
* Please note that in order to avoid a [Redirect
|
|
989
937
|
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
|
|
@@ -1000,21 +948,21 @@ export class Account extends Service {
|
|
|
1000
948
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1001
949
|
}
|
|
1002
950
|
|
|
1003
|
-
|
|
1004
|
-
|
|
951
|
+
const apiPath = '/account/verification';
|
|
952
|
+
const payload: Payload = {};
|
|
1005
953
|
|
|
1006
954
|
if (typeof url !== 'undefined') {
|
|
1007
955
|
payload['url'] = url;
|
|
1008
956
|
}
|
|
1009
957
|
|
|
1010
|
-
const uri = new URL(this.client.config.endpoint +
|
|
958
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1011
959
|
return await this.client.call('post', uri, {
|
|
1012
960
|
'content-type': 'application/json',
|
|
1013
961
|
}, payload);
|
|
1014
962
|
}
|
|
1015
963
|
|
|
1016
964
|
/**
|
|
1017
|
-
* Create
|
|
965
|
+
* Create email verification (confirmation)
|
|
1018
966
|
*
|
|
1019
967
|
* Use this endpoint to complete the user email verification process. Use both
|
|
1020
968
|
* the **userId** and **secret** parameters that were attached to your app URL
|
|
@@ -1035,8 +983,8 @@ export class Account extends Service {
|
|
|
1035
983
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1036
984
|
}
|
|
1037
985
|
|
|
1038
|
-
|
|
1039
|
-
|
|
986
|
+
const apiPath = '/account/verification';
|
|
987
|
+
const payload: Payload = {};
|
|
1040
988
|
|
|
1041
989
|
if (typeof userId !== 'undefined') {
|
|
1042
990
|
payload['userId'] = userId;
|
|
@@ -1046,37 +994,39 @@ export class Account extends Service {
|
|
|
1046
994
|
payload['secret'] = secret;
|
|
1047
995
|
}
|
|
1048
996
|
|
|
1049
|
-
const uri = new URL(this.client.config.endpoint +
|
|
997
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1050
998
|
return await this.client.call('put', uri, {
|
|
1051
999
|
'content-type': 'application/json',
|
|
1052
1000
|
}, payload);
|
|
1053
1001
|
}
|
|
1054
1002
|
|
|
1055
1003
|
/**
|
|
1056
|
-
* Create
|
|
1004
|
+
* Create phone verification
|
|
1057
1005
|
*
|
|
1058
1006
|
* Use this endpoint to send a verification SMS to the currently logged in
|
|
1059
1007
|
* user. This endpoint is meant for use after updating a user's phone number
|
|
1060
|
-
* using the
|
|
1008
|
+
* using the
|
|
1009
|
+
* [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
|
|
1061
1010
|
* endpoint. Learn more about how to [complete the verification
|
|
1062
|
-
* process](/docs/client/account#
|
|
1063
|
-
* verification code sent to the user's phone number is valid for 15
|
|
1011
|
+
* process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
|
|
1012
|
+
* The verification code sent to the user's phone number is valid for 15
|
|
1013
|
+
* minutes.
|
|
1064
1014
|
*
|
|
1065
1015
|
* @throws {AppwriteException}
|
|
1066
1016
|
* @returns {Promise}
|
|
1067
1017
|
*/
|
|
1068
1018
|
async createPhoneVerification(): Promise<Models.Token> {
|
|
1069
|
-
|
|
1070
|
-
|
|
1019
|
+
const apiPath = '/account/verification/phone';
|
|
1020
|
+
const payload: Payload = {};
|
|
1071
1021
|
|
|
1072
|
-
const uri = new URL(this.client.config.endpoint +
|
|
1022
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1073
1023
|
return await this.client.call('post', uri, {
|
|
1074
1024
|
'content-type': 'application/json',
|
|
1075
1025
|
}, payload);
|
|
1076
1026
|
}
|
|
1077
1027
|
|
|
1078
1028
|
/**
|
|
1079
|
-
* Create
|
|
1029
|
+
* Create phone verification (confirmation)
|
|
1080
1030
|
*
|
|
1081
1031
|
* Use this endpoint to complete the user phone verification process. Use the
|
|
1082
1032
|
* **userId** and **secret** that were sent to your user's phone number to
|
|
@@ -1097,8 +1047,8 @@ export class Account extends Service {
|
|
|
1097
1047
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1098
1048
|
}
|
|
1099
1049
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1050
|
+
const apiPath = '/account/verification/phone';
|
|
1051
|
+
const payload: Payload = {};
|
|
1102
1052
|
|
|
1103
1053
|
if (typeof userId !== 'undefined') {
|
|
1104
1054
|
payload['userId'] = userId;
|
|
@@ -1108,7 +1058,7 @@ export class Account extends Service {
|
|
|
1108
1058
|
payload['secret'] = secret;
|
|
1109
1059
|
}
|
|
1110
1060
|
|
|
1111
|
-
const uri = new URL(this.client.config.endpoint +
|
|
1061
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1112
1062
|
return await this.client.call('put', uri, {
|
|
1113
1063
|
'content-type': 'application/json',
|
|
1114
1064
|
}, payload);
|