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
@@ -5,15 +5,18 @@ var Users = class {
5
5
  constructor(client) {
6
6
  this.client = client;
7
7
  }
8
- /**
9
- * Get a list of all the project's users. You can use the query params to filter your results.
10
- *
11
- * @param {string[]} queries
12
- * @param {string} search
13
- * @throws {AppwriteException}
14
- * @returns {Promise<Models.UserList<Preferences>>}
15
- */
16
- list(queries, search) {
8
+ list(paramsOrFirst, ...rest) {
9
+ let params;
10
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
11
+ params = paramsOrFirst || {};
12
+ } else {
13
+ params = {
14
+ queries: paramsOrFirst,
15
+ search: rest[0]
16
+ };
17
+ }
18
+ const queries = params.queries;
19
+ const search = params.search;
17
20
  const apiPath = "/users";
18
21
  const payload = {};
19
22
  if (typeof queries !== "undefined") {
@@ -31,18 +34,24 @@ var Users = class {
31
34
  payload
32
35
  );
33
36
  }
34
- /**
35
- * Create a new user.
36
- *
37
- * @param {string} userId
38
- * @param {string} email
39
- * @param {string} phone
40
- * @param {string} password
41
- * @param {string} name
42
- * @throws {AppwriteException}
43
- * @returns {Promise<Models.User<Preferences>>}
44
- */
45
- create(userId, email, phone, password, name) {
37
+ create(paramsOrFirst, ...rest) {
38
+ let params;
39
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
40
+ params = paramsOrFirst || {};
41
+ } else {
42
+ params = {
43
+ userId: paramsOrFirst,
44
+ email: rest[0],
45
+ phone: rest[1],
46
+ password: rest[2],
47
+ name: rest[3]
48
+ };
49
+ }
50
+ const userId = params.userId;
51
+ const email = params.email;
52
+ const phone = params.phone;
53
+ const password = params.password;
54
+ const name = params.name;
46
55
  if (typeof userId === "undefined") {
47
56
  throw new AppwriteException('Missing required parameter: "userId"');
48
57
  }
@@ -74,17 +83,22 @@ var Users = class {
74
83
  payload
75
84
  );
76
85
  }
77
- /**
78
- * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
79
- *
80
- * @param {string} userId
81
- * @param {string} email
82
- * @param {string} password
83
- * @param {string} name
84
- * @throws {AppwriteException}
85
- * @returns {Promise<Models.User<Preferences>>}
86
- */
87
- createArgon2User(userId, email, password, name) {
86
+ createArgon2User(paramsOrFirst, ...rest) {
87
+ let params;
88
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
89
+ params = paramsOrFirst || {};
90
+ } else {
91
+ params = {
92
+ userId: paramsOrFirst,
93
+ email: rest[0],
94
+ password: rest[1],
95
+ name: rest[2]
96
+ };
97
+ }
98
+ const userId = params.userId;
99
+ const email = params.email;
100
+ const password = params.password;
101
+ const name = params.name;
88
102
  if (typeof userId === "undefined") {
89
103
  throw new AppwriteException('Missing required parameter: "userId"');
90
104
  }
@@ -119,17 +133,22 @@ var Users = class {
119
133
  payload
120
134
  );
121
135
  }
122
- /**
123
- * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
124
- *
125
- * @param {string} userId
126
- * @param {string} email
127
- * @param {string} password
128
- * @param {string} name
129
- * @throws {AppwriteException}
130
- * @returns {Promise<Models.User<Preferences>>}
131
- */
132
- createBcryptUser(userId, email, password, name) {
136
+ createBcryptUser(paramsOrFirst, ...rest) {
137
+ let params;
138
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
139
+ params = paramsOrFirst || {};
140
+ } else {
141
+ params = {
142
+ userId: paramsOrFirst,
143
+ email: rest[0],
144
+ password: rest[1],
145
+ name: rest[2]
146
+ };
147
+ }
148
+ const userId = params.userId;
149
+ const email = params.email;
150
+ const password = params.password;
151
+ const name = params.name;
133
152
  if (typeof userId === "undefined") {
134
153
  throw new AppwriteException('Missing required parameter: "userId"');
135
154
  }
@@ -164,15 +183,18 @@ var Users = class {
164
183
  payload
165
184
  );
166
185
  }
167
- /**
168
- * Get identities for all users.
169
- *
170
- * @param {string[]} queries
171
- * @param {string} search
172
- * @throws {AppwriteException}
173
- * @returns {Promise<Models.IdentityList>}
174
- */
175
- listIdentities(queries, search) {
186
+ listIdentities(paramsOrFirst, ...rest) {
187
+ let params;
188
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
189
+ params = paramsOrFirst || {};
190
+ } else {
191
+ params = {
192
+ queries: paramsOrFirst,
193
+ search: rest[0]
194
+ };
195
+ }
196
+ const queries = params.queries;
197
+ const search = params.search;
176
198
  const apiPath = "/users/identities";
177
199
  const payload = {};
178
200
  if (typeof queries !== "undefined") {
@@ -190,14 +212,16 @@ var Users = class {
190
212
  payload
191
213
  );
192
214
  }
193
- /**
194
- * Delete an identity by its unique ID.
195
- *
196
- * @param {string} identityId
197
- * @throws {AppwriteException}
198
- * @returns {Promise<{}>}
199
- */
200
- deleteIdentity(identityId) {
215
+ deleteIdentity(paramsOrFirst) {
216
+ let params;
217
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
218
+ params = paramsOrFirst || {};
219
+ } else {
220
+ params = {
221
+ identityId: paramsOrFirst
222
+ };
223
+ }
224
+ const identityId = params.identityId;
201
225
  if (typeof identityId === "undefined") {
202
226
  throw new AppwriteException('Missing required parameter: "identityId"');
203
227
  }
@@ -214,17 +238,22 @@ var Users = class {
214
238
  payload
215
239
  );
216
240
  }
217
- /**
218
- * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
219
- *
220
- * @param {string} userId
221
- * @param {string} email
222
- * @param {string} password
223
- * @param {string} name
224
- * @throws {AppwriteException}
225
- * @returns {Promise<Models.User<Preferences>>}
226
- */
227
- createMD5User(userId, email, password, name) {
241
+ createMD5User(paramsOrFirst, ...rest) {
242
+ let params;
243
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
244
+ params = paramsOrFirst || {};
245
+ } else {
246
+ params = {
247
+ userId: paramsOrFirst,
248
+ email: rest[0],
249
+ password: rest[1],
250
+ name: rest[2]
251
+ };
252
+ }
253
+ const userId = params.userId;
254
+ const email = params.email;
255
+ const password = params.password;
256
+ const name = params.name;
228
257
  if (typeof userId === "undefined") {
229
258
  throw new AppwriteException('Missing required parameter: "userId"');
230
259
  }
@@ -259,17 +288,22 @@ var Users = class {
259
288
  payload
260
289
  );
261
290
  }
262
- /**
263
- * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
264
- *
265
- * @param {string} userId
266
- * @param {string} email
267
- * @param {string} password
268
- * @param {string} name
269
- * @throws {AppwriteException}
270
- * @returns {Promise<Models.User<Preferences>>}
271
- */
272
- createPHPassUser(userId, email, password, name) {
291
+ createPHPassUser(paramsOrFirst, ...rest) {
292
+ let params;
293
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
294
+ params = paramsOrFirst || {};
295
+ } else {
296
+ params = {
297
+ userId: paramsOrFirst,
298
+ email: rest[0],
299
+ password: rest[1],
300
+ name: rest[2]
301
+ };
302
+ }
303
+ const userId = params.userId;
304
+ const email = params.email;
305
+ const password = params.password;
306
+ const name = params.name;
273
307
  if (typeof userId === "undefined") {
274
308
  throw new AppwriteException('Missing required parameter: "userId"');
275
309
  }
@@ -304,22 +338,32 @@ var Users = class {
304
338
  payload
305
339
  );
306
340
  }
307
- /**
308
- * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
309
- *
310
- * @param {string} userId
311
- * @param {string} email
312
- * @param {string} password
313
- * @param {string} passwordSalt
314
- * @param {number} passwordCpu
315
- * @param {number} passwordMemory
316
- * @param {number} passwordParallel
317
- * @param {number} passwordLength
318
- * @param {string} name
319
- * @throws {AppwriteException}
320
- * @returns {Promise<Models.User<Preferences>>}
321
- */
322
- createScryptUser(userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name) {
341
+ createScryptUser(paramsOrFirst, ...rest) {
342
+ let params;
343
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
344
+ params = paramsOrFirst || {};
345
+ } else {
346
+ params = {
347
+ userId: paramsOrFirst,
348
+ email: rest[0],
349
+ password: rest[1],
350
+ passwordSalt: rest[2],
351
+ passwordCpu: rest[3],
352
+ passwordMemory: rest[4],
353
+ passwordParallel: rest[5],
354
+ passwordLength: rest[6],
355
+ name: rest[7]
356
+ };
357
+ }
358
+ const userId = params.userId;
359
+ const email = params.email;
360
+ const password = params.password;
361
+ const passwordSalt = params.passwordSalt;
362
+ const passwordCpu = params.passwordCpu;
363
+ const passwordMemory = params.passwordMemory;
364
+ const passwordParallel = params.passwordParallel;
365
+ const passwordLength = params.passwordLength;
366
+ const name = params.name;
323
367
  if (typeof userId === "undefined") {
324
368
  throw new AppwriteException('Missing required parameter: "userId"');
325
369
  }
@@ -384,20 +428,28 @@ var Users = class {
384
428
  payload
385
429
  );
386
430
  }
387
- /**
388
- * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
389
- *
390
- * @param {string} userId
391
- * @param {string} email
392
- * @param {string} password
393
- * @param {string} passwordSalt
394
- * @param {string} passwordSaltSeparator
395
- * @param {string} passwordSignerKey
396
- * @param {string} name
397
- * @throws {AppwriteException}
398
- * @returns {Promise<Models.User<Preferences>>}
399
- */
400
- createScryptModifiedUser(userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name) {
431
+ createScryptModifiedUser(paramsOrFirst, ...rest) {
432
+ let params;
433
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
434
+ params = paramsOrFirst || {};
435
+ } else {
436
+ params = {
437
+ userId: paramsOrFirst,
438
+ email: rest[0],
439
+ password: rest[1],
440
+ passwordSalt: rest[2],
441
+ passwordSaltSeparator: rest[3],
442
+ passwordSignerKey: rest[4],
443
+ name: rest[5]
444
+ };
445
+ }
446
+ const userId = params.userId;
447
+ const email = params.email;
448
+ const password = params.password;
449
+ const passwordSalt = params.passwordSalt;
450
+ const passwordSaltSeparator = params.passwordSaltSeparator;
451
+ const passwordSignerKey = params.passwordSignerKey;
452
+ const name = params.name;
401
453
  if (typeof userId === "undefined") {
402
454
  throw new AppwriteException('Missing required parameter: "userId"');
403
455
  }
@@ -450,18 +502,24 @@ var Users = class {
450
502
  payload
451
503
  );
452
504
  }
453
- /**
454
- * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
455
- *
456
- * @param {string} userId
457
- * @param {string} email
458
- * @param {string} password
459
- * @param {PasswordHash} passwordVersion
460
- * @param {string} name
461
- * @throws {AppwriteException}
462
- * @returns {Promise<Models.User<Preferences>>}
463
- */
464
- createSHAUser(userId, email, password, passwordVersion, name) {
505
+ createSHAUser(paramsOrFirst, ...rest) {
506
+ let params;
507
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
508
+ params = paramsOrFirst || {};
509
+ } else {
510
+ params = {
511
+ userId: paramsOrFirst,
512
+ email: rest[0],
513
+ password: rest[1],
514
+ passwordVersion: rest[2],
515
+ name: rest[3]
516
+ };
517
+ }
518
+ const userId = params.userId;
519
+ const email = params.email;
520
+ const password = params.password;
521
+ const passwordVersion = params.passwordVersion;
522
+ const name = params.name;
465
523
  if (typeof userId === "undefined") {
466
524
  throw new AppwriteException('Missing required parameter: "userId"');
467
525
  }
@@ -499,14 +557,16 @@ var Users = class {
499
557
  payload
500
558
  );
501
559
  }
502
- /**
503
- * Get a user by its unique ID.
504
- *
505
- * @param {string} userId
506
- * @throws {AppwriteException}
507
- * @returns {Promise<Models.User<Preferences>>}
508
- */
509
- get(userId) {
560
+ get(paramsOrFirst) {
561
+ let params;
562
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
563
+ params = paramsOrFirst || {};
564
+ } else {
565
+ params = {
566
+ userId: paramsOrFirst
567
+ };
568
+ }
569
+ const userId = params.userId;
510
570
  if (typeof userId === "undefined") {
511
571
  throw new AppwriteException('Missing required parameter: "userId"');
512
572
  }
@@ -521,14 +581,16 @@ var Users = class {
521
581
  payload
522
582
  );
523
583
  }
524
- /**
525
- * Delete a user by its unique ID, thereby releasing it&#039;s ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead.
526
- *
527
- * @param {string} userId
528
- * @throws {AppwriteException}
529
- * @returns {Promise<{}>}
530
- */
531
- delete(userId) {
584
+ delete(paramsOrFirst) {
585
+ let params;
586
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
587
+ params = paramsOrFirst || {};
588
+ } else {
589
+ params = {
590
+ userId: paramsOrFirst
591
+ };
592
+ }
593
+ const userId = params.userId;
532
594
  if (typeof userId === "undefined") {
533
595
  throw new AppwriteException('Missing required parameter: "userId"');
534
596
  }
@@ -545,15 +607,18 @@ var Users = class {
545
607
  payload
546
608
  );
547
609
  }
548
- /**
549
- * Update the user email by its unique ID.
550
- *
551
- * @param {string} userId
552
- * @param {string} email
553
- * @throws {AppwriteException}
554
- * @returns {Promise<Models.User<Preferences>>}
555
- */
556
- updateEmail(userId, email) {
610
+ updateEmail(paramsOrFirst, ...rest) {
611
+ let params;
612
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
613
+ params = paramsOrFirst || {};
614
+ } else {
615
+ params = {
616
+ userId: paramsOrFirst,
617
+ email: rest[0]
618
+ };
619
+ }
620
+ const userId = params.userId;
621
+ const email = params.email;
557
622
  if (typeof userId === "undefined") {
558
623
  throw new AppwriteException('Missing required parameter: "userId"');
559
624
  }
@@ -576,16 +641,20 @@ var Users = class {
576
641
  payload
577
642
  );
578
643
  }
579
- /**
580
- * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.
581
- *
582
- * @param {string} userId
583
- * @param {string} sessionId
584
- * @param {number} duration
585
- * @throws {AppwriteException}
586
- * @returns {Promise<Models.Jwt>}
587
- */
588
- createJWT(userId, sessionId, duration) {
644
+ createJWT(paramsOrFirst, ...rest) {
645
+ let params;
646
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
647
+ params = paramsOrFirst || {};
648
+ } else {
649
+ params = {
650
+ userId: paramsOrFirst,
651
+ sessionId: rest[0],
652
+ duration: rest[1]
653
+ };
654
+ }
655
+ const userId = params.userId;
656
+ const sessionId = params.sessionId;
657
+ const duration = params.duration;
589
658
  if (typeof userId === "undefined") {
590
659
  throw new AppwriteException('Missing required parameter: "userId"');
591
660
  }
@@ -608,17 +677,18 @@ var Users = class {
608
677
  payload
609
678
  );
610
679
  }
611
- /**
612
- * Update the user labels by its unique ID.
613
- *
614
- * Labels can be used to grant access to resources. While teams are a way for user&#039;s to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info.
615
- *
616
- * @param {string} userId
617
- * @param {string[]} labels
618
- * @throws {AppwriteException}
619
- * @returns {Promise<Models.User<Preferences>>}
620
- */
621
- updateLabels(userId, labels) {
680
+ updateLabels(paramsOrFirst, ...rest) {
681
+ let params;
682
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
683
+ params = paramsOrFirst || {};
684
+ } else {
685
+ params = {
686
+ userId: paramsOrFirst,
687
+ labels: rest[0]
688
+ };
689
+ }
690
+ const userId = params.userId;
691
+ const labels = params.labels;
622
692
  if (typeof userId === "undefined") {
623
693
  throw new AppwriteException('Missing required parameter: "userId"');
624
694
  }
@@ -641,15 +711,18 @@ var Users = class {
641
711
  payload
642
712
  );
643
713
  }
644
- /**
645
- * Get the user activity logs list by its unique ID.
646
- *
647
- * @param {string} userId
648
- * @param {string[]} queries
649
- * @throws {AppwriteException}
650
- * @returns {Promise<Models.LogList>}
651
- */
652
- listLogs(userId, queries) {
714
+ listLogs(paramsOrFirst, ...rest) {
715
+ let params;
716
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
717
+ params = paramsOrFirst || {};
718
+ } else {
719
+ params = {
720
+ userId: paramsOrFirst,
721
+ queries: rest[0]
722
+ };
723
+ }
724
+ const userId = params.userId;
725
+ const queries = params.queries;
653
726
  if (typeof userId === "undefined") {
654
727
  throw new AppwriteException('Missing required parameter: "userId"');
655
728
  }
@@ -667,16 +740,20 @@ var Users = class {
667
740
  payload
668
741
  );
669
742
  }
670
- /**
671
- * Get the user membership list by its unique ID.
672
- *
673
- * @param {string} userId
674
- * @param {string[]} queries
675
- * @param {string} search
676
- * @throws {AppwriteException}
677
- * @returns {Promise<Models.MembershipList>}
678
- */
679
- listMemberships(userId, queries, search) {
743
+ listMemberships(paramsOrFirst, ...rest) {
744
+ let params;
745
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
746
+ params = paramsOrFirst || {};
747
+ } else {
748
+ params = {
749
+ userId: paramsOrFirst,
750
+ queries: rest[0],
751
+ search: rest[1]
752
+ };
753
+ }
754
+ const userId = params.userId;
755
+ const queries = params.queries;
756
+ const search = params.search;
680
757
  if (typeof userId === "undefined") {
681
758
  throw new AppwriteException('Missing required parameter: "userId"');
682
759
  }
@@ -697,15 +774,18 @@ var Users = class {
697
774
  payload
698
775
  );
699
776
  }
700
- /**
701
- * Enable or disable MFA on a user account.
702
- *
703
- * @param {string} userId
704
- * @param {boolean} mfa
705
- * @throws {AppwriteException}
706
- * @returns {Promise<Models.User<Preferences>>}
707
- */
708
- updateMfa(userId, mfa) {
777
+ updateMfa(paramsOrFirst, ...rest) {
778
+ let params;
779
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
780
+ params = paramsOrFirst || {};
781
+ } else {
782
+ params = {
783
+ userId: paramsOrFirst,
784
+ mfa: rest[0]
785
+ };
786
+ }
787
+ const userId = params.userId;
788
+ const mfa = params.mfa;
709
789
  if (typeof userId === "undefined") {
710
790
  throw new AppwriteException('Missing required parameter: "userId"');
711
791
  }
@@ -728,15 +808,52 @@ var Users = class {
728
808
  payload
729
809
  );
730
810
  }
731
- /**
732
- * Delete an authenticator app.
733
- *
734
- * @param {string} userId
735
- * @param {AuthenticatorType} type
736
- * @throws {AppwriteException}
737
- * @returns {Promise<{}>}
738
- */
739
- deleteMfaAuthenticator(userId, type) {
811
+ updateMFA(paramsOrFirst, ...rest) {
812
+ let params;
813
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
814
+ params = paramsOrFirst || {};
815
+ } else {
816
+ params = {
817
+ userId: paramsOrFirst,
818
+ mfa: rest[0]
819
+ };
820
+ }
821
+ const userId = params.userId;
822
+ const mfa = params.mfa;
823
+ if (typeof userId === "undefined") {
824
+ throw new AppwriteException('Missing required parameter: "userId"');
825
+ }
826
+ if (typeof mfa === "undefined") {
827
+ throw new AppwriteException('Missing required parameter: "mfa"');
828
+ }
829
+ const apiPath = "/users/{userId}/mfa".replace("{userId}", userId);
830
+ const payload = {};
831
+ if (typeof mfa !== "undefined") {
832
+ payload["mfa"] = mfa;
833
+ }
834
+ const uri = new URL(this.client.config.endpoint + apiPath);
835
+ const apiHeaders = {
836
+ "content-type": "application/json"
837
+ };
838
+ return this.client.call(
839
+ "patch",
840
+ uri,
841
+ apiHeaders,
842
+ payload
843
+ );
844
+ }
845
+ deleteMfaAuthenticator(paramsOrFirst, ...rest) {
846
+ let params;
847
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
848
+ params = paramsOrFirst || {};
849
+ } else {
850
+ params = {
851
+ userId: paramsOrFirst,
852
+ type: rest[0]
853
+ };
854
+ }
855
+ const userId = params.userId;
856
+ const type = params.type;
740
857
  if (typeof userId === "undefined") {
741
858
  throw new AppwriteException('Missing required parameter: "userId"');
742
859
  }
@@ -756,14 +873,47 @@ var Users = class {
756
873
  payload
757
874
  );
758
875
  }
759
- /**
760
- * List the factors available on the account to be used as a MFA challange.
761
- *
762
- * @param {string} userId
763
- * @throws {AppwriteException}
764
- * @returns {Promise<Models.MfaFactors>}
765
- */
766
- listMfaFactors(userId) {
876
+ deleteMFAAuthenticator(paramsOrFirst, ...rest) {
877
+ let params;
878
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
879
+ params = paramsOrFirst || {};
880
+ } else {
881
+ params = {
882
+ userId: paramsOrFirst,
883
+ type: rest[0]
884
+ };
885
+ }
886
+ const userId = params.userId;
887
+ const type = params.type;
888
+ if (typeof userId === "undefined") {
889
+ throw new AppwriteException('Missing required parameter: "userId"');
890
+ }
891
+ if (typeof type === "undefined") {
892
+ throw new AppwriteException('Missing required parameter: "type"');
893
+ }
894
+ const apiPath = "/users/{userId}/mfa/authenticators/{type}".replace("{userId}", userId).replace("{type}", type);
895
+ const payload = {};
896
+ const uri = new URL(this.client.config.endpoint + apiPath);
897
+ const apiHeaders = {
898
+ "content-type": "application/json"
899
+ };
900
+ return this.client.call(
901
+ "delete",
902
+ uri,
903
+ apiHeaders,
904
+ payload
905
+ );
906
+ }
907
+ listMfaFactors(paramsOrFirst) {
908
+ let params;
909
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
910
+ params = paramsOrFirst || {};
911
+ } else {
912
+ params = {
913
+ userId: paramsOrFirst
914
+ };
915
+ }
916
+ const userId = params.userId;
767
917
  if (typeof userId === "undefined") {
768
918
  throw new AppwriteException('Missing required parameter: "userId"');
769
919
  }
@@ -778,14 +928,40 @@ var Users = class {
778
928
  payload
779
929
  );
780
930
  }
781
- /**
782
- * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
783
- *
784
- * @param {string} userId
785
- * @throws {AppwriteException}
786
- * @returns {Promise<Models.MfaRecoveryCodes>}
787
- */
788
- getMfaRecoveryCodes(userId) {
931
+ listMFAFactors(paramsOrFirst) {
932
+ let params;
933
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
934
+ params = paramsOrFirst || {};
935
+ } else {
936
+ params = {
937
+ userId: paramsOrFirst
938
+ };
939
+ }
940
+ const userId = params.userId;
941
+ if (typeof userId === "undefined") {
942
+ throw new AppwriteException('Missing required parameter: "userId"');
943
+ }
944
+ const apiPath = "/users/{userId}/mfa/factors".replace("{userId}", userId);
945
+ const payload = {};
946
+ const uri = new URL(this.client.config.endpoint + apiPath);
947
+ const apiHeaders = {};
948
+ return this.client.call(
949
+ "get",
950
+ uri,
951
+ apiHeaders,
952
+ payload
953
+ );
954
+ }
955
+ getMfaRecoveryCodes(paramsOrFirst) {
956
+ let params;
957
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
958
+ params = paramsOrFirst || {};
959
+ } else {
960
+ params = {
961
+ userId: paramsOrFirst
962
+ };
963
+ }
964
+ const userId = params.userId;
789
965
  if (typeof userId === "undefined") {
790
966
  throw new AppwriteException('Missing required parameter: "userId"');
791
967
  }
@@ -800,14 +976,66 @@ var Users = class {
800
976
  payload
801
977
  );
802
978
  }
