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