react-native-appwrite 0.7.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.
@@ -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
- async get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
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 await this.client.call('get', uri, {
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
- async create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
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 await this.client.call('post', uri, {
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
- async updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>> {
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 await this.client.call('patch', uri, {
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
- async listIdentities(queries?: string[]): Promise<Models.IdentityList> {
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 await this.client.call('get', uri, {
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
- async deleteIdentity(identityId: string): Promise<{}> {
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 await this.client.call('delete', uri, {
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
- async createJWT(): Promise<Models.Jwt> {
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 await this.client.call('post', uri, {
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
- async listLogs(queries?: string[]): Promise<Models.LogList> {
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 await this.client.call('get', uri, {
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
- async updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences>> {
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 await this.client.call('patch', uri, {
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
- async createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType> {
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 await this.client.call('post', uri, {
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
- async updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
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 await this.client.call('put', uri, {
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
- async deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> {
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 await this.client.call('delete', uri, {
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
- async createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge> {
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 await this.client.call('post', uri, {
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
- async updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session> {
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 await this.client.call('put', uri, {
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
- async listMfaFactors(): Promise<Models.MfaFactors> {
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 await this.client.call('get', uri, {
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
- async getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
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 await this.client.call('get', uri, {
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
- async createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
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 await this.client.call('post', uri, {
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
- async updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
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 await this.client.call('patch', uri, {
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
- async updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>> {
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 await this.client.call('patch', uri, {
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
- async updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>> {
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 await this.client.call('patch', uri, {
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
- async updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>> {
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 await this.client.call('patch', uri, {
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
- async getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
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 await this.client.call('get', uri, {
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
- async updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.User<Preferences>> {
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 await this.client.call('patch', uri, {
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
- async createRecovery(email: string, url: string): Promise<Models.Token> {
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 await this.client.call('post', uri, {
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
- async updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token> {
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 await this.client.call('put', uri, {
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
- async listSessions(): Promise<Models.SessionList> {
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 await this.client.call('get', uri, {
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
- async deleteSessions(): Promise<{}> {
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 await this.client.call('delete', uri, {
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
- async createAnonymousSession(): Promise<Models.Session> {
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 await this.client.call('post', uri, {
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
- async createEmailPasswordSession(email: string, password: string): Promise<Models.Session> {
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 await this.client.call('post', uri, {
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
- async updateMagicURLSession(userId: string, secret: string): Promise<Models.Session> {
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 await this.client.call('put', uri, {
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
- async updatePhoneSession(userId: string, secret: string): Promise<Models.Session> {
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 await this.client.call('put', uri, {
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
- async createSession(userId: string, secret: string): Promise<Models.Session> {
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 await this.client.call('post', uri, {
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
- async getSession(sessionId: string): Promise<Models.Session> {
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 await this.client.call('get', uri, {
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
- async updateSession(sessionId: string): Promise<Models.Session> {
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 await this.client.call('patch', uri, {
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
- async deleteSession(sessionId: string): Promise<{}> {
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 await this.client.call('delete', uri, {
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,17 @@ export class Account extends Service {
1091
1019
  * @throws {AppwriteException}
1092
1020
  * @returns {Promise}
1093
1021
  */
1094
- async updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
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 await this.client.call('patch', uri, {
1027
+ return this.client.call('patch', uri, {
1100
1028
  'content-type': 'application/json',
1101
1029
  }, payload);
1102
1030
  }
1103
1031
 
1104
1032
  /**
1105
- * Create push target
1106
- *
1107
1033
  * Use this endpoint to register a device for push notifications. Provide a
1108
1034
  * target ID (custom or generated using ID.unique()), a device identifier
1109
1035
  * (usually a device token), and optionally specify which provider should send
@@ -1116,7 +1042,7 @@ export class Account extends Service {
1116
1042
  * @throws {AppwriteException}
1117
1043
  * @returns {Promise}
1118
1044
  */
1119
- async createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target> {
1045
+ createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target> {
1120
1046
  if (typeof targetId === 'undefined') {
1121
1047
  throw new AppwriteException('Missing required parameter: "targetId"');
1122
1048
  }
@@ -1141,14 +1067,12 @@ export class Account extends Service {
1141
1067
  }
1142
1068
 
1143
1069
  const uri = new URL(this.client.config.endpoint + apiPath);
1144
- return await this.client.call('post', uri, {
1070
+ return this.client.call('post', uri, {
1145
1071
  'content-type': 'application/json',
1146
1072
  }, payload);
1147
1073
  }
1148
1074
 
1149
1075
  /**
1150
- * Update push target
1151
- *
1152
1076
  * Update the currently logged in user's push notification target. You can
1153
1077
  * modify the target's identifier (device token) and provider ID (token,
1154
1078
  * email, phone etc.). The target must exist and belong to the current user.
@@ -1160,7 +1084,7 @@ export class Account extends Service {
1160
1084
  * @throws {AppwriteException}
1161
1085
  * @returns {Promise}
1162
1086
  */
1163
- async updatePushTarget(targetId: string, identifier: string): Promise<Models.Target> {
1087
+ updatePushTarget(targetId: string, identifier: string): Promise<Models.Target> {
1164
1088
  if (typeof targetId === 'undefined') {
1165
1089
  throw new AppwriteException('Missing required parameter: "targetId"');
1166
1090
  }
@@ -1177,14 +1101,12 @@ export class Account extends Service {
1177
1101
  }
1178
1102
 
1179
1103
  const uri = new URL(this.client.config.endpoint + apiPath);
1180
- return await this.client.call('put', uri, {
1104
+ return this.client.call('put', uri, {
1181
1105
  'content-type': 'application/json',
1182
1106
  }, payload);
1183
1107
  }
1184
1108
 
1185
1109
  /**
1186
- * Delete push target
1187
- *
1188
1110
  * Delete a push notification target for the currently logged in user. After
1189
1111
  * deletion, the device will no longer receive push notifications. The target
1190
1112
  * must exist and belong to the current user.
@@ -1193,7 +1115,7 @@ export class Account extends Service {
1193
1115
  * @throws {AppwriteException}
1194
1116
  * @returns {Promise}
1195
1117
  */
1196
- async deletePushTarget(targetId: string): Promise<{}> {
1118
+ deletePushTarget(targetId: string): Promise<{}> {
1197
1119
  if (typeof targetId === 'undefined') {
1198
1120
  throw new AppwriteException('Missing required parameter: "targetId"');
1199
1121
  }
@@ -1202,14 +1124,12 @@ export class Account extends Service {
1202
1124
  const payload: Payload = {};
1203
1125
 
1204
1126
  const uri = new URL(this.client.config.endpoint + apiPath);
1205
- return await this.client.call('delete', uri, {
1127
+ return this.client.call('delete', uri, {
1206
1128
  'content-type': 'application/json',
1207
1129
  }, payload);
1208
1130
  }
1209
1131
 
1210
1132
  /**
1211
- * Create email token (OTP)
1212
- *
1213
1133
  * Sends the user an email with a secret key for creating a session. If the
1214
1134
  * provided user ID has not be registered, a new user will be created. Use the
1215
1135
  * returned user ID and secret and submit a request to the [POST
@@ -1227,7 +1147,7 @@ export class Account extends Service {
1227
1147
  * @throws {AppwriteException}
1228
1148
  * @returns {Promise}
1229
1149
  */
1230
- async createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token> {
1150
+ createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token> {
1231
1151
  if (typeof userId === 'undefined') {
1232
1152
  throw new AppwriteException('Missing required parameter: "userId"');
1233
1153
  }
@@ -1252,14 +1172,12 @@ export class Account extends Service {
1252
1172
  }
1253
1173
 
1254
1174
  const uri = new URL(this.client.config.endpoint + apiPath);
1255
- return await this.client.call('post', uri, {
1175
+ return this.client.call('post', uri, {
1256
1176
  'content-type': 'application/json',
1257
1177
  }, payload);
1258
1178
  }
1259
1179
 
1260
1180
  /**
1261
- * Create magic URL token
1262
- *
1263
1181
  * Sends the user an email with a secret key for creating a session. If the
1264
1182
  * provided user ID has not been registered, a new user will be created. When
1265
1183
  * the user clicks the link in the email, the user is redirected back to the
@@ -1282,7 +1200,7 @@ export class Account extends Service {
1282
1200
  * @throws {AppwriteException}
1283
1201
  * @returns {Promise}
1284
1202
  */
1285
- async createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token> {
1203
+ createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token> {
1286
1204
  if (typeof userId === 'undefined') {
1287
1205
  throw new AppwriteException('Missing required parameter: "userId"');
1288
1206
  }
@@ -1311,14 +1229,12 @@ export class Account extends Service {
1311
1229
  }
1312
1230
 
1313
1231
  const uri = new URL(this.client.config.endpoint + apiPath);
1314
- return await this.client.call('post', uri, {
1232
+ return this.client.call('post', uri, {
1315
1233
  'content-type': 'application/json',
1316
1234
  }, payload);
1317
1235
  }
1318
1236
 
1319
1237
  /**
1320
- * Create OAuth2 token
1321
- *
1322
1238
  * Allow the user to login to their account using the OAuth2 provider of their
1323
1239
  * choice. Each OAuth2 provider should be enabled from the Appwrite console
1324
1240
  * first. Use the success and failure arguments to provide a redirect URL's
@@ -1372,8 +1288,6 @@ export class Account extends Service {
1372
1288
  }
1373
1289
 
1374
1290
  /**
1375
- * Create phone token
1376
- *
1377
1291
  * Sends the user an SMS with a secret key for creating a session. If the
1378
1292
  * provided user ID has not be registered, a new user will be created. Use the
1379
1293
  * returned user ID and secret and submit a request to the [POST
@@ -1390,7 +1304,7 @@ export class Account extends Service {
1390
1304
  * @throws {AppwriteException}
1391
1305
  * @returns {Promise}
1392
1306
  */
1393
- async createPhoneToken(userId: string, phone: string): Promise<Models.Token> {
1307
+ createPhoneToken(userId: string, phone: string): Promise<Models.Token> {
1394
1308
  if (typeof userId === 'undefined') {
1395
1309
  throw new AppwriteException('Missing required parameter: "userId"');
1396
1310
  }
@@ -1411,14 +1325,12 @@ export class Account extends Service {
1411
1325
  }
1412
1326
 
1413
1327
  const uri = new URL(this.client.config.endpoint + apiPath);
1414
- return await this.client.call('post', uri, {
1328
+ return this.client.call('post', uri, {
1415
1329
  'content-type': 'application/json',
1416
1330
  }, payload);
1417
1331
  }
1418
1332
 
1419
1333
  /**
1420
- * Create email verification
1421
- *
1422
1334
  * Use this endpoint to send a verification message to your user email address
1423
1335
  * to confirm they are the valid owners of that address. Both the **userId**
1424
1336
  * and **secret** arguments will be passed as query parameters to the URL you
@@ -1439,7 +1351,7 @@ export class Account extends Service {
1439
1351
  * @throws {AppwriteException}
1440
1352
  * @returns {Promise}
1441
1353
  */
1442
- async createVerification(url: string): Promise<Models.Token> {
1354
+ createVerification(url: string): Promise<Models.Token> {
1443
1355
  if (typeof url === 'undefined') {
1444
1356
  throw new AppwriteException('Missing required parameter: "url"');
1445
1357
  }
@@ -1452,14 +1364,12 @@ export class Account extends Service {
1452
1364
  }
1453
1365
 
1454
1366
  const uri = new URL(this.client.config.endpoint + apiPath);
1455
- return await this.client.call('post', uri, {
1367
+ return this.client.call('post', uri, {
1456
1368
  'content-type': 'application/json',
1457
1369
  }, payload);
1458
1370
  }
1459
1371
 
1460
1372
  /**
1461
- * Create email verification (confirmation)
1462
- *
1463
1373
  * Use this endpoint to complete the user email verification process. Use both
1464
1374
  * the **userId** and **secret** parameters that were attached to your app URL
1465
1375
  * to verify the user email ownership. If confirmed this route will return a
@@ -1470,7 +1380,7 @@ export class Account extends Service {
1470
1380
  * @throws {AppwriteException}
1471
1381
  * @returns {Promise}
1472
1382
  */
1473
- async updateVerification(userId: string, secret: string): Promise<Models.Token> {
1383
+ updateVerification(userId: string, secret: string): Promise<Models.Token> {
1474
1384
  if (typeof userId === 'undefined') {
1475
1385
  throw new AppwriteException('Missing required parameter: "userId"');
1476
1386
  }
@@ -1491,14 +1401,12 @@ export class Account extends Service {
1491
1401
  }
1492
1402
 
1493
1403
  const uri = new URL(this.client.config.endpoint + apiPath);
1494
- return await this.client.call('put', uri, {
1404
+ return this.client.call('put', uri, {
1495
1405
  'content-type': 'application/json',
1496
1406
  }, payload);
1497
1407
  }
1498
1408
 
1499
1409
  /**
1500
- * Create phone verification
1501
- *
1502
1410
  * Use this endpoint to send a verification SMS to the currently logged in
1503
1411
  * user. This endpoint is meant for use after updating a user's phone number
1504
1412
  * using the
@@ -1511,19 +1419,17 @@ export class Account extends Service {
1511
1419
  * @throws {AppwriteException}
1512
1420
  * @returns {Promise}
1513
1421
  */
1514
- async createPhoneVerification(): Promise<Models.Token> {
1422
+ createPhoneVerification(): Promise<Models.Token> {
1515
1423
  const apiPath = '/account/verification/phone';
1516
1424
  const payload: Payload = {};
1517
1425
 
1518
1426
  const uri = new URL(this.client.config.endpoint + apiPath);
1519
- return await this.client.call('post', uri, {
1427
+ return this.client.call('post', uri, {
1520
1428
  'content-type': 'application/json',
1521
1429
  }, payload);
1522
1430
  }
1523
1431
 
1524
1432
  /**
1525
- * Update phone verification (confirmation)
1526
- *
1527
1433
  * Use this endpoint to complete the user phone verification process. Use the
1528
1434
  * **userId** and **secret** that were sent to your user's phone number to
1529
1435
  * verify the user email ownership. If confirmed this route will return a 200
@@ -1534,7 +1440,7 @@ export class Account extends Service {
1534
1440
  * @throws {AppwriteException}
1535
1441
  * @returns {Promise}
1536
1442
  */
1537
- async updatePhoneVerification(userId: string, secret: string): Promise<Models.Token> {
1443
+ updatePhoneVerification(userId: string, secret: string): Promise<Models.Token> {
1538
1444
  if (typeof userId === 'undefined') {
1539
1445
  throw new AppwriteException('Missing required parameter: "userId"');
1540
1446
  }
@@ -1555,7 +1461,7 @@ export class Account extends Service {
1555
1461
  }
1556
1462
 
1557
1463
  const uri = new URL(this.client.config.endpoint + apiPath);
1558
- return await this.client.call('put', uri, {
1464
+ return this.client.call('put', uri, {
1559
1465
  'content-type': 'application/json',
1560
1466
  }, payload);
1561
1467
  }