803
- /**
804
- * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
805
- *
806
- * @param {string} userId
807
- * @throws {AppwriteException}
808
- * @returns {Promise<Models.MfaRecoveryCodes>}
809
- */
810
- updateMfaRecoveryCodes(userId) {
979
+ getMFARecoveryCodes(paramsOrFirst) {
980
+ let params;
981
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
982
+ params = paramsOrFirst || {};
983
+ } else {
984
+ params = {
985
+ userId: paramsOrFirst
986
+ };
987
+ }
988
+ const userId = params.userId;
989
+ if (typeof userId === "undefined") {
990
+ throw new AppwriteException('Missing required parameter: "userId"');
991
+ }
992
+ const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId);
993
+ const payload = {};
994
+ const uri = new URL(this.client.config.endpoint + apiPath);
995
+ const apiHeaders = {};
996
+ return this.client.call(
997
+ "get",
998
+ uri,
999
+ apiHeaders,
1000
+ payload
1001
+ );
1002
+ }
1003
+ updateMfaRecoveryCodes(paramsOrFirst) {
1004
+ let params;
1005
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1006
+ params = paramsOrFirst || {};
1007
+ } else {
1008
+ params = {
1009
+ userId: paramsOrFirst
1010
+ };
1011
+ }
1012
+ const userId = params.userId;
1013
+ if (typeof userId === "undefined") {
1014
+ throw new AppwriteException('Missing required parameter: "userId"');
1015
+ }
1016
+ const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId);
1017
+ const payload = {};
1018
+ const uri = new URL(this.client.config.endpoint + apiPath);
1019
+ const apiHeaders = {
1020
+ "content-type": "application/json"
1021
+ };
1022
+ return this.client.call(
1023
+ "put",
1024
+ uri,
1025
+ apiHeaders,
1026
+ payload
1027
+ );
1028
+ }
1029
+ updateMFARecoveryCodes(paramsOrFirst) {
1030
+ let params;
1031
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1032
+ params = paramsOrFirst || {};
1033
+ } else {
1034
+ params = {
1035
+ userId: paramsOrFirst
1036
+ };
1037
+ }
1038
+ const userId = params.userId;
811
1039
  if (typeof userId === "undefined") {
812
1040
  throw new AppwriteException('Missing required parameter: "userId"');
813
1041
  }
