node-appwrite 17.2.0 → 18.0.0

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.
Files changed (108) hide show
  1. package/README.md +67 -2
  2. package/dist/client.js +3 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +3 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/{v-c-s-deployment-type.js → vcs-deployment-type.js} +1 -1
  7. package/dist/enums/vcs-deployment-type.js.map +1 -0
  8. package/dist/enums/{v-c-s-deployment-type.mjs → vcs-deployment-type.mjs} +2 -2
  9. package/dist/enums/vcs-deployment-type.mjs.map +1 -0
  10. package/dist/index.d.mts +2 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +7 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +2 -1
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/models.d.mts +717 -58
  17. package/dist/models.d.ts +717 -58
  18. package/dist/query.d.mts +70 -0
  19. package/dist/query.d.ts +70 -0
  20. package/dist/query.js +70 -0
  21. package/dist/query.js.map +1 -1
  22. package/dist/query.mjs +70 -0
  23. package/dist/query.mjs.map +1 -1
  24. package/dist/services/account.d.mts +625 -70
  25. package/dist/services/account.d.ts +625 -70
  26. package/dist/services/account.js +592 -292
  27. package/dist/services/account.js.map +1 -1
  28. package/dist/services/account.mjs +592 -292
  29. package/dist/services/account.mjs.map +1 -1
  30. package/dist/services/avatars.d.mts +157 -26
  31. package/dist/services/avatars.d.ts +157 -26
  32. package/dist/services/avatars.js +104 -93
  33. package/dist/services/avatars.js.map +1 -1
  34. package/dist/services/avatars.mjs +104 -93
  35. package/dist/services/avatars.mjs.map +1 -1
  36. package/dist/services/databases.d.mts +1224 -248
  37. package/dist/services/databases.d.ts +1224 -248
  38. package/dist/services/databases.js +877 -611
  39. package/dist/services/databases.js.map +1 -1
  40. package/dist/services/databases.mjs +877 -611
  41. package/dist/services/databases.mjs.map +1 -1
  42. package/dist/services/functions.d.mts +530 -107
  43. package/dist/services/functions.d.ts +530 -107
  44. package/dist/services/functions.js +393 -276
  45. package/dist/services/functions.js.map +1 -1
  46. package/dist/services/functions.mjs +393 -276
  47. package/dist/services/functions.mjs.map +1 -1
  48. package/dist/services/graphql.d.mts +24 -2
  49. package/dist/services/graphql.d.ts +24 -2
  50. package/dist/services/graphql.js +20 -16
  51. package/dist/services/graphql.js.map +1 -1
  52. package/dist/services/graphql.mjs +20 -16
  53. package/dist/services/graphql.mjs.map +1 -1
  54. package/dist/services/health.d.mts +175 -16
  55. package/dist/services/health.d.ts +175 -16
  56. package/dist/services/health.js +144 -115
  57. package/dist/services/health.js.map +1 -1
  58. package/dist/services/health.mjs +144 -115
  59. package/dist/services/health.mjs.map +1 -1
  60. package/dist/services/locale.js.map +1 -1
  61. package/dist/services/locale.mjs.map +1 -1
  62. package/dist/services/messaging.d.mts +1544 -262
  63. package/dist/services/messaging.d.ts +1544 -262
  64. package/dist/services/messaging.js +1417 -592
  65. package/dist/services/messaging.js.map +1 -1
  66. package/dist/services/messaging.mjs +1417 -592
  67. package/dist/services/messaging.mjs.map +1 -1
  68. package/dist/services/sites.d.mts +495 -99
  69. package/dist/services/sites.d.ts +495 -99
  70. package/dist/services/sites.js +371 -258
  71. package/dist/services/sites.js.map +1 -1
  72. package/dist/services/sites.mjs +371 -258
  73. package/dist/services/sites.mjs.map +1 -1
  74. package/dist/services/storage.d.mts +306 -63
  75. package/dist/services/storage.d.ts +306 -63
  76. package/dist/services/storage.js +225 -158
  77. package/dist/services/storage.js.map +1 -1
  78. package/dist/services/storage.mjs +225 -158
  79. package/dist/services/storage.mjs.map +1 -1
  80. package/dist/services/tables-db.d.mts +1549 -0
  81. package/dist/services/tables-db.d.ts +1549 -0
  82. package/dist/services/tables-db.js +2374 -0
  83. package/dist/services/tables-db.js.map +1 -0
  84. package/dist/services/tables-db.mjs +2373 -0
  85. package/dist/services/tables-db.mjs.map +1 -0
  86. package/dist/services/teams.d.mts +233 -39
  87. package/dist/services/teams.d.ts +233 -39
  88. package/dist/services/teams.js +170 -135
  89. package/dist/services/teams.js.map +1 -1
  90. package/dist/services/teams.mjs +170 -135
  91. package/dist/services/teams.mjs.map +1 -1
  92. package/dist/services/tokens.d.mts +76 -11
  93. package/dist/services/tokens.d.ts +76 -11
  94. package/dist/services/tokens.js +60 -45
  95. package/dist/services/tokens.js.map +1 -1
  96. package/dist/services/tokens.mjs +60 -45
  97. package/dist/services/tokens.mjs.map +1 -1
  98. package/dist/services/users.d.mts +842 -115
  99. package/dist/services/users.d.ts +842 -115
  100. package/dist/services/users.js +719 -408
  101. package/dist/services/users.js.map +1 -1
  102. package/dist/services/users.mjs +719 -408
  103. package/dist/services/users.mjs.map +1 -1
  104. package/package.json +1 -1
  105. package/dist/enums/v-c-s-deployment-type.js.map +0 -1
  106. package/dist/enums/v-c-s-deployment-type.mjs.map +0 -1
  107. /package/dist/enums/{v-c-s-deployment-type.d.mts → vcs-deployment-type.d.mts} +0 -0
  108. /package/dist/enums/{v-c-s-deployment-type.d.ts → vcs-deployment-type.d.ts} +0 -0
