react-native-appwrite 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/autoclose.yml +11 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/cjs/sdk.js +1118 -1459
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1118 -1459
- package/dist/esm/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +8 -5
- package/src/enums/image-format.ts +1 -0
- package/src/services/account.ts +104 -187
- package/src/services/avatars.ts +0 -14
- package/src/services/databases.ts +10 -20
- package/src/services/functions.ts +6 -12
- package/src/services/graphql.ts +4 -8
- package/src/services/locale.ts +16 -32
- package/src/services/messaging.ts +4 -8
- package/src/services/storage.ts +13 -31
- package/src/services/teams.ts +26 -52
- package/types/enums/image-format.d.ts +1 -0
- package/types/services/account.d.ts +15 -98
- package/types/services/avatars.d.ts +0 -14
- package/types/services/databases.d.ts +0 -10
- package/types/services/functions.d.ts +0 -6
- package/types/services/graphql.d.ts +0 -4
- package/types/services/locale.d.ts +0 -16
- package/types/services/messaging.d.ts +0 -4
- package/types/services/storage.d.ts +0 -16
- package/types/services/teams.d.ts +0 -26
package/src/services/account.ts
CHANGED
|
@@ -17,26 +17,22 @@ export class Account extends Service {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Get account
|
|
21
|
-
*
|
|
22
20
|
* Get the currently logged in user.
|
|
23
21
|
*
|
|
24
22
|
* @throws {AppwriteException}
|
|
25
23
|
* @returns {Promise}
|
|
26
24
|
*/
|
|
27
|
-
|
|
25
|
+
get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
28
26
|
const apiPath = '/account';
|
|
29
27
|
const payload: Payload = {};
|
|
30
28
|
|
|
31
29
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
32
|
-
return
|
|
30
|
+
return this.client.call('get', uri, {
|
|
33
31
|
'content-type': 'application/json',
|
|
34
32
|
}, payload);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
/**
|
|
38
|
-
* Create account
|
|
39
|
-
*
|
|
40
36
|
* Use this endpoint to allow a new user to register a new account in your
|
|
41
37
|
* project. After the user registration completes successfully, you can use
|
|
42
38
|
* the
|
|
@@ -52,7 +48,7 @@ export class Account extends Service {
|
|
|
52
48
|
* @throws {AppwriteException}
|
|
53
49
|
* @returns {Promise}
|
|
54
50
|
*/
|
|
55
|
-
|
|
51
|
+
create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
56
52
|
if (typeof userId === 'undefined') {
|
|
57
53
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
58
54
|
}
|
|
@@ -85,14 +81,12 @@ export class Account extends Service {
|
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
88
|
-
return
|
|
84
|
+
return this.client.call('post', uri, {
|
|
89
85
|
'content-type': 'application/json',
|
|
90
86
|
}, payload);
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
/**
|
|
94
|
-
* Update email
|
|
95
|
-
*
|
|
96
90
|
* Update currently logged in user account email address. After changing user
|
|
97
91
|
* address, the user confirmation status will get reset. A new confirmation
|
|
98
92
|
* email is not sent automatically however you can use the send confirmation
|
|
@@ -107,7 +101,7 @@ export class Account extends Service {
|
|
|
107
101
|
* @throws {AppwriteException}
|
|
108
102
|
* @returns {Promise}
|
|
109
103
|
*/
|
|
110
|
-
|
|
104
|
+
updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>> {
|
|
111
105
|
if (typeof email === 'undefined') {
|
|
112
106
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
113
107
|
}
|
|
@@ -128,21 +122,19 @@ export class Account extends Service {
|
|
|
128
122
|
}
|
|
129
123
|
|
|
130
124
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
131
|
-
return
|
|
125
|
+
return this.client.call('patch', uri, {
|
|
132
126
|
'content-type': 'application/json',
|
|
133
127
|
}, payload);
|
|
134
128
|
}
|
|
135
129
|
|
|
136
130
|
/**
|
|
137
|
-
* List identities
|
|
138
|
-
*
|
|
139
131
|
* Get the list of identities for the currently logged in user.
|
|
140
132
|
*
|
|
141
133
|
* @param {string[]} queries
|
|
142
134
|
* @throws {AppwriteException}
|
|
143
135
|
* @returns {Promise}
|
|
144
136
|
*/
|
|
145
|
-
|
|
137
|
+
listIdentities(queries?: string[]): Promise<Models.IdentityList> {
|
|
146
138
|
const apiPath = '/account/identities';
|
|
147
139
|
const payload: Payload = {};
|
|
148
140
|
|
|
@@ -151,21 +143,19 @@ export class Account extends Service {
|
|
|
151
143
|
}
|
|
152
144
|
|
|
153
145
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
154
|
-
return
|
|
146
|
+
return this.client.call('get', uri, {
|
|
155
147
|
'content-type': 'application/json',
|
|
156
148
|
}, payload);
|
|
157
149
|
}
|
|
158
150
|
|
|
159
151
|
/**
|
|
160
|
-
* Delete identity
|
|
161
|
-
*
|
|
162
152
|
* Delete an identity by its unique ID.
|
|
163
153
|
*
|
|
164
154
|
* @param {string} identityId
|
|
165
155
|
* @throws {AppwriteException}
|
|
166
156
|
* @returns {Promise}
|
|
167
157
|
*/
|
|
168
|
-
|
|
158
|
+
deleteIdentity(identityId: string): Promise<{}> {
|
|
169
159
|
if (typeof identityId === 'undefined') {
|
|
170
160
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
171
161
|
}
|
|
@@ -174,14 +164,12 @@ export class Account extends Service {
|
|
|
174
164
|
const payload: Payload = {};
|
|
175
165
|
|
|
176
166
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
177
|
-
return
|
|
167
|
+
return this.client.call('delete', uri, {
|
|
178
168
|
'content-type': 'application/json',
|
|
179
169
|
}, payload);
|
|
180
170
|
}
|
|
181
171
|
|
|
182
172
|
/**
|
|
183
|
-
* Create JWT
|
|
184
|
-
*
|
|
185
173
|
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT
|
|
186
174
|
* to authenticate on behalf of the current user when working with the
|
|
187
175
|
* Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
|
|
@@ -191,19 +179,17 @@ export class Account extends Service {
|
|
|
191
179
|
* @throws {AppwriteException}
|
|
192
180
|
* @returns {Promise}
|
|
193
181
|
*/
|
|
194
|
-
|
|
182
|
+
createJWT(): Promise<Models.Jwt> {
|
|
195
183
|
const apiPath = '/account/jwts';
|
|
196
184
|
const payload: Payload = {};
|
|
197
185
|
|
|
198
186
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
199
|
-
return
|
|
187
|
+
return this.client.call('post', uri, {
|
|
200
188
|
'content-type': 'application/json',
|
|
201
189
|
}, payload);
|
|
202
190
|
}
|
|
203
191
|
|
|
204
192
|
/**
|
|
205
|
-
* List logs
|
|
206
|
-
*
|
|
207
193
|
* Get the list of latest security activity logs for the currently logged in
|
|
208
194
|
* user. Each log returns user IP address, location and date and time of log.
|
|
209
195
|
*
|
|
@@ -211,7 +197,7 @@ export class Account extends Service {
|
|
|
211
197
|
* @throws {AppwriteException}
|
|
212
198
|
* @returns {Promise}
|
|
213
199
|
*/
|
|
214
|
-
|
|
200
|
+
listLogs(queries?: string[]): Promise<Models.LogList> {
|
|
215
201
|
const apiPath = '/account/logs';
|
|
216
202
|
const payload: Payload = {};
|
|
217
203
|
|
|
@@ -220,21 +206,19 @@ export class Account extends Service {
|
|
|
220
206
|
}
|
|
221
207
|
|
|
222
208
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
223
|
-
return
|
|
209
|
+
return this.client.call('get', uri, {
|
|
224
210
|
'content-type': 'application/json',
|
|
225
211
|
}, payload);
|
|
226
212
|
}
|
|
227
213
|
|
|
228
214
|
/**
|
|
229
|
-
* Update MFA
|
|
230
|
-
*
|
|
231
215
|
* Enable or disable MFA on an account.
|
|
232
216
|
*
|
|
233
217
|
* @param {boolean} mfa
|
|
234
218
|
* @throws {AppwriteException}
|
|
235
219
|
* @returns {Promise}
|
|
236
220
|
*/
|
|
237
|
-
|
|
221
|
+
updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences>> {
|
|
238
222
|
if (typeof mfa === 'undefined') {
|
|
239
223
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
240
224
|
}
|
|
@@ -247,14 +231,12 @@ export class Account extends Service {
|
|
|
247
231
|
}
|
|
248
232
|
|
|
249
233
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
250
|
-
return
|
|
234
|
+
return this.client.call('patch', uri, {
|
|
251
235
|
'content-type': 'application/json',
|
|
252
236
|
}, payload);
|
|
253
237
|
}
|
|
254
238
|
|
|
255
239
|
/**
|
|
256
|
-
* Create authenticator
|
|
257
|
-
*
|
|
258
240
|
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
259
241
|
* authenticator using the [verify
|
|
260
242
|
* authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
|
|
@@ -264,7 +246,7 @@ export class Account extends Service {
|
|
|
264
246
|
* @throws {AppwriteException}
|
|
265
247
|
* @returns {Promise}
|
|
266
248
|
*/
|
|
267
|
-
|
|
249
|
+
createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType> {
|
|
268
250
|
if (typeof type === 'undefined') {
|
|
269
251
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
270
252
|
}
|
|
@@ -273,14 +255,12 @@ export class Account extends Service {
|
|
|
273
255
|
const payload: Payload = {};
|
|
274
256
|
|
|
275
257
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
276
|
-
return
|
|
258
|
+
return this.client.call('post', uri, {
|
|
277
259
|
'content-type': 'application/json',
|
|
278
260
|
}, payload);
|
|
279
261
|
}
|
|
280
262
|
|
|
281
263
|
/**
|
|
282
|
-
* Verify authenticator
|
|
283
|
-
*
|
|
284
264
|
* Verify an authenticator app after adding it using the [add
|
|
285
265
|
* authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
|
|
286
266
|
* method.
|
|
@@ -290,7 +270,7 @@ export class Account extends Service {
|
|
|
290
270
|
* @throws {AppwriteException}
|
|
291
271
|
* @returns {Promise}
|
|
292
272
|
*/
|
|
293
|
-
|
|
273
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
|
|
294
274
|
if (typeof type === 'undefined') {
|
|
295
275
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
296
276
|
}
|
|
@@ -307,21 +287,19 @@ export class Account extends Service {
|
|
|
307
287
|
}
|
|
308
288
|
|
|
309
289
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
310
|
-
return
|
|
290
|
+
return this.client.call('put', uri, {
|
|
311
291
|
'content-type': 'application/json',
|
|
312
292
|
}, payload);
|
|
313
293
|
}
|
|
314
294
|
|
|
315
295
|
/**
|
|
316
|
-
* Delete authenticator
|
|
317
|
-
*
|
|
318
296
|
* Delete an authenticator for a user by ID.
|
|
319
297
|
*
|
|
320
298
|
* @param {AuthenticatorType} type
|
|
321
299
|
* @throws {AppwriteException}
|
|
322
300
|
* @returns {Promise}
|
|
323
301
|
*/
|
|
324
|
-
|
|
302
|
+
deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> {
|
|
325
303
|
if (typeof type === 'undefined') {
|
|
326
304
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
327
305
|
}
|
|
@@ -330,14 +308,12 @@ export class Account extends Service {
|
|
|
330
308
|
const payload: Payload = {};
|
|
331
309
|
|
|
332
310
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
333
|
-
return
|
|
311
|
+
return this.client.call('delete', uri, {
|
|
334
312
|
'content-type': 'application/json',
|
|
335
313
|
}, payload);
|
|
336
314
|
}
|
|
337
315
|
|
|
338
316
|
/**
|
|
339
|
-
* Create MFA challenge
|
|
340
|
-
*
|
|
341
317
|
* Begin the process of MFA verification after sign-in. Finish the flow with
|
|
342
318
|
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
|
|
343
319
|
* method.
|
|
@@ -346,7 +322,7 @@ export class Account extends Service {
|
|
|
346
322
|
* @throws {AppwriteException}
|
|
347
323
|
* @returns {Promise}
|
|
348
324
|
*/
|
|
349
|
-
|
|
325
|
+
createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge> {
|
|
350
326
|
if (typeof factor === 'undefined') {
|
|
351
327
|
throw new AppwriteException('Missing required parameter: "factor"');
|
|
352
328
|
}
|
|
@@ -359,14 +335,12 @@ export class Account extends Service {
|
|
|
359
335
|
}
|
|
360
336
|
|
|
361
337
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
362
|
-
return
|
|
338
|
+
return this.client.call('post', uri, {
|
|
363
339
|
'content-type': 'application/json',
|
|
364
340
|
}, payload);
|
|
365
341
|
}
|
|
366
342
|
|
|
367
343
|
/**
|
|
368
|
-
* Create MFA challenge (confirmation)
|
|
369
|
-
*
|
|
370
344
|
* Complete the MFA challenge by providing the one-time password. Finish the
|
|
371
345
|
* process of MFA verification by providing the one-time password. To begin
|
|
372
346
|
* the flow, use
|
|
@@ -378,7 +352,7 @@ export class Account extends Service {
|
|
|
378
352
|
* @throws {AppwriteException}
|
|
379
353
|
* @returns {Promise}
|
|
380
354
|
*/
|
|
381
|
-
|
|
355
|
+
updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session> {
|
|
382
356
|
if (typeof challengeId === 'undefined') {
|
|
383
357
|
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
384
358
|
}
|
|
@@ -399,32 +373,28 @@ export class Account extends Service {
|
|
|
399
373
|
}
|
|
400
374
|
|
|
401
375
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
402
|
-
return
|
|
376
|
+
return this.client.call('put', uri, {
|
|
403
377
|
'content-type': 'application/json',
|
|
404
378
|
}, payload);
|
|
405
379
|
}
|
|
406
380
|
|
|
407
381
|
/**
|
|
408
|
-
* List factors
|
|
409
|
-
*
|
|
410
382
|
* List the factors available on the account to be used as a MFA challange.
|
|
411
383
|
*
|
|
412
384
|
* @throws {AppwriteException}
|
|
413
385
|
* @returns {Promise}
|
|
414
386
|
*/
|
|
415
|
-
|
|
387
|
+
listMfaFactors(): Promise<Models.MfaFactors> {
|
|
416
388
|
const apiPath = '/account/mfa/factors';
|
|
417
389
|
const payload: Payload = {};
|
|
418
390
|
|
|
419
391
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
420
|
-
return
|
|
392
|
+
return this.client.call('get', uri, {
|
|
421
393
|
'content-type': 'application/json',
|
|
422
394
|
}, payload);
|
|
423
395
|
}
|
|
424
396
|
|
|
425
397
|
/**
|
|
426
|
-
* Get MFA recovery codes
|
|
427
|
-
*
|
|
428
398
|
* Get recovery codes that can be used as backup for MFA flow. Before getting
|
|
429
399
|
* codes, they must be generated using
|
|
430
400
|
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
@@ -433,19 +403,17 @@ export class Account extends Service {
|
|
|
433
403
|
* @throws {AppwriteException}
|
|
434
404
|
* @returns {Promise}
|
|
435
405
|
*/
|
|
436
|
-
|
|
406
|
+
getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
437
407
|
const apiPath = '/account/mfa/recovery-codes';
|
|
438
408
|
const payload: Payload = {};
|
|
439
409
|
|
|
440
410
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
441
|
-
return
|
|
411
|
+
return this.client.call('get', uri, {
|
|
442
412
|
'content-type': 'application/json',
|
|
443
413
|
}, payload);
|
|
444
414
|
}
|
|
445
415
|
|
|
446
416
|
/**
|
|
447
|
-
* Create MFA recovery codes
|
|
448
|
-
*
|
|
449
417
|
* Generate recovery codes as backup for MFA flow. It's recommended to
|
|
450
418
|
* generate and show then immediately after user successfully adds their
|
|
451
419
|
* authehticator. Recovery codes can be used as a MFA verification type in
|
|
@@ -455,19 +423,17 @@ export class Account extends Service {
|
|
|
455
423
|
* @throws {AppwriteException}
|
|
456
424
|
* @returns {Promise}
|
|
457
425
|
*/
|
|
458
|
-
|
|
426
|
+
createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
459
427
|
const apiPath = '/account/mfa/recovery-codes';
|
|
460
428
|
const payload: Payload = {};
|
|
461
429
|
|
|
462
430
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
463
|
-
return
|
|
431
|
+
return this.client.call('post', uri, {
|
|
464
432
|
'content-type': 'application/json',
|
|
465
433
|
}, payload);
|
|
466
434
|
}
|
|
467
435
|
|
|
468
436
|
/**
|
|
469
|
-
* Regenerate MFA recovery codes
|
|
470
|
-
*
|
|
471
437
|
* Regenerate recovery codes that can be used as backup for MFA flow. Before
|
|
472
438
|
* regenerating codes, they must be first generated using
|
|
473
439
|
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
@@ -476,26 +442,24 @@ export class Account extends Service {
|
|
|
476
442
|
* @throws {AppwriteException}
|
|
477
443
|
* @returns {Promise}
|
|
478
444
|
*/
|
|
479
|
-
|
|
445
|
+
updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
480
446
|
const apiPath = '/account/mfa/recovery-codes';
|
|
481
447
|
const payload: Payload = {};
|
|
482
448
|
|
|
483
449
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
484
|
-
return
|
|
450
|
+
return this.client.call('patch', uri, {
|
|
485
451
|
'content-type': 'application/json',
|
|
486
452
|
}, payload);
|
|
487
453
|
}
|
|
488
454
|
|
|
489
455
|
/**
|
|
490
|
-
* Update name
|
|
491
|
-
*
|
|
492
456
|
* Update currently logged in user account name.
|
|
493
457
|
*
|
|
494
458
|
* @param {string} name
|
|
495
459
|
* @throws {AppwriteException}
|
|
496
460
|
* @returns {Promise}
|
|
497
461
|
*/
|
|
498
|
-
|
|
462
|
+
updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>> {
|
|
499
463
|
if (typeof name === 'undefined') {
|
|
500
464
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
501
465
|
}
|
|
@@ -508,14 +472,12 @@ export class Account extends Service {
|
|
|
508
472
|
}
|
|
509
473
|
|
|
510
474
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
511
|
-
return
|
|
475
|
+
return this.client.call('patch', uri, {
|
|
512
476
|
'content-type': 'application/json',
|
|
513
477
|
}, payload);
|
|
514
478
|
}
|
|
515
479
|
|
|
516
480
|
/**
|
|
517
|
-
* Update password
|
|
518
|
-
*
|
|
519
481
|
* Update currently logged in user password. For validation, user is required
|
|
520
482
|
* to pass in the new password, and the old password. For users created with
|
|
521
483
|
* OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
@@ -525,7 +487,7 @@ export class Account extends Service {
|
|
|
525
487
|
* @throws {AppwriteException}
|
|
526
488
|
* @returns {Promise}
|
|
527
489
|
*/
|
|
528
|
-
|
|
490
|
+
updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>> {
|
|
529
491
|
if (typeof password === 'undefined') {
|
|
530
492
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
531
493
|
}
|
|
@@ -542,14 +504,12 @@ export class Account extends Service {
|
|
|
542
504
|
}
|
|
543
505
|
|
|
544
506
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
545
|
-
return
|
|
507
|
+
return this.client.call('patch', uri, {
|
|
546
508
|
'content-type': 'application/json',
|
|
547
509
|
}, payload);
|
|
548
510
|
}
|
|
549
511
|
|
|
550
512
|
/**
|
|
551
|
-
* Update phone
|
|
552
|
-
*
|
|
553
513
|
* Update the currently logged in user's phone number. After updating the
|
|
554
514
|
* phone number, the phone verification status will be reset. A confirmation
|
|
555
515
|
* SMS is not sent automatically, however you can use the [POST
|
|
@@ -561,7 +521,7 @@ export class Account extends Service {
|
|
|
561
521
|
* @throws {AppwriteException}
|
|
562
522
|
* @returns {Promise}
|
|
563
523
|
*/
|
|
564
|
-
|
|
524
|
+
updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>> {
|
|
565
525
|
if (typeof phone === 'undefined') {
|
|
566
526
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
567
527
|
}
|
|
@@ -582,32 +542,28 @@ export class Account extends Service {
|
|
|
582
542
|
}
|
|
583
543
|
|
|
584
544
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
585
|
-
return
|
|
545
|
+
return this.client.call('patch', uri, {
|
|
586
546
|
'content-type': 'application/json',
|
|
587
547
|
}, payload);
|
|
588
548
|
}
|
|
589
549
|
|
|
590
550
|
/**
|
|
591
|
-
* Get account preferences
|
|
592
|
-
*
|
|
593
551
|
* Get the preferences as a key-value object for the currently logged in user.
|
|
594
552
|
*
|
|
595
553
|
* @throws {AppwriteException}
|
|
596
554
|
* @returns {Promise}
|
|
597
555
|
*/
|
|
598
|
-
|
|
556
|
+
getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
|
|
599
557
|
const apiPath = '/account/prefs';
|
|
600
558
|
const payload: Payload = {};
|
|
601
559
|
|
|
602
560
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
603
|
-
return
|
|
561
|
+
return this.client.call('get', uri, {
|
|
604
562
|
'content-type': 'application/json',
|
|
605
563
|
}, payload);
|
|
606
564
|
}
|
|
607
565
|
|
|
608
566
|
/**
|
|
609
|
-
* Update preferences
|
|
610
|
-
*
|
|
611
567
|
* Update currently logged in user account preferences. The object you pass is
|
|
612
568
|
* stored as is, and replaces any previous value. The maximum allowed prefs
|
|
613
569
|
* size is 64kB and throws error if exceeded.
|
|
@@ -616,7 +572,7 @@ export class Account extends Service {
|
|
|
616
572
|
* @throws {AppwriteException}
|
|
617
573
|
* @returns {Promise}
|
|
618
574
|
*/
|
|
619
|
-
|
|
575
|
+
updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.User<Preferences>> {
|
|
620
576
|
if (typeof prefs === 'undefined') {
|
|
621
577
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
622
578
|
}
|
|
@@ -629,14 +585,12 @@ export class Account extends Service {
|
|
|
629
585
|
}
|
|
630
586
|
|
|
631
587
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
632
|
-
return
|
|
588
|
+
return this.client.call('patch', uri, {
|
|
633
589
|
'content-type': 'application/json',
|
|
634
590
|
}, payload);
|
|
635
591
|
}
|
|
636
592
|
|
|
637
593
|
/**
|
|
638
|
-
* Create password recovery
|
|
639
|
-
*
|
|
640
594
|
* Sends the user an email with a temporary secret key for password reset.
|
|
641
595
|
* When the user clicks the confirmation link he is redirected back to your
|
|
642
596
|
* app password reset URL with the secret key and email address values
|
|
@@ -651,7 +605,7 @@ export class Account extends Service {
|
|
|
651
605
|
* @throws {AppwriteException}
|
|
652
606
|
* @returns {Promise}
|
|
653
607
|
*/
|
|
654
|
-
|
|
608
|
+
createRecovery(email: string, url: string): Promise<Models.Token> {
|
|
655
609
|
if (typeof email === 'undefined') {
|
|
656
610
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
657
611
|
}
|
|
@@ -672,14 +626,12 @@ export class Account extends Service {
|
|
|
672
626
|
}
|
|
673
627
|
|
|
674
628
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
675
|
-
return
|
|
629
|
+
return this.client.call('post', uri, {
|
|
676
630
|
'content-type': 'application/json',
|
|
677
631
|
}, payload);
|
|
678
632
|
}
|
|
679
633
|
|
|
680
634
|
/**
|
|
681
|
-
* Create password recovery (confirmation)
|
|
682
|
-
*
|
|
683
635
|
* Use this endpoint to complete the user account password reset. Both the
|
|
684
636
|
* **userId** and **secret** arguments will be passed as query parameters to
|
|
685
637
|
* the redirect URL you have provided when sending your request to the [POST
|
|
@@ -697,7 +649,7 @@ export class Account extends Service {
|
|
|
697
649
|
* @throws {AppwriteException}
|
|
698
650
|
* @returns {Promise}
|
|
699
651
|
*/
|
|
700
|
-
|
|
652
|
+
updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token> {
|
|
701
653
|
if (typeof userId === 'undefined') {
|
|
702
654
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
703
655
|
}
|
|
@@ -726,52 +678,46 @@ export class Account extends Service {
|
|
|
726
678
|
}
|
|
727
679
|
|
|
728
680
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
729
|
-
return
|
|
681
|
+
return this.client.call('put', uri, {
|
|
730
682
|
'content-type': 'application/json',
|
|
731
683
|
}, payload);
|
|
732
684
|
}
|
|
733
685
|
|
|
734
686
|
/**
|
|
735
|
-
* List sessions
|
|
736
|
-
*
|
|
737
687
|
* Get the list of active sessions across different devices for the currently
|
|
738
688
|
* logged in user.
|
|
739
689
|
*
|
|
740
690
|
* @throws {AppwriteException}
|
|
741
691
|
* @returns {Promise}
|
|
742
692
|
*/
|
|
743
|
-
|
|
693
|
+
listSessions(): Promise<Models.SessionList> {
|
|
744
694
|
const apiPath = '/account/sessions';
|
|
745
695
|
const payload: Payload = {};
|
|
746
696
|
|
|
747
697
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
748
|
-
return
|
|
698
|
+
return this.client.call('get', uri, {
|
|
749
699
|
'content-type': 'application/json',
|
|
750
700
|
}, payload);
|
|
751
701
|
}
|
|
752
702
|
|
|
753
703
|
/**
|
|
754
|
-
* Delete sessions
|
|
755
|
-
*
|
|
756
704
|
* Delete all sessions from the user account and remove any sessions cookies
|
|
757
705
|
* from the end client.
|
|
758
706
|
*
|
|
759
707
|
* @throws {AppwriteException}
|
|
760
708
|
* @returns {Promise}
|
|
761
709
|
*/
|
|
762
|
-
|
|
710
|
+
deleteSessions(): Promise<{}> {
|
|
763
711
|
const apiPath = '/account/sessions';
|
|
764
712
|
const payload: Payload = {};
|
|
765
713
|
|
|
766
714
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
767
|
-
return
|
|
715
|
+
return this.client.call('delete', uri, {
|
|
768
716
|
'content-type': 'application/json',
|
|
769
717
|
}, payload);
|
|
770
718
|
}
|
|
771
719
|
|
|
772
720
|
/**
|
|
773
|
-
* Create anonymous session
|
|
774
|
-
*
|
|
775
721
|
* Use this endpoint to allow a new user to register an anonymous account in
|
|
776
722
|
* your project. This route will also create a new session for the user. To
|
|
777
723
|
* allow the new user to convert an anonymous account to a normal account, you
|
|
@@ -783,19 +729,17 @@ export class Account extends Service {
|
|
|
783
729
|
* @throws {AppwriteException}
|
|
784
730
|
* @returns {Promise}
|
|
785
731
|
*/
|
|
786
|
-
|
|
732
|
+
createAnonymousSession(): Promise<Models.Session> {
|
|
787
733
|
const apiPath = '/account/sessions/anonymous';
|
|
788
734
|
const payload: Payload = {};
|
|
789
735
|
|
|
790
736
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
791
|
-
return
|
|
737
|
+
return this.client.call('post', uri, {
|
|
792
738
|
'content-type': 'application/json',
|
|
793
739
|
}, payload);
|
|
794
740
|
}
|
|
795
741
|
|
|
796
742
|
/**
|
|
797
|
-
* Create email password session
|
|
798
|
-
*
|
|
799
743
|
* Allow the user to login into their account by providing a valid email and
|
|
800
744
|
* password combination. This route will create a new session for the user.
|
|
801
745
|
*
|
|
@@ -808,7 +752,7 @@ export class Account extends Service {
|
|
|
808
752
|
* @throws {AppwriteException}
|
|
809
753
|
* @returns {Promise}
|
|
810
754
|
*/
|
|
811
|
-
|
|
755
|
+
createEmailPasswordSession(email: string, password: string): Promise<Models.Session> {
|
|
812
756
|
if (typeof email === 'undefined') {
|
|
813
757
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
814
758
|
}
|
|
@@ -829,14 +773,12 @@ export class Account extends Service {
|
|
|
829
773
|
}
|
|
830
774
|
|
|
831
775
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
832
|
-
return
|
|
776
|
+
return this.client.call('post', uri, {
|
|
833
777
|
'content-type': 'application/json',
|
|
834
778
|
}, payload);
|
|
835
779
|
}
|
|
836
780
|
|
|
837
781
|
/**
|
|
838
|
-
* Update magic URL session
|
|
839
|
-
*
|
|
840
782
|
* Use this endpoint to create a session from token. Provide the **userId**
|
|
841
783
|
* and **secret** parameters from the successful response of authentication
|
|
842
784
|
* flows initiated by token creation. For example, magic URL and phone login.
|
|
@@ -846,7 +788,7 @@ export class Account extends Service {
|
|
|
846
788
|
* @throws {AppwriteException}
|
|
847
789
|
* @returns {Promise}
|
|
848
790
|
*/
|
|
849
|
-
|
|
791
|
+
updateMagicURLSession(userId: string, secret: string): Promise<Models.Session> {
|
|
850
792
|
if (typeof userId === 'undefined') {
|
|
851
793
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
852
794
|
}
|
|
@@ -867,14 +809,12 @@ export class Account extends Service {
|
|
|
867
809
|
}
|
|
868
810
|
|
|
869
811
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
870
|
-
return
|
|
812
|
+
return this.client.call('put', uri, {
|
|
871
813
|
'content-type': 'application/json',
|
|
872
814
|
}, payload);
|
|
873
815
|
}
|
|
874
816
|
|
|
875
817
|
/**
|
|
876
|
-
* Create OAuth2 session
|
|
877
|
-
*
|
|
878
818
|
* Allow the user to login to their account using the OAuth2 provider of their
|
|
879
819
|
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
880
820
|
* first. Use the success and failure arguments to provide a redirect URL's
|
|
@@ -930,8 +870,6 @@ export class Account extends Service {
|
|
|
930
870
|
}
|
|
931
871
|
|
|
932
872
|
/**
|
|
933
|
-
* Update phone session
|
|
934
|
-
*
|
|
935
873
|
* Use this endpoint to create a session from token. Provide the **userId**
|
|
936
874
|
* and **secret** parameters from the successful response of authentication
|
|
937
875
|
* flows initiated by token creation. For example, magic URL and phone login.
|
|
@@ -941,7 +879,7 @@ export class Account extends Service {
|
|
|
941
879
|
* @throws {AppwriteException}
|
|
942
880
|
* @returns {Promise}
|
|
943
881
|
*/
|
|
944
|
-
|
|
882
|
+
updatePhoneSession(userId: string, secret: string): Promise<Models.Session> {
|
|
945
883
|
if (typeof userId === 'undefined') {
|
|
946
884
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
947
885
|
}
|
|
@@ -962,14 +900,12 @@ export class Account extends Service {
|
|
|
962
900
|
}
|
|
963
901
|
|
|
964
902
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
965
|
-
return
|
|
903
|
+
return this.client.call('put', uri, {
|
|
966
904
|
'content-type': 'application/json',
|
|
967
905
|
}, payload);
|
|
968
906
|
}
|
|
969
907
|
|
|
970
908
|
/**
|
|
971
|
-
* Create session
|
|
972
|
-
*
|
|
973
909
|
* Use this endpoint to create a session from token. Provide the **userId**
|
|
974
910
|
* and **secret** parameters from the successful response of authentication
|
|
975
911
|
* flows initiated by token creation. For example, magic URL and phone login.
|
|
@@ -979,7 +915,7 @@ export class Account extends Service {
|
|
|
979
915
|
* @throws {AppwriteException}
|
|
980
916
|
* @returns {Promise}
|
|
981
917
|
*/
|
|
982
|
-
|
|
918
|
+
createSession(userId: string, secret: string): Promise<Models.Session> {
|
|
983
919
|
if (typeof userId === 'undefined') {
|
|
984
920
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
985
921
|
}
|
|
@@ -1000,14 +936,12 @@ export class Account extends Service {
|
|
|
1000
936
|
}
|
|
1001
937
|
|
|
1002
938
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1003
|
-
return
|
|
939
|
+
return this.client.call('post', uri, {
|
|
1004
940
|
'content-type': 'application/json',
|
|
1005
941
|
}, payload);
|
|
1006
942
|
}
|
|
1007
943
|
|
|
1008
944
|
/**
|
|
1009
|
-
* Get session
|
|
1010
|
-
*
|
|
1011
945
|
* Use this endpoint to get a logged in user's session using a Session ID.
|
|
1012
946
|
* Inputting 'current' will return the current session being used.
|
|
1013
947
|
*
|
|
@@ -1015,7 +949,7 @@ export class Account extends Service {
|
|
|
1015
949
|
* @throws {AppwriteException}
|
|
1016
950
|
* @returns {Promise}
|
|
1017
951
|
*/
|
|
1018
|
-
|
|
952
|
+
getSession(sessionId: string): Promise<Models.Session> {
|
|
1019
953
|
if (typeof sessionId === 'undefined') {
|
|
1020
954
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1021
955
|
}
|
|
@@ -1024,14 +958,12 @@ export class Account extends Service {
|
|
|
1024
958
|
const payload: Payload = {};
|
|
1025
959
|
|
|
1026
960
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1027
|
-
return
|
|
961
|
+
return this.client.call('get', uri, {
|
|
1028
962
|
'content-type': 'application/json',
|
|
1029
963
|
}, payload);
|
|
1030
964
|
}
|
|
1031
965
|
|
|
1032
966
|
/**
|
|
1033
|
-
* Update session
|
|
1034
|
-
*
|
|
1035
967
|
* Use this endpoint to extend a session's length. Extending a session is
|
|
1036
968
|
* useful when session expiry is short. If the session was created using an
|
|
1037
969
|
* OAuth provider, this endpoint refreshes the access token from the provider.
|
|
@@ -1040,7 +972,7 @@ export class Account extends Service {
|
|
|
1040
972
|
* @throws {AppwriteException}
|
|
1041
973
|
* @returns {Promise}
|
|
1042
974
|
*/
|
|
1043
|
-
|
|
975
|
+
updateSession(sessionId: string): Promise<Models.Session> {
|
|
1044
976
|
if (typeof sessionId === 'undefined') {
|
|
1045
977
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1046
978
|
}
|
|
@@ -1049,14 +981,12 @@ export class Account extends Service {
|
|
|
1049
981
|
const payload: Payload = {};
|
|
1050
982
|
|
|
1051
983
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1052
|
-
return
|
|
984
|
+
return this.client.call('patch', uri, {
|
|
1053
985
|
'content-type': 'application/json',
|
|
1054
986
|
}, payload);
|
|
1055
987
|
}
|
|
1056
988
|
|
|
1057
989
|
/**
|
|
1058
|
-
* Delete session
|
|
1059
|
-
*
|
|
1060
990
|
* Logout the user. Use 'current' as the session ID to logout on this device,
|
|
1061
991
|
* use a session ID to logout on another device. If you're looking to logout
|
|
1062
992
|
* the user on all devices, use [Delete
|
|
@@ -1067,7 +997,7 @@ export class Account extends Service {
|
|
|
1067
997
|
* @throws {AppwriteException}
|
|
1068
998
|
* @returns {Promise}
|
|
1069
999
|
*/
|
|
1070
|
-
|
|
1000
|
+
deleteSession(sessionId: string): Promise<{}> {
|
|
1071
1001
|
if (typeof sessionId === 'undefined') {
|
|
1072
1002
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1073
1003
|
}
|
|
@@ -1076,14 +1006,12 @@ export class Account extends Service {
|
|
|
1076
1006
|
const payload: Payload = {};
|
|
1077
1007
|
|
|
1078
1008
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1079
|
-
return
|
|
1009
|
+
return this.client.call('delete', uri, {
|
|
1080
1010
|
'content-type': 'application/json',
|
|
1081
1011
|
}, payload);
|
|
1082
1012
|
}
|
|
1083
1013
|
|
|
1084
1014
|
/**
|
|
1085
|
-
* Update status
|
|
1086
|
-
*
|
|
1087
1015
|
* Block the currently logged in user account. Behind the scene, the user
|
|
1088
1016
|
* record is not deleted but permanently blocked from any access. To
|
|
1089
1017
|
* completely delete a user, use the Users API instead.
|
|
@@ -1091,19 +1019,22 @@ export class Account extends Service {
|
|
|
1091
1019
|
* @throws {AppwriteException}
|
|
1092
1020
|
* @returns {Promise}
|
|
1093
1021
|
*/
|
|
1094
|
-
|
|
1022
|
+
updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
1095
1023
|
const apiPath = '/account/status';
|
|
1096
1024
|
const payload: Payload = {};
|
|
1097
1025
|
|
|
1098
1026
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1099
|
-
return
|
|
1027
|
+
return this.client.call('patch', uri, {
|
|
1100
1028
|
'content-type': 'application/json',
|
|
1101
1029
|
}, payload);
|
|
1102
1030
|
}
|
|
1103
1031
|
|
|
1104
1032
|
/**
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1033
|
+
* Use this endpoint to register a device for push notifications. Provide a
|
|
1034
|
+
* target ID (custom or generated using ID.unique()), a device identifier
|
|
1035
|
+
* (usually a device token), and optionally specify which provider should send
|
|
1036
|
+
* notifications to this target. The target is automatically linked to the
|
|
1037
|
+
* current session and includes device information like brand and model.
|
|
1107
1038
|
*
|
|
1108
1039
|
* @param {string} targetId
|
|
1109
1040
|
* @param {string} identifier
|
|
@@ -1111,7 +1042,7 @@ export class Account extends Service {
|
|
|
1111
1042
|
* @throws {AppwriteException}
|
|
1112
1043
|
* @returns {Promise}
|
|
1113
1044
|
*/
|
|
1114
|
-
|
|
1045
|
+
createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target> {
|
|
1115
1046
|
if (typeof targetId === 'undefined') {
|
|
1116
1047
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1117
1048
|
}
|
|
@@ -1136,21 +1067,24 @@ export class Account extends Service {
|
|
|
1136
1067
|
}
|
|
1137
1068
|
|
|
1138
1069
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1139
|
-
return
|
|
1070
|
+
return this.client.call('post', uri, {
|
|
1140
1071
|
'content-type': 'application/json',
|
|
1141
1072
|
}, payload);
|
|
1142
1073
|
}
|
|
1143
1074
|
|
|
1144
1075
|
/**
|
|
1145
|
-
* Update push target
|
|
1146
|
-
*
|
|
1076
|
+
* Update the currently logged in user's push notification target. You can
|
|
1077
|
+
* modify the target's identifier (device token) and provider ID (token,
|
|
1078
|
+
* email, phone etc.). The target must exist and belong to the current user.
|
|
1079
|
+
* If you change the provider ID, notifications will be sent through the new
|
|
1080
|
+
* messaging provider instead.
|
|
1147
1081
|
*
|
|
1148
1082
|
* @param {string} targetId
|
|
1149
1083
|
* @param {string} identifier
|
|
1150
1084
|
* @throws {AppwriteException}
|
|
1151
1085
|
* @returns {Promise}
|
|
1152
1086
|
*/
|
|
1153
|
-
|
|
1087
|
+
updatePushTarget(targetId: string, identifier: string): Promise<Models.Target> {
|
|
1154
1088
|
if (typeof targetId === 'undefined') {
|
|
1155
1089
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1156
1090
|
}
|
|
@@ -1167,20 +1101,21 @@ export class Account extends Service {
|
|
|
1167
1101
|
}
|
|
1168
1102
|
|
|
1169
1103
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1170
|
-
return
|
|
1104
|
+
return this.client.call('put', uri, {
|
|
1171
1105
|
'content-type': 'application/json',
|
|
1172
1106
|
}, payload);
|
|
1173
1107
|
}
|
|
1174
1108
|
|
|
1175
1109
|
/**
|
|
1176
|
-
* Delete push target
|
|
1177
|
-
*
|
|
1110
|
+
* Delete a push notification target for the currently logged in user. After
|
|
1111
|
+
* deletion, the device will no longer receive push notifications. The target
|
|
1112
|
+
* must exist and belong to the current user.
|
|
1178
1113
|
*
|
|
1179
1114
|
* @param {string} targetId
|
|
1180
1115
|
* @throws {AppwriteException}
|
|
1181
1116
|
* @returns {Promise}
|
|
1182
1117
|
*/
|
|
1183
|
-
|
|
1118
|
+
deletePushTarget(targetId: string): Promise<{}> {
|
|
1184
1119
|
if (typeof targetId === 'undefined') {
|
|
1185
1120
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1186
1121
|
}
|
|
@@ -1189,14 +1124,12 @@ export class Account extends Service {
|
|
|
1189
1124
|
const payload: Payload = {};
|
|
1190
1125
|
|
|
1191
1126
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1192
|
-
return
|
|
1127
|
+
return this.client.call('delete', uri, {
|
|
1193
1128
|
'content-type': 'application/json',
|
|
1194
1129
|
}, payload);
|
|
1195
1130
|
}
|
|
1196
1131
|
|
|
1197
1132
|
/**
|
|
1198
|
-
* Create email token (OTP)
|
|
1199
|
-
*
|
|
1200
1133
|
* Sends the user an email with a secret key for creating a session. If the
|
|
1201
1134
|
* provided user ID has not be registered, a new user will be created. Use the
|
|
1202
1135
|
* returned user ID and secret and submit a request to the [POST
|
|
@@ -1214,7 +1147,7 @@ export class Account extends Service {
|
|
|
1214
1147
|
* @throws {AppwriteException}
|
|
1215
1148
|
* @returns {Promise}
|
|
1216
1149
|
*/
|
|
1217
|
-
|
|
1150
|
+
createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token> {
|
|
1218
1151
|
if (typeof userId === 'undefined') {
|
|
1219
1152
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1220
1153
|
}
|
|
@@ -1239,14 +1172,12 @@ export class Account extends Service {
|
|
|
1239
1172
|
}
|
|
1240
1173
|
|
|
1241
1174
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1242
|
-
return
|
|
1175
|
+
return this.client.call('post', uri, {
|
|
1243
1176
|
'content-type': 'application/json',
|
|
1244
1177
|
}, payload);
|
|
1245
1178
|
}
|
|
1246
1179
|
|
|
1247
1180
|
/**
|
|
1248
|
-
* Create magic URL token
|
|
1249
|
-
*
|
|
1250
1181
|
* Sends the user an email with a secret key for creating a session. If the
|
|
1251
1182
|
* provided user ID has not been registered, a new user will be created. When
|
|
1252
1183
|
* the user clicks the link in the email, the user is redirected back to the
|
|
@@ -1255,9 +1186,7 @@ export class Account extends Service {
|
|
|
1255
1186
|
* [POST
|
|
1256
1187
|
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1257
1188
|
* endpoint to complete the login process. The link sent to the user's email
|
|
1258
|
-
* address is valid for 1 hour.
|
|
1259
|
-
* the URL parameter empty, so that the login completion will be handled by
|
|
1260
|
-
* your Appwrite instance by default.
|
|
1189
|
+
* address is valid for 1 hour.
|
|
1261
1190
|
*
|
|
1262
1191
|
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1263
1192
|
* about session
|
|
@@ -1271,7 +1200,7 @@ export class Account extends Service {
|
|
|
1271
1200
|
* @throws {AppwriteException}
|
|
1272
1201
|
* @returns {Promise}
|
|
1273
1202
|
*/
|
|
1274
|
-
|
|
1203
|
+
createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token> {
|
|
1275
1204
|
if (typeof userId === 'undefined') {
|
|
1276
1205
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1277
1206
|
}
|
|
@@ -1300,14 +1229,12 @@ export class Account extends Service {
|
|
|
1300
1229
|
}
|
|
1301
1230
|
|
|
1302
1231
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1303
|
-
return
|
|
1232
|
+
return this.client.call('post', uri, {
|
|
1304
1233
|
'content-type': 'application/json',
|
|
1305
1234
|
}, payload);
|
|
1306
1235
|
}
|
|
1307
1236
|
|
|
1308
1237
|
/**
|
|
1309
|
-
* Create OAuth2 token
|
|
1310
|
-
*
|
|
1311
1238
|
* Allow the user to login to their account using the OAuth2 provider of their
|
|
1312
1239
|
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
1313
1240
|
* first. Use the success and failure arguments to provide a redirect URL's
|
|
@@ -1361,8 +1288,6 @@ export class Account extends Service {
|
|
|
1361
1288
|
}
|
|
1362
1289
|
|
|
1363
1290
|
/**
|
|
1364
|
-
* Create phone token
|
|
1365
|
-
*
|
|
1366
1291
|
* Sends the user an SMS with a secret key for creating a session. If the
|
|
1367
1292
|
* provided user ID has not be registered, a new user will be created. Use the
|
|
1368
1293
|
* returned user ID and secret and submit a request to the [POST
|
|
@@ -1379,7 +1304,7 @@ export class Account extends Service {
|
|
|
1379
1304
|
* @throws {AppwriteException}
|
|
1380
1305
|
* @returns {Promise}
|
|
1381
1306
|
*/
|
|
1382
|
-
|
|
1307
|
+
createPhoneToken(userId: string, phone: string): Promise<Models.Token> {
|
|
1383
1308
|
if (typeof userId === 'undefined') {
|
|
1384
1309
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1385
1310
|
}
|
|
@@ -1400,14 +1325,12 @@ export class Account extends Service {
|
|
|
1400
1325
|
}
|
|
1401
1326
|
|
|
1402
1327
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1403
|
-
return
|
|
1328
|
+
return this.client.call('post', uri, {
|
|
1404
1329
|
'content-type': 'application/json',
|
|
1405
1330
|
}, payload);
|
|
1406
1331
|
}
|
|
1407
1332
|
|
|
1408
1333
|
/**
|
|
1409
|
-
* Create email verification
|
|
1410
|
-
*
|
|
1411
1334
|
* Use this endpoint to send a verification message to your user email address
|
|
1412
1335
|
* to confirm they are the valid owners of that address. Both the **userId**
|
|
1413
1336
|
* and **secret** arguments will be passed as query parameters to the URL you
|
|
@@ -1428,7 +1351,7 @@ export class Account extends Service {
|
|
|
1428
1351
|
* @throws {AppwriteException}
|
|
1429
1352
|
* @returns {Promise}
|
|
1430
1353
|
*/
|
|
1431
|
-
|
|
1354
|
+
createVerification(url: string): Promise<Models.Token> {
|
|
1432
1355
|
if (typeof url === 'undefined') {
|
|
1433
1356
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1434
1357
|
}
|
|
@@ -1441,14 +1364,12 @@ export class Account extends Service {
|
|
|
1441
1364
|
}
|
|
1442
1365
|
|
|
1443
1366
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1444
|
-
return
|
|
1367
|
+
return this.client.call('post', uri, {
|
|
1445
1368
|
'content-type': 'application/json',
|
|
1446
1369
|
}, payload);
|
|
1447
1370
|
}
|
|
1448
1371
|
|
|
1449
1372
|
/**
|
|
1450
|
-
* Create email verification (confirmation)
|
|
1451
|
-
*
|
|
1452
1373
|
* Use this endpoint to complete the user email verification process. Use both
|
|
1453
1374
|
* the **userId** and **secret** parameters that were attached to your app URL
|
|
1454
1375
|
* to verify the user email ownership. If confirmed this route will return a
|
|
@@ -1459,7 +1380,7 @@ export class Account extends Service {
|
|
|
1459
1380
|
* @throws {AppwriteException}
|
|
1460
1381
|
* @returns {Promise}
|
|
1461
1382
|
*/
|
|
1462
|
-
|
|
1383
|
+
updateVerification(userId: string, secret: string): Promise<Models.Token> {
|
|
1463
1384
|
if (typeof userId === 'undefined') {
|
|
1464
1385
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1465
1386
|
}
|
|
@@ -1480,14 +1401,12 @@ export class Account extends Service {
|
|
|
1480
1401
|
}
|
|
1481
1402
|
|
|
1482
1403
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1483
|
-
return
|
|
1404
|
+
return this.client.call('put', uri, {
|
|
1484
1405
|
'content-type': 'application/json',
|
|
1485
1406
|
}, payload);
|
|
1486
1407
|
}
|
|
1487
1408
|
|
|
1488
1409
|
/**
|
|
1489
|
-
* Create phone verification
|
|
1490
|
-
*
|
|
1491
1410
|
* Use this endpoint to send a verification SMS to the currently logged in
|
|
1492
1411
|
* user. This endpoint is meant for use after updating a user's phone number
|
|
1493
1412
|
* using the
|
|
@@ -1500,19 +1419,17 @@ export class Account extends Service {
|
|
|
1500
1419
|
* @throws {AppwriteException}
|
|
1501
1420
|
* @returns {Promise}
|
|
1502
1421
|
*/
|
|
1503
|
-
|
|
1422
|
+
createPhoneVerification(): Promise<Models.Token> {
|
|
1504
1423
|
const apiPath = '/account/verification/phone';
|
|
1505
1424
|
const payload: Payload = {};
|
|
1506
1425
|
|
|
1507
1426
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1508
|
-
return
|
|
1427
|
+
return this.client.call('post', uri, {
|
|
1509
1428
|
'content-type': 'application/json',
|
|
1510
1429
|
}, payload);
|
|
1511
1430
|
}
|
|
1512
1431
|
|
|
1513
1432
|
/**
|
|
1514
|
-
* Update phone verification (confirmation)
|
|
1515
|
-
*
|
|
1516
1433
|
* Use this endpoint to complete the user phone verification process. Use the
|
|
1517
1434
|
* **userId** and **secret** that were sent to your user's phone number to
|
|
1518
1435
|
* verify the user email ownership. If confirmed this route will return a 200
|
|
@@ -1523,7 +1440,7 @@ export class Account extends Service {
|
|
|
1523
1440
|
* @throws {AppwriteException}
|
|
1524
1441
|
* @returns {Promise}
|
|
1525
1442
|
*/
|
|
1526
|
-
|
|
1443
|
+
updatePhoneVerification(userId: string, secret: string): Promise<Models.Token> {
|
|
1527
1444
|
if (typeof userId === 'undefined') {
|
|
1528
1445
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1529
1446
|
}
|
|
@@ -1544,7 +1461,7 @@ export class Account extends Service {
|
|
|
1544
1461
|
}
|
|
1545
1462
|
|
|
1546
1463
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1547
|
-
return
|
|
1464
|
+
return this.client.call('put', uri, {
|
|
1548
1465
|
'content-type': 'application/json',
|
|
1549
1466
|
}, payload);
|
|
1550
1467
|
}
|