@@ -824,14 +1052,42 @@ var Users = class {
824
1052
  payload
825
1053
  );
826
1054
  }
827
- /**
828
- * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK.
829
- *
830
- * @param {string} userId
831
- * @throws {AppwriteException}
832
- * @returns {Promise<Models.MfaRecoveryCodes>}
833
- */
834
- createMfaRecoveryCodes(userId) {
1055
+ createMfaRecoveryCodes(paramsOrFirst) {
1056
+ let params;
1057
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1058
+ params = paramsOrFirst || {};
1059
+ } else {
1060
+ params = {
1061
+ userId: paramsOrFirst
1062
+ };
1063
+ }
1064
+ const userId = params.userId;
1065
+ if (typeof userId === "undefined") {
1066
+ throw new AppwriteException('Missing required parameter: "userId"');
1067
+ }
1068
+ const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId);
1069
+ const payload = {};
1070
+ const uri = new URL(this.client.config.endpoint + apiPath);
1071
+ const apiHeaders = {
1072
+ "content-type": "application/json"
1073
+ };
1074
+ return this.client.call(
1075
+ "patch",
1076
+ uri,
1077
+ apiHeaders,
1078
+ payload
1079
+ );
1080
+ }
1081
+ createMFARecoveryCodes(paramsOrFirst) {
1082
+ let params;
1083
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1084
+ params = paramsOrFirst || {};
1085
+ } else {
1086
+ params = {
1087
+ userId: paramsOrFirst
1088
+ };
1089
+ }
1090
+ const userId = params.userId;
835
1091
  if (typeof userId === "undefined") {
836
1092
  throw new AppwriteException('Missing required parameter: "userId"');
837
1093
  }