@@ -24,17 +24,22 @@ class Account {
24
24
  payload
25
25
  );
26
26
  }
27
- /**
28
- * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
29
- *
30
- * @param {string} userId
31
- * @param {string} email
32
- * @param {string} password
33
- * @param {string} name
34
- * @throws {AppwriteException}
35
- * @returns {Promise<Models.User<Preferences>>}
36
- */
37
- create(userId, email, password, name) {
27
+ create(paramsOrFirst, ...rest) {
28
+ let params;
29
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
30
+ params = paramsOrFirst || {};
31
+ } else {
32
+ params = {
33
+ userId: paramsOrFirst,
34
+ email: rest[0],
35
+ password: rest[1],
36
+ name: rest[2]
37
+ };
38
+ }
39
+ const userId = params.userId;
40
+ const email = params.email;
41
+ const password = params.password;
42
+ const name = params.name;
38
43
  if (typeof userId === "undefined") {
39
44
  throw new client.AppwriteException('Missing required parameter: "userId"');
40
45
  }
@@ -69,17 +74,18 @@ class Account {
69
74
  payload
70
75
  );
71
76
  }
72
- /**
73
- * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
74
- * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
75
- *
76
- *
77
- * @param {string} email
78
- * @param {string} password
79
- * @throws {AppwriteException}
80
- * @returns {Promise<Models.User<Preferences>>}
81
- */
82
- updateEmail(email, password) {
77
+ updateEmail(paramsOrFirst, ...rest) {
78
+ let params;
79
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
80
+ params = paramsOrFirst || {};
81
+ } else {
82
+ params = {
83
+ email: paramsOrFirst,
84
+ password: rest[0]
85
+ };
86
+ }
87
+ const email = params.email;
88
+ const password = params.password;
83
89
  if (typeof email === "undefined") {
84
90
  throw new client.AppwriteException('Missing required parameter: "email"');
85
91
  }
@@ -105,14 +111,16 @@ class Account {
105
111
  payload
106
112
  );
107
113
  }