@@ -848,15 +1104,18 @@ var Users = class {
848
1104
  payload
849
1105
  );
850
1106
  }
851
- /**
852
- * Update the user name by its unique ID.
853
- *
854
- * @param {string} userId
855
- * @param {string} name
856
- * @throws {AppwriteException}
857
- * @returns {Promise<Models.User<Preferences>>}
858
- */
859
- updateName(userId, name) {
1107
+ updateName(paramsOrFirst, ...rest) {
1108
+ let params;
1109
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1110
+ params = paramsOrFirst || {};
1111
+ } else {
1112
+ params = {
1113
+ userId: paramsOrFirst,
1114
+ name: rest[0]
1115
+ };
1116
+ }
1117
+ const userId = params.userId;
1118
+ const name = params.name;
860
1119
  if (typeof userId === "undefined") {
861
1120
  throw new AppwriteException('Missing required parameter: "userId"');
862
1121
  }
@@ -879,15 +1138,18 @@ var Users = class {
879
1138
  payload
880
1139
  );
881
1140
  }
882
- /**
883
- * Update the user password by its unique ID.
884
- *
885
- * @param {string} userId
886
- * @param {string} password
887
- * @throws {AppwriteException}
888
- * @returns {Promise<Models.User<Preferences>>}
889
- */
890
- updatePassword(userId, password) {
1141
+ updatePassword(paramsOrFirst, ...rest) {
1142
+ let params;
1143
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1144
+ params = paramsOrFirst || {};
1145
+ } else {
1146
+ params = {
1147
+ userId: paramsOrFirst,
1148
+ password: rest[0]
1149
+ };
1150
+ }
1151
+ const userId = params.userId;
1152
+ const password = params.password;
891
1153
  if (typeof userId === "undefined") {
892
1154
  throw new AppwriteException('Missing required parameter: "userId"');
893
1155
  }
@@ -910,15 +1172,18 @@ var Users = class {
910
1172
  payload
911
1173
  );
912
1174
  }
913
- /**
914
- * Update the user phone by its unique ID.
915
- *
916
- * @param {string} userId
917
- * @param {string} number
918
- * @throws {AppwriteException}
919
- * @returns {Promise<Models.User<Preferences>>}
920
- */
921
- updatePhone(userId, number) {
1175
+ updatePhone(paramsOrFirst, ...rest) {
1176
+ let params;
1177
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1178
+ params = paramsOrFirst || {};
1179
+ } else {
1180
+ params = {
1181
+ userId: paramsOrFirst,
1182
+ number: rest[0]
1183
+ };
1184
+ }
1185
+ const userId = params.userId;
1186
+ const number = params.number;
922
1187
  if (typeof userId === "undefined") {
923
1188
  throw new AppwriteException('Missing required parameter: "userId"');
924
1189
  }
@@ -941,14 +1206,16 @@ var Users = class {
941
1206
  payload
942
1207
  );
943
1208
  }
944
- /**
945
- * Get the user preferences by its unique ID.
946
- *
947
- * @param {string} userId
948
- * @throws {AppwriteException}
949
- * @returns {Promise<Preferences>}
950
- */
951
- getPrefs(userId) {
1209
+ getPrefs(paramsOrFirst) {
1210
+ let params;
1211
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1212
+ params = paramsOrFirst || {};
1213
+ } else {
1214
+ params = {
1215
+ userId: paramsOrFirst
1216
+ };
1217
+ }
1218
+ const userId = params.userId;
952
1219
  if (typeof userId === "undefined") {
953
1220
  throw new AppwriteException('Missing required parameter: "userId"');
954
1221
  }
@@ -963,15 +1230,18 @@ var Users = class {
963
1230
  payload
964
1231
  );
965
1232
  }