108
- /**
109
- * Get the list of identities for the currently logged in user.
110
- *
111
- * @param {string[]} queries
112
- * @throws {AppwriteException}
113
- * @returns {Promise<Models.IdentityList>}
114
- */
115
- listIdentities(queries) {
114
+ listIdentities(paramsOrFirst) {
115
+ let params;
116
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
117
+ params = paramsOrFirst || {};
118
+ } else {
119
+ params = {
120
+ queries: paramsOrFirst
121
+ };
122
+ }
123
+ const queries = params.queries;
116
124
  const apiPath = "/account/identities";
117
125
  const payload = {};
118
126
  if (typeof queries !== "undefined") {
@@ -127,14 +135,16 @@ class Account {
127
135
  payload
128
136
  );
129
137
  }
130
- /**
131
- * Delete an identity by its unique ID.
132
- *
133
- * @param {string} identityId
134
- * @throws {AppwriteException}
135
- * @returns {Promise<{}>}
136
- */
137
- deleteIdentity(identityId) {
138
+ deleteIdentity(paramsOrFirst) {
139
+ let params;
140
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
141
+ params = paramsOrFirst || {};
142
+ } else {
143
+ params = {
144
+ identityId: paramsOrFirst
145
+ };
146
+ }
147
+ const identityId = params.identityId;
138
148
  if (typeof identityId === "undefined") {
139
149
  throw new client.AppwriteException('Missing required parameter: "identityId"');
140
150
  }
@@ -171,14 +181,16 @@ class Account {
171
181
  payload
172
182
  );
173
183
  }
174
- /**
175
- * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
176
- *
177
- * @param {string[]} queries
178
- * @throws {AppwriteException}
179
- * @returns {Promise<Models.LogList>}
180
- */
181
- listLogs(queries) {
184
+ listLogs(paramsOrFirst) {
185
+ let params;
186
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
187
+ params = paramsOrFirst || {};
188
+ } else {
189
+ params = {
190
+ queries: paramsOrFirst
191
+ };
192
+ }
193
+ const queries = params.queries;
182
194
  const apiPath = "/account/logs";
183
195
  const payload = {};
184
196
  if (typeof queries !== "undefined") {
@@ -193,14 +205,16 @@ class Account {
193
205
  payload
194
206
  );
195
207
  }
196
- /**
197
- * Enable or disable MFA on an account.
198
- *
199
- * @param {boolean} mfa
200
- * @throws {AppwriteException}
201
- * @returns {Promise<Models.User<Preferences>>}
202
- */
203
- updateMFA(mfa) {
208
+ updateMFA(paramsOrFirst) {
209
+ let params;
210
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
211
+ params = paramsOrFirst || {};
212
+ } else {
213
+ params = {
214
+ mfa: paramsOrFirst
215
+ };
216
+ }
217
+ const mfa = params.mfa;
204
218
  if (typeof mfa === "undefined") {
205
219
  throw new client.AppwriteException('Missing required parameter: "mfa"');
206
220
  }
@@ -220,14 +234,16 @@ class Account {
220
234
  payload
221
235
  );
222
236
  }
223
- /**
224
- * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
225
- *
226
- * @param {AuthenticatorType} type
227
- * @throws {AppwriteException}
228
- * @returns {Promise<Models.MfaType>}
229
- */
230
- createMfaAuthenticator(type) {
237
+ createMfaAuthenticator(paramsOrFirst) {
238
+ let params;
239
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "type" in paramsOrFirst) {
240
+ params = paramsOrFirst || {};
241
+ } else {
242
+ params = {
243
+ type: paramsOrFirst
244
+ };
245
+ }
246
+ const type = params.type;
231
247
  if (typeof type === "undefined") {
232
248
  throw new client.AppwriteException('Missing required parameter: "type"');
233
249
  }
@@ -244,15 +260,44 @@ class Account {
244
260
  payload
245
261
  );
246
262
  }
247
- /**
248
- * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
249
- *
250
- * @param {AuthenticatorType} type
251
- * @param {string} otp
252
- * @throws {AppwriteException}
253
- * @returns {Promise<Models.User<Preferences>>}
254
- */
255
- updateMfaAuthenticator(type, otp) {
263
+ createMFAAuthenticator(paramsOrFirst) {
264
+ let params;
265
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "type" in paramsOrFirst) {
266
+ params = paramsOrFirst || {};
267
+ } else {
268
+ params = {
269
+ type: paramsOrFirst
270
+ };
271
+ }
272
+ const type = params.type;
273
+ if (typeof type === "undefined") {
274
+ throw new client.AppwriteException('Missing required parameter: "type"');
275
+ }
276
+ const apiPath = "/account/mfa/authenticators/{type}".replace("{type}", type);
277
+ const payload = {};
278
+ const uri = new URL(this.client.config.endpoint + apiPath);
279
+ const apiHeaders = {
280
+ "content-type": "application/json"
281
+ };
282
+ return this.client.call(
283
+ "post",
284
+ uri,
285
+ apiHeaders,
286
+ payload
287
+ );
288
+ }
289
+ updateMfaAuthenticator(paramsOrFirst, ...rest) {
290
+ let params;
291
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "type" in paramsOrFirst) {
292
+ params = paramsOrFirst || {};
293
+ } else {
294
+ params = {
295
+ type: paramsOrFirst,
296
+ otp: rest[0]
297
+ };
298
+ }
299
+ const type = params.type;
300
+ const otp = params.otp;
256
301
  if (typeof type === "undefined") {
257
302
  throw new client.AppwriteException('Missing required parameter: "type"');
258
303
  }
@@ -275,14 +320,50 @@ class Account {
275
320
  payload
276
321
  );
277
322
  }
278
- /**
279
- * Delete an authenticator for a user by ID.
280
- *
281
- * @param {AuthenticatorType} type
282
- * @throws {AppwriteException}
283
- * @returns {Promise<{}>}
284
- */
285
- deleteMfaAuthenticator(type) {
323
+ updateMFAAuthenticator(paramsOrFirst, ...rest) {
324
+ let params;
325
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "type" in paramsOrFirst) {
326
+ params = paramsOrFirst || {};
327
+ } else {
328
+ params = {
329
+ type: paramsOrFirst,
330
+ otp: rest[0]
331
+ };
332
+ }
333
+ const type = params.type;
334
+ const otp = params.otp;
335
+ if (typeof type === "undefined") {
336
+ throw new client.AppwriteException('Missing required parameter: "type"');
337
+ }
338
+ if (typeof otp === "undefined") {
339
+ throw new client.AppwriteException('Missing required parameter: "otp"');
340
+ }
341
+ const apiPath = "/account/mfa/authenticators/{type}".replace("{type}", type);
342
+ const payload = {};
343
+ if (typeof otp !== "undefined") {
344
+ payload["otp"] = otp;
345
+ }
346
+ const uri = new URL(this.client.config.endpoint + apiPath);
347
+ const apiHeaders = {
348
+ "content-type": "application/json"
349
+ };
350
+ return this.client.call(
351
+ "put",
352
+ uri,
353
+ apiHeaders,
354
+ payload
355
+ );
356
+ }
357
+ deleteMfaAuthenticator(paramsOrFirst) {
358
+ let params;
359
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "type" in paramsOrFirst) {
360
+ params = paramsOrFirst || {};
361
+ } else {
362
+ params = {
363
+ type: paramsOrFirst
364
+ };
365
+ }
366
+ const type = params.type;
286
367
  if (typeof type === "undefined") {
287
368
  throw new client.AppwriteException('Missing required parameter: "type"');
288
369
  }
@@ -299,14 +380,42 @@ class Account {
299
380
  payload
300
381
  );
301
382
  }