966
- /**
967
- * Update the user preferences by its unique ID. 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.
968
- *
969
- * @param {string} userId
970
- * @param {object} prefs
971
- * @throws {AppwriteException}
972
- * @returns {Promise<Preferences>}
973
- */
974
- updatePrefs(userId, prefs) {
1233
+ updatePrefs(paramsOrFirst, ...rest) {
1234
+ let params;
1235
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1236
+ params = paramsOrFirst || {};
1237
+ } else {
1238
+ params = {
1239
+ userId: paramsOrFirst,
1240
+ prefs: rest[0]
1241
+ };
1242
+ }
1243
+ const userId = params.userId;
1244
+ const prefs = params.prefs;
975
1245
  if (typeof userId === "undefined") {
976
1246
  throw new AppwriteException('Missing required parameter: "userId"');
977
1247
  }
@@ -994,14 +1264,16 @@ var Users = class {
994
1264
  payload
995
1265
  );
996
1266
  }
997
- /**
998
- * Get the user sessions list by its unique ID.
999
- *
1000
- * @param {string} userId
1001
- * @throws {AppwriteException}
1002
- * @returns {Promise<Models.SessionList>}
1003
- */
1004
- listSessions(userId) {
1267
+ listSessions(paramsOrFirst) {
1268
+ let params;
1269
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1270
+ params = paramsOrFirst || {};
1271
+ } else {
1272
+ params = {
1273
+ userId: paramsOrFirst
1274
+ };
1275
+ }
1276
+ const userId = params.userId;
1005
1277
  if (typeof userId === "undefined") {
1006
1278
  throw new AppwriteException('Missing required parameter: "userId"');
1007
1279
  }
@@ -1016,16 +1288,16 @@ var Users = class {
1016
1288
  payload
1017
1289
  );
1018
1290
  }
1019
- /**
1020
- * Creates a session for a user. Returns an immediately usable session object.
1021
- *
1022
- * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint.
1023
- *
1024
- * @param {string} userId
1025
- * @throws {AppwriteException}
1026
- * @returns {Promise<Models.Session>}
1027
- */
1028
- createSession(userId) {
1291
+ createSession(paramsOrFirst) {
1292
+ let params;
1293
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1294
+ params = paramsOrFirst || {};
1295
+ } else {
1296
+ params = {
1297
+ userId: paramsOrFirst
1298
+ };
1299
+ }
1300
+ const userId = params.userId;
1029
1301
  if (typeof userId === "undefined") {
1030
1302
  throw new AppwriteException('Missing required parameter: "userId"');
1031
1303
  }
@@ -1042,14 +1314,16 @@ var Users = class {
1042
1314
  payload
1043
1315
  );
1044
1316
  }
1045
- /**
1046
- * Delete all user&#039;s sessions by using the user&#039;s unique ID.
1047
- *
1048
- * @param {string} userId
1049
- * @throws {AppwriteException}
1050
- * @returns {Promise<{}>}
1051
- */
1052
- deleteSessions(userId) {
1317
+ deleteSessions(paramsOrFirst) {
1318
+ let params;
1319
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1320
+ params = paramsOrFirst || {};
1321
+ } else {
1322
+ params = {
1323
+ userId: paramsOrFirst
1324
+ };
1325
+ }
1326
+ const userId = params.userId;
1053
1327
  if (typeof userId === "undefined") {
1054
1328
  throw new AppwriteException('Missing required parameter: "userId"');
1055
1329
  }
@@ -1066,15 +1340,18 @@ var Users = class {
1066
1340
  payload
1067
1341
  );
1068
1342
  }
1069
- /**
1070
- * Delete a user sessions by its unique ID.
1071
- *
1072
- * @param {string} userId
1073
- * @param {string} sessionId
1074
- * @throws {AppwriteException}
1075
- * @returns {Promise<{}>}
1076
- */
1077
- deleteSession(userId, sessionId) {
1343
+ deleteSession(paramsOrFirst, ...rest) {
1344
+ let params;
1345
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1346
+ params = paramsOrFirst || {};
1347
+ } else {
1348
+ params = {
1349
+ userId: paramsOrFirst,
1350
+ sessionId: rest[0]
1351
+ };
1352
+ }
1353
+ const userId = params.userId;
1354
+ const sessionId = params.sessionId;
1078
1355
  if (typeof userId === "undefined") {
1079
1356
  throw new AppwriteException('Missing required parameter: "userId"');
1080
1357
  }
@@ -1094,15 +1371,18 @@ var Users = class {
1094
1371
  payload
1095
1372
  );
1096
1373
  }
1097
- /**
1098
- * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user&#039;s ID reserved.
1099
- *
1100
- * @param {string} userId
1101
- * @param {boolean} status
1102
- * @throws {AppwriteException}
1103
- * @returns {Promise<Models.User<Preferences>>}
1104
- */
1105
- updateStatus(userId, status) {
1374
+ updateStatus(paramsOrFirst, ...rest) {
1375
+ let params;
1376
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1377
+ params = paramsOrFirst || {};
1378
+ } else {
1379
+ params = {
1380
+ userId: paramsOrFirst,
1381
+ status: rest[0]
1382
+ };
1383
+ }
1384
+ const userId = params.userId;
1385
+ const status = params.status;
1106
1386
  if (typeof userId === "undefined") {
1107
1387
  throw new AppwriteException('Missing required parameter: "userId"');
1108
1388
  }
@@ -1125,15 +1405,18 @@ var Users = class {
1125
1405
  payload
1126
1406
  );
1127
1407
  }
1128
- /**
1129
- * List the messaging targets that are associated with a user.
1130
- *
1131
- * @param {string} userId
1132
- * @param {string[]} queries
1133
- * @throws {AppwriteException}
1134
- * @returns {Promise<Models.TargetList>}
1135
- */
1136
- listTargets(userId, queries) {
1408
+ listTargets(paramsOrFirst, ...rest) {
1409
+ let params;
1410
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1411
+ params = paramsOrFirst || {};
1412
+ } else {
1413
+ params = {
1414
+ userId: paramsOrFirst,
1415
+ queries: rest[0]
1416
+ };
1417
+ }
1418
+ const userId = params.userId;
1419
+ const queries = params.queries;
1137
1420
  if (typeof userId === "undefined") {
1138
1421
  throw new AppwriteException('Missing required parameter: "userId"');
1139
1422
  }
@@ -1151,19 +1434,26 @@ var Users = class {
1151
1434
  payload
1152
1435
  );
1153
1436
  }
1154
- /**
1155
- * Create a messaging target.
1156
- *
1157
- * @param {string} userId
1158
- * @param {string} targetId
1159
- * @param {MessagingProviderType} providerType
1160
- * @param {string} identifier
1161
- * @param {string} providerId
1162
- * @param {string} name
1163
- * @throws {AppwriteException}
1164
- * @returns {Promise<Models.Target>}
1165
- */
1166
- createTarget(userId, targetId, providerType, identifier, providerId, name) {
1437
+ createTarget(paramsOrFirst, ...rest) {
1438
+ let params;
1439
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1440
+ params = paramsOrFirst || {};
1441
+ } else {
1442
+ params = {
1443
+ userId: paramsOrFirst,
1444
+ targetId: rest[0],
1445
+ providerType: rest[1],
1446
+ identifier: rest[2],
1447
+ providerId: rest[3],
1448
+ name: rest[4]
1449
+ };
1450
+ }
1451
+ const userId = params.userId;
1452
+ const targetId = params.targetId;
1453
+ const providerType = params.providerType;
1454
+ const identifier = params.identifier;
1455
+ const providerId = params.providerId;
1456
+ const name = params.name;
1167
1457
  if (typeof userId === "undefined") {
1168
1458
  throw new AppwriteException('Missing required parameter: "userId"');
1169
1459
  }
@@ -1204,15 +1494,18 @@ var Users = class {
1204
1494
  payload
1205
1495
  );
1206
1496
  }