302
- /**
303
- * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
304
- *
305
- * @param {AuthenticationFactor} factor
306
- * @throws {AppwriteException}
307
- * @returns {Promise<Models.MfaChallenge>}
308
- */
309
- createMfaChallenge(factor) {
383
+ deleteMFAAuthenticator(paramsOrFirst) {
384
+ let params;
385
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "type" in paramsOrFirst) {
386
+ params = paramsOrFirst || {};
387
+ } else {
388
+ params = {
389
+ type: paramsOrFirst
390
+ };
391
+ }
392
+ const type = params.type;
393
+ if (typeof type === "undefined") {
394
+ throw new client.AppwriteException('Missing required parameter: "type"');
395
+ }
396
+ const apiPath = "/account/mfa/authenticators/{type}".replace("{type}", type);
397
+ const payload = {};
398
+ const uri = new URL(this.client.config.endpoint + apiPath);
399
+ const apiHeaders = {
400
+ "content-type": "application/json"
401
+ };
402
+ return this.client.call(
403
+ "delete",
404
+ uri,
405
+ apiHeaders,
406
+ payload
407
+ );
408
+ }
409
+ createMfaChallenge(paramsOrFirst) {
410
+ let params;
411
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "factor" in paramsOrFirst) {
412
+ params = paramsOrFirst || {};
413
+ } else {
414
+ params = {
415
+ factor: paramsOrFirst
416
+ };
417
+ }
418
+ const factor = params.factor;
310
419
  if (typeof factor === "undefined") {
311
420
  throw new client.AppwriteException('Missing required parameter: "factor"');
312
421
  }
@@ -326,15 +435,84 @@ class Account {
326
435
  payload
327
436
  );
328
437
  }
329
- /**
330
- * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
331
- *
332
- * @param {string} challengeId
333
- * @param {string} otp
334
- * @throws {AppwriteException}
335
- * @returns {Promise<Models.Session>}
336
- */
337
- updateMfaChallenge(challengeId, otp) {
438
+ createMFAChallenge(paramsOrFirst) {
439
+ let params;
440
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "factor" in paramsOrFirst) {
441
+ params = paramsOrFirst || {};
442
+ } else {
443
+ params = {
444
+ factor: paramsOrFirst
445
+ };
446
+ }
447
+ const factor = params.factor;
448
+ if (typeof factor === "undefined") {
449
+ throw new client.AppwriteException('Missing required parameter: "factor"');
450
+ }
451
+ const apiPath = "/account/mfa/challenge";
452
+ const payload = {};
453
+ if (typeof factor !== "undefined") {
454
+ payload["factor"] = factor;
455
+ }
456
+ const uri = new URL(this.client.config.endpoint + apiPath);
457
+ const apiHeaders = {
458
+ "content-type": "application/json"
459
+ };
460
+ return this.client.call(
461
+ "post",
462
+ uri,
463
+ apiHeaders,
464
+ payload
465
+ );
466
+ }
467
+ updateMfaChallenge(paramsOrFirst, ...rest) {
468
+ let params;
469
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
470
+ params = paramsOrFirst || {};
471
+ } else {
472
+ params = {
473
+ challengeId: paramsOrFirst,
474
+ otp: rest[0]
475
+ };
476
+ }
477
+ const challengeId = params.challengeId;
478
+ const otp = params.otp;
479
+ if (typeof challengeId === "undefined") {
480
+ throw new client.AppwriteException('Missing required parameter: "challengeId"');
481
+ }
482
+ if (typeof otp === "undefined") {
483
+ throw new client.AppwriteException('Missing required parameter: "otp"');
484
+ }
485
+ const apiPath = "/account/mfa/challenge";
486
+ const payload = {};
487
+ if (typeof challengeId !== "undefined") {
488
+ payload["challengeId"] = challengeId;
489
+ }
490
+ if (typeof otp !== "undefined") {
491
+ payload["otp"] = otp;
492
+ }
493
+ const uri = new URL(this.client.config.endpoint + apiPath);
494
+ const apiHeaders = {
495
+ "content-type": "application/json"
496
+ };
497
+ return this.client.call(
498
+ "put",
499
+ uri,
500
+ apiHeaders,
501
+ payload
502
+ );
503
+ }
504
+ updateMFAChallenge(paramsOrFirst, ...rest) {
505
+ let params;
506
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
507
+ params = paramsOrFirst || {};
508
+ } else {
509
+ params = {
510
+ challengeId: paramsOrFirst,
511
+ otp: rest[0]
512
+ };
513
+ }
514
+ const challengeId = params.challengeId;
515
+ const otp = params.otp;
338
516
  if (typeof challengeId === "undefined") {
339
517
  throw new client.AppwriteException('Missing required parameter: "challengeId"');
340
518
  }