1207
- /**
1208
- * Get a user&#039;s push notification target by ID.
1209
- *
1210
- * @param {string} userId
1211
- * @param {string} targetId
1212
- * @throws {AppwriteException}
1213
- * @returns {Promise<Models.Target>}
1214
- */
1215
- getTarget(userId, targetId) {
1497
+ getTarget(paramsOrFirst, ...rest) {
1498
+ let params;
1499
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1500
+ params = paramsOrFirst || {};
1501
+ } else {
1502
+ params = {
1503
+ userId: paramsOrFirst,
1504
+ targetId: rest[0]
1505
+ };
1506
+ }
1507
+ const userId = params.userId;
1508
+ const targetId = params.targetId;
1216
1509
  if (typeof userId === "undefined") {
1217
1510
  throw new AppwriteException('Missing required parameter: "userId"');
1218
1511
  }
@@ -1230,18 +1523,24 @@ var Users = class {
1230
1523
  payload
1231
1524
  );
1232
1525
  }
1233
- /**
1234
- * Update a messaging target.
1235
- *
1236
- * @param {string} userId
1237
- * @param {string} targetId
1238
- * @param {string} identifier
1239
- * @param {string} providerId
1240
- * @param {string} name
1241
- * @throws {AppwriteException}
1242
- * @returns {Promise<Models.Target>}
1243
- */
1244
- updateTarget(userId, targetId, identifier, providerId, name) {
1526
+ updateTarget(paramsOrFirst, ...rest) {
1527
+ let params;
1528
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1529
+ params = paramsOrFirst || {};
1530
+ } else {
1531
+ params = {
1532
+ userId: paramsOrFirst,
1533
+ targetId: rest[0],
1534
+ identifier: rest[1],
1535
+ providerId: rest[2],
1536
+ name: rest[3]
1537
+ };
1538
+ }
1539
+ const userId = params.userId;
1540
+ const targetId = params.targetId;
1541
+ const identifier = params.identifier;
1542
+ const providerId = params.providerId;
1543
+ const name = params.name;
1245
1544
  if (typeof userId === "undefined") {
1246
1545
  throw new AppwriteException('Missing required parameter: "userId"');
1247
1546
  }
@@ -1270,15 +1569,18 @@ var Users = class {
1270
1569
  payload
1271
1570
  );
1272
1571
  }
1273
- /**
1274
- * Delete a messaging target.
1275
- *
1276
- * @param {string} userId
1277
- * @param {string} targetId
1278
- * @throws {AppwriteException}
1279
- * @returns {Promise<{}>}
1280
- */
1281
- deleteTarget(userId, targetId) {
1572
+ deleteTarget(paramsOrFirst, ...rest) {
1573
+ let params;
1574
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1575
+ params = paramsOrFirst || {};
1576
+ } else {
1577
+ params = {
1578
+ userId: paramsOrFirst,
1579
+ targetId: rest[0]
1580
+ };
1581
+ }
1582
+ const userId = params.userId;
1583
+ const targetId = params.targetId;
1282
1584
  if (typeof userId === "undefined") {
1283
1585
  throw new AppwriteException('Missing required parameter: "userId"');
1284
1586
  }
@@ -1298,17 +1600,20 @@ var Users = class {
1298
1600
  payload
1299
1601
  );
1300
1602
  }
1301
- /**
1302
- * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.
1303
- *
1304
- *
1305
- * @param {string} userId
1306
- * @param {number} length
1307
- * @param {number} expire
1308
- * @throws {AppwriteException}
1309
- * @returns {Promise<Models.Token>}
1310
- */
1311
- createToken(userId, length, expire) {
1603
+ createToken(paramsOrFirst, ...rest) {
1604
+ let params;
1605
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1606
+ params = paramsOrFirst || {};
1607
+ } else {
1608
+ params = {
1609
+ userId: paramsOrFirst,
1610
+ length: rest[0],
1611
+ expire: rest[1]
1612
+ };
1613
+ }
1614
+ const userId = params.userId;
1615
+ const length = params.length;
1616
+ const expire = params.expire;
1312
1617
  if (typeof userId === "undefined") {
1313
1618
  throw new AppwriteException('Missing required parameter: "userId"');
1314
1619
  }
@@ -1331,15 +1636,18 @@ var Users = class {
1331
1636
  payload
1332
1637
  );
1333
1638
  }
1334
- /**
1335
- * Update the user email verification status by its unique ID.
1336
- *
1337
- * @param {string} userId
1338
- * @param {boolean} emailVerification
1339
- * @throws {AppwriteException}
1340
- * @returns {Promise<Models.User<Preferences>>}
1341
- */
1342
- updateEmailVerification(userId, emailVerification) {
1639
+ updateEmailVerification(paramsOrFirst, ...rest) {
1640
+ let params;
1641
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1642
+ params = paramsOrFirst || {};
1643
+ } else {
1644
+ params = {
1645
+ userId: paramsOrFirst,
1646
+ emailVerification: rest[0]
1647
+ };
1648
+ }
1649
+ const userId = params.userId;
1650
+ const emailVerification = params.emailVerification;
1343
1651
  if (typeof userId === "undefined") {
1344
1652
  throw new AppwriteException('Missing required parameter: "userId"');
1345
1653
  }
@@ -1362,15 +1670,18 @@ var Users = class {
1362
1670
  payload
1363
1671
  );
1364
1672
  }
1365
- /**
1366
- * Update the user phone verification status by its unique ID.
1367
- *
1368
- * @param {string} userId
1369
- * @param {boolean} phoneVerification
1370
- * @throws {AppwriteException}
1371
- * @returns {Promise<Models.User<Preferences>>}
1372
- */
1373
- updatePhoneVerification(userId, phoneVerification) {
1673
+ updatePhoneVerification(paramsOrFirst, ...rest) {
1674
+ let params;
1675
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
1676
+ params = paramsOrFirst || {};
1677
+ } else {
1678
+ params = {
1679
+ userId: paramsOrFirst,
1680
+ phoneVerification: rest[0]
1681
+ };
1682
+ }
1683
+ const userId = params.userId;
1684
+ const phoneVerification = params.phoneVerification;
1374
1685
  if (typeof userId === "undefined") {
1375
1686
  throw new AppwriteException('Missing required parameter: "userId"');
1376
1687
  }