@@ -365,6 +543,7 @@ class Account {
365
543
  *
366
544
  * @throws {AppwriteException}
367
545
  * @returns {Promise<Models.MfaFactors>}
546
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
368
547
  */
369
548
  listMfaFactors() {
370
549
  const apiPath = "/account/mfa/factors";
@@ -378,11 +557,30 @@ class Account {
378
557
  payload
379
558
  );
380
559
  }
560
+ /**
561
+ * List the factors available on the account to be used as a MFA challange.
562
+ *
563
+ * @throws {AppwriteException}
564
+ * @returns {Promise<Models.MfaFactors>}
565
+ */
566
+ listMFAFactors() {
567
+ const apiPath = "/account/mfa/factors";
568
+ const payload = {};
569
+ const uri = new URL(this.client.config.endpoint + apiPath);
570
+ const apiHeaders = {};
571
+ return this.client.call(
572
+ "get",
573
+ uri,
574
+ apiHeaders,
575
+ payload
576
+ );
577
+ }
381
578
  /**
382
579
  * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
383
580
  *
384
581
  * @throws {AppwriteException}
385
582
  * @returns {Promise<Models.MfaRecoveryCodes>}
583
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
386
584
  */
387
585
  getMfaRecoveryCodes() {
388
586
  const apiPath = "/account/mfa/recovery-codes";
@@ -397,11 +595,30 @@ class Account {
397
595
  );
398
596
  }
399
597
  /**
400
- * Generate recovery codes as backup for MFA flow. It&#039;s recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
598
+ * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
401
599
  *
402
600
  * @throws {AppwriteException}
403
601
  * @returns {Promise<Models.MfaRecoveryCodes>}
404
602
  */
603
+ getMFARecoveryCodes() {
604
+ const apiPath = "/account/mfa/recovery-codes";
605
+ const payload = {};
606
+ const uri = new URL(this.client.config.endpoint + apiPath);
607
+ const apiHeaders = {};
608
+ return this.client.call(
609
+ "get",
610
+ uri,
611
+ apiHeaders,
612
+ payload
613
+ );
614
+ }
615
+ /**
616
+ * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
617
+ *
618
+ * @throws {AppwriteException}
619
+ * @returns {Promise<Models.MfaRecoveryCodes>}
620
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
621
+ */
405
622
  createMfaRecoveryCodes() {
406
623
  const apiPath = "/account/mfa/recovery-codes";
407
624
  const payload = {};
@@ -416,11 +633,32 @@ class Account {
416
633
  payload
417
634
  );
418
635
  }
636
+ /**
637
+ * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
638
+ *
639
+ * @throws {AppwriteException}
640
+ * @returns {Promise<Models.MfaRecoveryCodes>}
641
+ */
642
+ createMFARecoveryCodes() {
643
+ const apiPath = "/account/mfa/recovery-codes";
644
+ const payload = {};
645
+ const uri = new URL(this.client.config.endpoint + apiPath);
646
+ const apiHeaders = {
647
+ "content-type": "application/json"
648
+ };
649
+ return this.client.call(
650
+ "post",
651
+ uri,
652
+ apiHeaders,
653
+ payload
654
+ );
655
+ }
419
656
  /**
420
657
  * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
421
658
  *
422
659
  * @throws {AppwriteException}
423
660
  * @returns {Promise<Models.MfaRecoveryCodes>}
661
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
424
662
  */
425
663
  updateMfaRecoveryCodes() {
426
664
  const apiPath = "/account/mfa/recovery-codes";
@@ -437,13 +675,35 @@ class Account {
437
675
  );
438
676
  }
439
677
  /**
440
- * Update currently logged in user account name.
678
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
441
679
  *
442
- * @param {string} name
443
680
  * @throws {AppwriteException}
444
- * @returns {Promise<Models.User<Preferences>>}
681
+ * @returns {Promise<Models.MfaRecoveryCodes>}
445
682
  */
446
- updateName(name) {
683
+ updateMFARecoveryCodes() {
684
+ const apiPath = "/account/mfa/recovery-codes";
685
+ const payload = {};
686
+ const uri = new URL(this.client.config.endpoint + apiPath);
687
+ const apiHeaders = {
688
+ "content-type": "application/json"
689
+ };
690
+ return this.client.call(
691
+ "patch",
692
+ uri,
693
+ apiHeaders,
694
+ payload
695
+ );
696
+ }
697
+ updateName(paramsOrFirst) {
698
+ let params;
699
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
700
+ params = paramsOrFirst || {};
701
+ } else {
702
+ params = {
703
+ name: paramsOrFirst
704
+ };
705
+ }
706
+ const name = params.name;
447
707
  if (typeof name === "undefined") {
448
708
  throw new client.AppwriteException('Missing required parameter: "name"');
449
709
  }
@@ -463,15 +723,18 @@ class Account {
463
723
  payload
464
724
  );
465
725
  }
466
- /**
467
- * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
468
- *
469
- * @param {string} password
470
- * @param {string} oldPassword
471
- * @throws {AppwriteException}
472
- * @returns {Promise<Models.User<Preferences>>}
473
- */
474
- updatePassword(password, oldPassword) {
726
+ updatePassword(paramsOrFirst, ...rest) {
727
+ let params;
728
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
729
+ params = paramsOrFirst || {};
730
+ } else {
731
+ params = {
732
+ password: paramsOrFirst,
733
+ oldPassword: rest[0]
734
+ };
735
+ }
736
+ const password = params.password;
737
+ const oldPassword = params.oldPassword;
475
738
  if (typeof password === "undefined") {
476
739
  throw new client.AppwriteException('Missing required parameter: "password"');
477
740
  }
@@ -494,15 +757,18 @@ class Account {
494
757
  payload
495
758
  );
496
759
  }
497
- /**
498
- * Update the currently logged in user&#039;s phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
499
- *
500
- * @param {string} phone
501
- * @param {string} password
502
- * @throws {AppwriteException}
503
- * @returns {Promise<Models.User<Preferences>>}
504
- */
505
- updatePhone(phone, password) {
760
+ updatePhone(paramsOrFirst, ...rest) {
761
+ let params;
762
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
763
+ params = paramsOrFirst || {};
764
+ } else {
765
+ params = {
766
+ phone: paramsOrFirst,
767
+ password: rest[0]
768
+ };
769
+ }
770
+ const phone = params.phone;
771
+ const password = params.password;
506
772
  if (typeof phone === "undefined") {
507
773
  throw new client.AppwriteException('Missing required parameter: "phone"');
508
774
  }
@@ -546,14 +812,16 @@ class Account {
546
812
  payload
547
813
  );
548
814
  }
549
- /**
550
- * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
551
- *
552
- * @param {Partial<Preferences>} prefs
553
- * @throws {AppwriteException}
554
- * @returns {Promise<Models.User<Preferences>>}
555
- */
556
- updatePrefs(prefs) {
815
+ updatePrefs(paramsOrFirst) {
816
+ let params;
817
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "prefs" in paramsOrFirst) {
818
+ params = paramsOrFirst || {};
819
+ } else {
820
+ params = {
821
+ prefs: paramsOrFirst
822
+ };
823
+ }
824
+ const prefs = params.prefs;
557
825
  if (typeof prefs === "undefined") {
558
826
  throw new client.AppwriteException('Missing required parameter: "prefs"');
559
827
  }
@@ -573,15 +841,18 @@ class Account {
573
841
  payload
574
842
  );
575
843
  }
576
- /**
577
- * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user&#039;s email address is valid for 1 hour.
578
- *
579
- * @param {string} email
580
- * @param {string} url
581
- * @throws {AppwriteException}
582
- * @returns {Promise<Models.Token>}
583
- */
584
- createRecovery(email, url) {
844
+ createRecovery(paramsOrFirst, ...rest) {
845
+ let params;
846
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
847
+ params = paramsOrFirst || {};
848
+ } else {
849
+ params = {
850
+ email: paramsOrFirst,
851
+ url: rest[0]
852
+ };
853
+ }
854
+ const email = params.email;
855
+ const url = params.url;
585
856
  if (typeof email === "undefined") {
586
857
  throw new client.AppwriteException('Missing required parameter: "email"');
587
858
  }
@@ -607,18 +878,20 @@ class Account {
607
878
  payload
608
879
  );
609
880
  }
610
- /**
611
- * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
612
- *
613
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
614
- *
615
- * @param {string} userId
616
- * @param {string} secret
617
- * @param {string} password
618
- * @throws {AppwriteException}
619
- * @returns {Promise<Models.Token>}
620
- */
621
- updateRecovery(userId, secret, password) {
881
+ updateRecovery(paramsOrFirst, ...rest) {
882
+ let params;
883
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
884
+ params = paramsOrFirst || {};
885
+ } else {
886
+ params = {
887
+ userId: paramsOrFirst,
888
+ secret: rest[0],
889
+ password: rest[1]
890
+ };
891
+ }
892
+ const userId = params.userId;
893
+ const secret = params.secret;
894
+ const password = params.password;
622
895
  if (typeof userId === "undefined") {
623
896
  throw new client.AppwriteException('Missing required parameter: "userId"');
624
897
  }
@@ -708,17 +981,18 @@ class Account {
708
981
  payload
709
982
  );
710
983
  }
711
- /**
712
- * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
713
- *
714
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
715
- *
716
- * @param {string} email
717
- * @param {string} password
718
- * @throws {AppwriteException}
719
- * @returns {Promise<Models.Session>}
720
- */
721
- createEmailPasswordSession(email, password) {
984
+ createEmailPasswordSession(paramsOrFirst, ...rest) {
985
+ let params;
986
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
987
+ params = paramsOrFirst || {};
988
+ } else {
989
+ params = {
990
+ email: paramsOrFirst,
991
+ password: rest[0]
992
+ };
993
+ }
994
+ const email = params.email;
995
+ const password = params.password;
722
996
  if (typeof email === "undefined") {
723
997
  throw new client.AppwriteException('Missing required parameter: "email"');
724
998
  }
@@ -744,15 +1018,18 @@ class Account {
744
1018
  payload
745
1019
  );
746
1020
  }
747
- /**
748
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
749
- *
750
- * @param {string} userId
751
- * @param {string} secret
752
- * @throws {AppwriteException}
753
- * @returns {Promise<Models.Session>}
754
- */
755
- updateMagicURLSession(userId, secret) {
1021
+ updateMagicURLSession(paramsOrFirst, ...rest) {
1022
+ let params;
1023
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1024
+ params = paramsOrFirst || {};
1025
+ } else {
1026
+ params = {
1027
+ userId: paramsOrFirst,
1028
+ secret: rest[0]
1029
+ };
1030
+ }
1031
+ const userId = params.userId;
1032
+ const secret = params.secret;
756
1033
  if (typeof userId === "undefined") {
757
1034
  throw new client.AppwriteException('Missing required parameter: "userId"');
758
1035
  }
@@ -778,15 +1055,18 @@ class Account {
778
1055
  payload
779
1056
  );
780
1057
  }
781
- /**
782
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
783
- *
784
- * @param {string} userId
785
- * @param {string} secret
786
- * @throws {AppwriteException}
787
- * @returns {Promise<Models.Session>}
788
- */
789
- updatePhoneSession(userId, secret) {
1058
+ updatePhoneSession(paramsOrFirst, ...rest) {
1059
+ let params;
1060
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1061
+ params = paramsOrFirst || {};
1062
+ } else {
1063
+ params = {
1064
+ userId: paramsOrFirst,
1065
+ secret: rest[0]
1066
+ };
1067
+ }
1068
+ const userId = params.userId;
1069
+ const secret = params.secret;
790
1070
  if (typeof userId === "undefined") {
791
1071
  throw new client.AppwriteException('Missing required parameter: "userId"');
792
1072
  }
@@ -812,15 +1092,18 @@ class Account {
812
1092
  payload
813
1093
  );
814
1094
  }
815
- /**
816
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
817
- *
818
- * @param {string} userId
819
- * @param {string} secret
820
- * @throws {AppwriteException}
821
- * @returns {Promise<Models.Session>}
822
- */
823
- createSession(userId, secret) {
1095
+ createSession(paramsOrFirst, ...rest) {
1096
+ let params;
1097
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1098
+ params = paramsOrFirst || {};
1099
+ } else {
1100
+ params = {
1101
+ userId: paramsOrFirst,
1102
+ secret: rest[0]
1103
+ };
1104
+ }
1105
+ const userId = params.userId;
1106
+ const secret = params.secret;
824
1107
  if (typeof userId === "undefined") {
825
1108
  throw new client.AppwriteException('Missing required parameter: "userId"');
826
1109
  }
@@ -846,14 +1129,16 @@ class Account {
846
1129
  payload
847
1130
  );
848
1131
  }
849
- /**
850
- * Use this endpoint to get a logged in user&#039;s session using a Session ID. Inputting &#039;current&#039; will return the current session being used.
851
- *
852
- * @param {string} sessionId
853
- * @throws {AppwriteException}
854
- * @returns {Promise<Models.Session>}
855
- */
856
- getSession(sessionId) {
1132
+ getSession(paramsOrFirst) {
1133
+ let params;
1134
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1135
+ params = paramsOrFirst || {};
1136
+ } else {
1137
+ params = {
1138
+ sessionId: paramsOrFirst
1139
+ };
1140
+ }
1141
+ const sessionId = params.sessionId;
857
1142
  if (typeof sessionId === "undefined") {
858
1143
  throw new client.AppwriteException('Missing required parameter: "sessionId"');
859
1144
  }
@@ -868,14 +1153,16 @@ class Account {
868
1153
  payload
869
1154
  );
870
1155
  }
871
- /**
872
- * Use this endpoint to extend a session&#039;s length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
873
- *
874
- * @param {string} sessionId
875
- * @throws {AppwriteException}
876
- * @returns {Promise<Models.Session>}
877
- */
878
- updateSession(sessionId) {
1156
+ updateSession(paramsOrFirst) {
1157
+ let params;
1158
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1159
+ params = paramsOrFirst || {};
1160
+ } else {
1161
+ params = {
1162
+ sessionId: paramsOrFirst
1163
+ };
1164
+ }
1165
+ const sessionId = params.sessionId;
879
1166
  if (typeof sessionId === "undefined") {
880
1167
  throw new client.AppwriteException('Missing required parameter: "sessionId"');
881
1168
  }
@@ -892,14 +1179,16 @@ class Account {
892
1179
  payload
893
1180
  );
894
1181
  }
895
- /**
896
- * Logout the user. Use &#039;current&#039; as the session ID to logout on this device, use a session ID to logout on another device. If you&#039;re looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
897
- *
898
- * @param {string} sessionId
899
- * @throws {AppwriteException}
900
- * @returns {Promise<{}>}
901
- */
902
- deleteSession(sessionId) {
1182
+ deleteSession(paramsOrFirst) {
1183
+ let params;
1184
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1185
+ params = paramsOrFirst || {};
1186
+ } else {
1187
+ params = {
1188
+ sessionId: paramsOrFirst
1189
+ };
1190
+ }
1191
+ const sessionId = params.sessionId;
903
1192
  if (typeof sessionId === "undefined") {
904
1193
  throw new client.AppwriteException('Missing required parameter: "sessionId"');
905
1194
  }
@@ -936,18 +1225,20 @@ class Account {
936
1225
  payload
937
1226
  );
938
1227
  }
939
- /**
940
- * Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user&#039;s email is valid for 15 minutes.
941
- *
942
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
943
- *
944
- * @param {string} userId
945
- * @param {string} email
946
- * @param {boolean} phrase
947
- * @throws {AppwriteException}
948
- * @returns {Promise<Models.Token>}
949
- */
950
- createEmailToken(userId, email, phrase) {
1228
+ createEmailToken(paramsOrFirst, ...rest) {
1229
+ let params;
1230
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1231
+ params = paramsOrFirst || {};
1232
+ } else {
1233
+ params = {
1234
+ userId: paramsOrFirst,
1235
+ email: rest[0],
1236
+ phrase: rest[1]
1237
+ };
1238
+ }
1239
+ const userId = params.userId;
1240
+ const email = params.email;
1241
+ const phrase = params.phrase;
951
1242
  if (typeof userId === "undefined") {
952
1243
  throw new client.AppwriteException('Missing required parameter: "userId"');
953
1244
  }
@@ -976,20 +1267,22 @@ class Account {
976
1267
  payload
977
1268
  );
978
1269
  }
979
- /**
980
- * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user&#039;s email address is valid for 1 hour.
981
- *
982
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
983
- *
984
- *
985
- * @param {string} userId
986
- * @param {string} email
987
- * @param {string} url
988
- * @param {boolean} phrase
989
- * @throws {AppwriteException}
990
- * @returns {Promise<Models.Token>}
991
- */
992
- createMagicURLToken(userId, email, url, phrase) {
1270
+ createMagicURLToken(paramsOrFirst, ...rest) {
1271
+ let params;
1272
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1273
+ params = paramsOrFirst || {};
1274
+ } else {
1275
+ params = {
1276
+ userId: paramsOrFirst,
1277
+ email: rest[0],
1278
+ url: rest[1],
1279
+ phrase: rest[2]
1280
+ };
1281
+ }
1282
+ const userId = params.userId;
1283
+ const email = params.email;
1284
+ const url = params.url;
1285
+ const phrase = params.phrase;
993
1286
  if (typeof userId === "undefined") {
994
1287
  throw new client.AppwriteException('Missing required parameter: "userId"');
995
1288
  }
@@ -1021,21 +1314,22 @@ class Account {
1021
1314
  payload
1022
1315
  );
1023
1316
  }
1024
- /**
1025
- * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL&#039;s back to your app when login is completed.
1026
- *
1027
- * If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
1028
- *
1029
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
1030
- *
1031
- * @param {OAuthProvider} provider
1032
- * @param {string} success
1033
- * @param {string} failure
1034
- * @param {string[]} scopes
1035
- * @throws {AppwriteException}
1036
- * @returns {Promise<string>}
1037
- */
1038
- createOAuth2Token(provider, success, failure, scopes) {
1317
+ createOAuth2Token(paramsOrFirst, ...rest) {
1318
+ let params;
1319
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "provider" in paramsOrFirst) {
1320
+ params = paramsOrFirst || {};
1321
+ } else {
1322
+ params = {
1323
+ provider: paramsOrFirst,
1324
+ success: rest[0],
1325
+ failure: rest[1],
1326
+ scopes: rest[2]
1327
+ };
1328
+ }
1329
+ const provider = params.provider;
1330
+ const success = params.success;
1331
+ const failure = params.failure;
1332
+ const scopes = params.scopes;
1039
1333
  if (typeof provider === "undefined") {
1040
1334
  throw new client.AppwriteException('Missing required parameter: "provider"');
1041
1335
  }
@@ -1059,17 +1353,18 @@ class Account {
1059
1353
  payload
1060
1354
  );
1061
1355
  }
1062
- /**
1063
- * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user&#039;s phone is valid for 15 minutes.
1064
- *
1065
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
1066
- *
1067
- * @param {string} userId
1068
- * @param {string} phone
1069
- * @throws {AppwriteException}
1070
- * @returns {Promise<Models.Token>}
1071
- */
1072
- createPhoneToken(userId, phone) {
1356
+ createPhoneToken(paramsOrFirst, ...rest) {
1357
+ let params;
1358
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1359
+ params = paramsOrFirst || {};
1360
+ } else {
1361
+ params = {
1362
+ userId: paramsOrFirst,
1363
+ phone: rest[0]
1364
+ };
1365
+ }
1366
+ const userId = params.userId;
1367
+ const phone = params.phone;
1073
1368
  if (typeof userId === "undefined") {
1074
1369
  throw new client.AppwriteException('Missing required parameter: "userId"');
1075
1370
  }
@@ -1095,17 +1390,16 @@ class Account {
1095
1390
  payload
1096
1391
  );
1097
1392
  }
1098
- /**
1099
- * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user&#039;s email address is valid for 7 days.
1100
- *
1101
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
1102
- *
1103
- *
1104
- * @param {string} url
1105
- * @throws {AppwriteException}
1106
- * @returns {Promise<Models.Token>}
1107
- */
1108
- createVerification(url) {
1393
+ createVerification(paramsOrFirst) {
1394
+ let params;
1395
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1396
+ params = paramsOrFirst || {};
1397
+ } else {
1398
+ params = {
1399
+ url: paramsOrFirst
1400
+ };
1401
+ }
1402
+ const url = params.url;
1109
1403
  if (typeof url === "undefined") {
1110
1404
  throw new client.AppwriteException('Missing required parameter: "url"');
1111
1405
  }
@@ -1125,15 +1419,18 @@ class Account {
1125
1419
  payload
1126
1420
  );
1127
1421
  }
1128
- /**
1129
- * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
1130
- *
1131
- * @param {string} userId
1132
- * @param {string} secret
1133
- * @throws {AppwriteException}
1134
- * @returns {Promise<Models.Token>}
1135
- */
1136
- updateVerification(userId, secret) {
1422
+ updateVerification(paramsOrFirst, ...rest) {
1423
+ let params;
1424
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1425
+ params = paramsOrFirst || {};
1426
+ } else {
1427
+ params = {
1428
+ userId: paramsOrFirst,
1429
+ secret: rest[0]
1430
+ };
1431
+ }
1432
+ const userId = params.userId;
1433
+ const secret = params.secret;
1137
1434
  if (typeof userId === "undefined") {
1138
1435
  throw new client.AppwriteException('Missing required parameter: "userId"');
1139
1436
  }
@@ -1160,7 +1457,7 @@ class Account {
1160
1457
  );
1161
1458
  }
1162
1459
  /**
1163
- * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user&#039;s phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user&#039;s phone number is valid for 15 minutes.
1460
+ * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
1164
1461
  *
1165
1462
  * @throws {AppwriteException}
1166
1463
  * @returns {Promise<Models.Token>}
@@ -1179,15 +1476,18 @@ class Account {
1179
1476
  payload
1180
1477
  );
1181
1478
  }
1182
- /**
1183
- * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user&#039;s phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
1184
- *
1185
- * @param {string} userId
1186
- * @param {string} secret
1187
- * @throws {AppwriteException}
1188
- * @returns {Promise<Models.Token>}
1189
- */
1190
- updatePhoneVerification(userId, secret) {
1479
+ updatePhoneVerification(paramsOrFirst, ...rest) {
1480
+ let params;
1481
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1482
+ params = paramsOrFirst || {};
1483
+ } else {
1484
+ params = {
1485
+ userId: paramsOrFirst,
1486
+ secret: rest[0]
1487
+ };
1488
+ }
1489
+ const userId = params.userId;
1490
+ const secret = params.secret;
1191
1491
  if (typeof userId === "undefined") {
1192
1492
  throw new client.AppwriteException('Missing required parameter: "userId"');
1193
1493
  }