appwrite-cli 5.0.5 → 6.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +4 -4
  2. package/docs/examples/functions/create-build.md +1 -1
  3. package/docs/examples/functions/create-execution.md +1 -0
  4. package/docs/examples/functions/create.md +1 -0
  5. package/docs/examples/functions/delete-execution.md +3 -0
  6. package/docs/examples/functions/update-deployment-build.md +3 -0
  7. package/docs/examples/functions/update.md +1 -0
  8. package/docs/examples/projects/create-j-w-t.md +4 -0
  9. package/docs/examples/projects/update-mock-numbers.md +3 -0
  10. package/docs/examples/projects/update-session-alerts.md +3 -0
  11. package/docs/examples/users/create-j-w-t.md +4 -0
  12. package/docs/examples/vcs/get-repository-contents.md +4 -0
  13. package/index.js +34 -7
  14. package/install.ps1 +3 -3
  15. package/install.sh +2 -2
  16. package/lib/client.js +17 -3
  17. package/lib/commands/account.js +306 -152
  18. package/lib/commands/assistant.js +8 -5
  19. package/lib/commands/avatars.js +114 -58
  20. package/lib/commands/console.js +8 -5
  21. package/lib/commands/databases.js +353 -164
  22. package/lib/commands/functions.js +310 -100
  23. package/lib/commands/generic.js +206 -54
  24. package/lib/commands/graphql.js +14 -8
  25. package/lib/commands/health.js +140 -71
  26. package/lib/commands/init.js +250 -155
  27. package/lib/commands/locale.js +50 -26
  28. package/lib/commands/messaging.js +334 -156
  29. package/lib/commands/migrations.js +98 -50
  30. package/lib/commands/project.js +38 -20
  31. package/lib/commands/projects.js +449 -144
  32. package/lib/commands/proxy.js +32 -17
  33. package/lib/commands/pull.js +231 -0
  34. package/lib/commands/push.js +1518 -0
  35. package/lib/commands/run.js +282 -0
  36. package/lib/commands/storage.js +160 -76
  37. package/lib/commands/teams.js +102 -50
  38. package/lib/commands/users.js +324 -134
  39. package/lib/commands/vcs.js +102 -29
  40. package/lib/config.js +190 -18
  41. package/lib/emulation/docker.js +187 -0
  42. package/lib/emulation/utils.js +177 -0
  43. package/lib/id.js +30 -0
  44. package/lib/paginate.js +1 -2
  45. package/lib/parser.js +69 -12
  46. package/lib/questions.js +452 -80
  47. package/lib/sdks.js +1 -1
  48. package/lib/spinner.js +103 -0
  49. package/lib/utils.js +242 -4
  50. package/lib/validations.js +17 -0
  51. package/package.json +6 -2
  52. package/scoop/appwrite.json +3 -3
  53. package/lib/commands/deploy.js +0 -940
@@ -4,7 +4,7 @@ const tar = require("tar");
4
4
  const ignore = require("ignore");
5
5
  const { promisify } = require('util');
6
6
  const libClient = require('../client.js');
7
- const { getAllFiles } = require('../utils.js');
7
+ const { getAllFiles, showConsoleLink } = require('../utils.js');
8
8
  const { Command } = require('commander');
9
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
10
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
@@ -43,6 +43,7 @@ const users = new Command("users").description(commandDescriptions['users']).con
43
43
  * @typedef {Object} UsersListRequestParams
44
44
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
45
45
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
+ * @property {boolean} overrideForCli
46
47
  * @property {boolean} parseOutput
47
48
  * @property {libClient | undefined} sdk
48
49
  */
@@ -50,8 +51,9 @@ const users = new Command("users").description(commandDescriptions['users']).con
50
51
  /**
51
52
  * @param {UsersListRequestParams} params
52
53
  */
53
- const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
54
- let client = !sdk ? await sdkForProject() : sdk;
54
+ const usersList = async ({queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
55
+ let client = !sdk ? await sdkForProject() :
56
+ sdk;
55
57
  let apiPath = '/users';
56
58
  let payload = {};
57
59
  if (typeof queries !== 'undefined') {
@@ -68,11 +70,16 @@ const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}
68
70
  }, payload);
69
71
 
70
72
  if (parseOutput) {
71
- parse(response)
72
- success()
73
+ if(console) {
74
+ showConsoleLink('users', 'list');
75
+ } else {
76
+ parse(response)
77
+ success()
78
+ }
73
79
  }
74
-
80
+
75
81
  return response;
82
+
76
83
  }
77
84
 
78
85
  /**
@@ -82,6 +89,7 @@ const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}
82
89
  * @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
83
90
  * @property {string} password Plain text user password. Must be at least 8 chars.
84
91
  * @property {string} name User name. Max length: 128 chars.
92
+ * @property {boolean} overrideForCli
85
93
  * @property {boolean} parseOutput
86
94
  * @property {libClient | undefined} sdk
87
95
  */
@@ -89,8 +97,9 @@ const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}
89
97
  /**
90
98
  * @param {UsersCreateRequestParams} params
91
99
  */
92
- const usersCreate = async ({ userId, email, phone, password, name, parseOutput = true, sdk = undefined}) => {
93
- let client = !sdk ? await sdkForProject() : sdk;
100
+ const usersCreate = async ({userId,email,phone,password,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
101
+ let client = !sdk ? await sdkForProject() :
102
+ sdk;
94
103
  let apiPath = '/users';
95
104
  let payload = {};
96
105
  if (typeof userId !== 'undefined') {
@@ -119,8 +128,9 @@ const usersCreate = async ({ userId, email, phone, password, name, parseOutput =
119
128
  parse(response)
120
129
  success()
121
130
  }
122
-
131
+
123
132
  return response;
133
+
124
134
  }
125
135
 
126
136
  /**
@@ -129,6 +139,7 @@ const usersCreate = async ({ userId, email, phone, password, name, parseOutput =
129
139
  * @property {string} email User email.
130
140
  * @property {string} password User password hashed using Argon2.
131
141
  * @property {string} name User name. Max length: 128 chars.
142
+ * @property {boolean} overrideForCli
132
143
  * @property {boolean} parseOutput
133
144
  * @property {libClient | undefined} sdk
134
145
  */
@@ -136,8 +147,9 @@ const usersCreate = async ({ userId, email, phone, password, name, parseOutput =
136
147
  /**
137
148
  * @param {UsersCreateArgon2UserRequestParams} params
138
149
  */
139
- const usersCreateArgon2User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
140
- let client = !sdk ? await sdkForProject() : sdk;
150
+ const usersCreateArgon2User = async ({userId,email,password,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
151
+ let client = !sdk ? await sdkForProject() :
152
+ sdk;
141
153
  let apiPath = '/users/argon2';
142
154
  let payload = {};
143
155
  if (typeof userId !== 'undefined') {
@@ -163,8 +175,9 @@ const usersCreateArgon2User = async ({ userId, email, password, name, parseOutpu
163
175
  parse(response)
164
176
  success()
165
177
  }
166
-
178
+
167
179
  return response;
180
+
168
181
  }
169
182
 
170
183
  /**
@@ -173,6 +186,7 @@ const usersCreateArgon2User = async ({ userId, email, password, name, parseOutpu
173
186
  * @property {string} email User email.
174
187
  * @property {string} password User password hashed using Bcrypt.
175
188
  * @property {string} name User name. Max length: 128 chars.
189
+ * @property {boolean} overrideForCli
176
190
  * @property {boolean} parseOutput
177
191
  * @property {libClient | undefined} sdk
178
192
  */
@@ -180,8 +194,9 @@ const usersCreateArgon2User = async ({ userId, email, password, name, parseOutpu
180
194
  /**
181
195
  * @param {UsersCreateBcryptUserRequestParams} params
182
196
  */
183
- const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
184
- let client = !sdk ? await sdkForProject() : sdk;
197
+ const usersCreateBcryptUser = async ({userId,email,password,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
198
+ let client = !sdk ? await sdkForProject() :
199
+ sdk;
185
200
  let apiPath = '/users/bcrypt';
186
201
  let payload = {};
187
202
  if (typeof userId !== 'undefined') {
@@ -207,14 +222,16 @@ const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutpu
207
222
  parse(response)
208
223
  success()
209
224
  }
210
-
225
+
211
226
  return response;
227
+
212
228
  }
213
229
 
214
230
  /**
215
231
  * @typedef {Object} UsersListIdentitiesRequestParams
216
232
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
217
233
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
234
+ * @property {boolean} overrideForCli
218
235
  * @property {boolean} parseOutput
219
236
  * @property {libClient | undefined} sdk
220
237
  */
@@ -222,8 +239,9 @@ const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutpu
222
239
  /**
223
240
  * @param {UsersListIdentitiesRequestParams} params
224
241
  */
225
- const usersListIdentities = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
226
- let client = !sdk ? await sdkForProject() : sdk;
242
+ const usersListIdentities = async ({queries,search,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
243
+ let client = !sdk ? await sdkForProject() :
244
+ sdk;
227
245
  let apiPath = '/users/identities';
228
246
  let payload = {};
229
247
  if (typeof queries !== 'undefined') {
@@ -243,13 +261,15 @@ const usersListIdentities = async ({ queries, search, parseOutput = true, sdk =
243
261
  parse(response)
244
262
  success()
245
263
  }
246
-
264
+
247
265
  return response;
266
+
248
267
  }
249
268
 
250
269
  /**
251
270
  * @typedef {Object} UsersDeleteIdentityRequestParams
252
271
  * @property {string} identityId Identity ID.
272
+ * @property {boolean} overrideForCli
253
273
  * @property {boolean} parseOutput
254
274
  * @property {libClient | undefined} sdk
255
275
  */
@@ -257,8 +277,9 @@ const usersListIdentities = async ({ queries, search, parseOutput = true, sdk =
257
277
  /**
258
278
  * @param {UsersDeleteIdentityRequestParams} params
259
279
  */
260
- const usersDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undefined}) => {
261
- let client = !sdk ? await sdkForProject() : sdk;
280
+ const usersDeleteIdentity = async ({identityId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
281
+ let client = !sdk ? await sdkForProject() :
282
+ sdk;
262
283
  let apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId);
263
284
  let payload = {};
264
285
 
@@ -272,8 +293,9 @@ const usersDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undef
272
293
  parse(response)
273
294
  success()
274
295
  }
275
-
296
+
276
297
  return response;
298
+
277
299
  }
278
300
 
279
301
  /**
@@ -282,6 +304,7 @@ const usersDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undef
282
304
  * @property {string} email User email.
283
305
  * @property {string} password User password hashed using MD5.
284
306
  * @property {string} name User name. Max length: 128 chars.
307
+ * @property {boolean} overrideForCli
285
308
  * @property {boolean} parseOutput
286
309
  * @property {libClient | undefined} sdk
287
310
  */
@@ -289,8 +312,9 @@ const usersDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undef
289
312
  /**
290
313
  * @param {UsersCreateMD5UserRequestParams} params
291
314
  */
292
- const usersCreateMD5User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
293
- let client = !sdk ? await sdkForProject() : sdk;
315
+ const usersCreateMD5User = async ({userId,email,password,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
316
+ let client = !sdk ? await sdkForProject() :
317
+ sdk;
294
318
  let apiPath = '/users/md5';
295
319
  let payload = {};
296
320
  if (typeof userId !== 'undefined') {
@@ -316,8 +340,9 @@ const usersCreateMD5User = async ({ userId, email, password, name, parseOutput =
316
340
  parse(response)
317
341
  success()
318
342
  }
319
-
343
+
320
344
  return response;
345
+
321
346
  }
322
347
 
323
348
  /**
@@ -326,6 +351,7 @@ const usersCreateMD5User = async ({ userId, email, password, name, parseOutput =
326
351
  * @property {string} email User email.
327
352
  * @property {string} password User password hashed using PHPass.
328
353
  * @property {string} name User name. Max length: 128 chars.
354
+ * @property {boolean} overrideForCli
329
355
  * @property {boolean} parseOutput
330
356
  * @property {libClient | undefined} sdk
331
357
  */
@@ -333,8 +359,9 @@ const usersCreateMD5User = async ({ userId, email, password, name, parseOutput =
333
359
  /**
334
360
  * @param {UsersCreatePHPassUserRequestParams} params
335
361
  */
336
- const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
337
- let client = !sdk ? await sdkForProject() : sdk;
362
+ const usersCreatePHPassUser = async ({userId,email,password,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
363
+ let client = !sdk ? await sdkForProject() :
364
+ sdk;
338
365
  let apiPath = '/users/phpass';
339
366
  let payload = {};
340
367
  if (typeof userId !== 'undefined') {
@@ -360,8 +387,9 @@ const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutpu
360
387
  parse(response)
361
388
  success()
362
389
  }
363
-
390
+
364
391
  return response;
392
+
365
393
  }
366
394
 
367
395
  /**
@@ -375,6 +403,7 @@ const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutpu
375
403
  * @property {number} passwordParallel Optional parallelization cost used to hash password.
376
404
  * @property {number} passwordLength Optional hash length used to hash password.
377
405
  * @property {string} name User name. Max length: 128 chars.
406
+ * @property {boolean} overrideForCli
378
407
  * @property {boolean} parseOutput
379
408
  * @property {libClient | undefined} sdk
380
409
  */
@@ -382,8 +411,9 @@ const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutpu
382
411
  /**
383
412
  * @param {UsersCreateScryptUserRequestParams} params
384
413
  */
385
- const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name, parseOutput = true, sdk = undefined}) => {
386
- let client = !sdk ? await sdkForProject() : sdk;
414
+ const usersCreateScryptUser = async ({userId,email,password,passwordSalt,passwordCpu,passwordMemory,passwordParallel,passwordLength,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
415
+ let client = !sdk ? await sdkForProject() :
416
+ sdk;
387
417
  let apiPath = '/users/scrypt';
388
418
  let payload = {};
389
419
  if (typeof userId !== 'undefined') {
@@ -424,8 +454,9 @@ const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, pa
424
454
  parse(response)
425
455
  success()
426
456
  }
427
-
457
+
428
458
  return response;
459
+
429
460
  }
430
461
 
431
462
  /**
@@ -437,6 +468,7 @@ const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, pa
437
468
  * @property {string} passwordSaltSeparator Salt separator used to hash password.
438
469
  * @property {string} passwordSignerKey Signer key used to hash password.
439
470
  * @property {string} name User name. Max length: 128 chars.
471
+ * @property {boolean} overrideForCli
440
472
  * @property {boolean} parseOutput
441
473
  * @property {libClient | undefined} sdk
442
474
  */
@@ -444,8 +476,9 @@ const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, pa
444
476
  /**
445
477
  * @param {UsersCreateScryptModifiedUserRequestParams} params
446
478
  */
447
- const usersCreateScryptModifiedUser = async ({ userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name, parseOutput = true, sdk = undefined}) => {
448
- let client = !sdk ? await sdkForProject() : sdk;
479
+ const usersCreateScryptModifiedUser = async ({userId,email,password,passwordSalt,passwordSaltSeparator,passwordSignerKey,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
480
+ let client = !sdk ? await sdkForProject() :
481
+ sdk;
449
482
  let apiPath = '/users/scrypt-modified';
450
483
  let payload = {};
451
484
  if (typeof userId !== 'undefined') {
@@ -480,8 +513,9 @@ const usersCreateScryptModifiedUser = async ({ userId, email, password, password
480
513
  parse(response)
481
514
  success()
482
515
  }
483
-
516
+
484
517
  return response;
518
+
485
519
  }
486
520
 
487
521
  /**
@@ -491,6 +525,7 @@ const usersCreateScryptModifiedUser = async ({ userId, email, password, password
491
525
  * @property {string} password User password hashed using SHA.
492
526
  * @property {PasswordHash} passwordVersion Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
493
527
  * @property {string} name User name. Max length: 128 chars.
528
+ * @property {boolean} overrideForCli
494
529
  * @property {boolean} parseOutput
495
530
  * @property {libClient | undefined} sdk
496
531
  */
@@ -498,8 +533,9 @@ const usersCreateScryptModifiedUser = async ({ userId, email, password, password
498
533
  /**
499
534
  * @param {UsersCreateSHAUserRequestParams} params
500
535
  */
501
- const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, name, parseOutput = true, sdk = undefined}) => {
502
- let client = !sdk ? await sdkForProject() : sdk;
536
+ const usersCreateSHAUser = async ({userId,email,password,passwordVersion,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
537
+ let client = !sdk ? await sdkForProject() :
538
+ sdk;
503
539
  let apiPath = '/users/sha';
504
540
  let payload = {};
505
541
  if (typeof userId !== 'undefined') {
@@ -528,13 +564,15 @@ const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, na
528
564
  parse(response)
529
565
  success()
530
566
  }
531
-
567
+
532
568
  return response;
569
+
533
570
  }
534
571
 
535
572
  /**
536
573
  * @typedef {Object} UsersGetUsageRequestParams
537
574
  * @property {UserUsageRange} range Date range.
575
+ * @property {boolean} overrideForCli
538
576
  * @property {boolean} parseOutput
539
577
  * @property {libClient | undefined} sdk
540
578
  */
@@ -542,8 +580,9 @@ const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, na
542
580
  /**
543
581
  * @param {UsersGetUsageRequestParams} params
544
582
  */
545
- const usersGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
546
- let client = !sdk ? await sdkForProject() : sdk;
583
+ const usersGetUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
584
+ let client = !sdk ? await sdkForProject() :
585
+ sdk;
547
586
  let apiPath = '/users/usage';
548
587
  let payload = {};
549
588
  if (typeof range !== 'undefined') {
@@ -560,13 +599,15 @@ const usersGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
560
599
  parse(response)
561
600
  success()
562
601
  }
563
-
602
+
564
603
  return response;
604
+
565
605
  }
566
606
 
567
607
  /**
568
608
  * @typedef {Object} UsersGetRequestParams
569
609
  * @property {string} userId User ID.
610
+ * @property {boolean} overrideForCli
570
611
  * @property {boolean} parseOutput
571
612
  * @property {libClient | undefined} sdk
572
613
  */
@@ -574,8 +615,9 @@ const usersGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
574
615
  /**
575
616
  * @param {UsersGetRequestParams} params
576
617
  */
577
- const usersGet = async ({ userId, parseOutput = true, sdk = undefined}) => {
578
- let client = !sdk ? await sdkForProject() : sdk;
618
+ const usersGet = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
619
+ let client = !sdk ? await sdkForProject() :
620
+ sdk;
579
621
  let apiPath = '/users/{userId}'.replace('{userId}', userId);
580
622
  let payload = {};
581
623
 
@@ -586,16 +628,22 @@ const usersGet = async ({ userId, parseOutput = true, sdk = undefined}) => {
586
628
  }, payload);
587
629
 
588
630
  if (parseOutput) {
589
- parse(response)
590
- success()
631
+ if(console) {
632
+ showConsoleLink('users', 'get', userId);
633
+ } else {
634
+ parse(response)
635
+ success()
636
+ }
591
637
  }
592
-
638
+
593
639
  return response;
640
+
594
641
  }
595
642
 
596
643
  /**
597
644
  * @typedef {Object} UsersDeleteRequestParams
598
645
  * @property {string} userId User ID.
646
+ * @property {boolean} overrideForCli
599
647
  * @property {boolean} parseOutput
600
648
  * @property {libClient | undefined} sdk
601
649
  */
@@ -603,8 +651,9 @@ const usersGet = async ({ userId, parseOutput = true, sdk = undefined}) => {
603
651
  /**
604
652
  * @param {UsersDeleteRequestParams} params
605
653
  */
606
- const usersDelete = async ({ userId, parseOutput = true, sdk = undefined}) => {
607
- let client = !sdk ? await sdkForProject() : sdk;
654
+ const usersDelete = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
655
+ let client = !sdk ? await sdkForProject() :
656
+ sdk;
608
657
  let apiPath = '/users/{userId}'.replace('{userId}', userId);
609
658
  let payload = {};
610
659
 
@@ -618,14 +667,16 @@ const usersDelete = async ({ userId, parseOutput = true, sdk = undefined}) => {
618
667
  parse(response)
619
668
  success()
620
669
  }
621
-
670
+
622
671
  return response;
672
+
623
673
  }
624
674
 
625
675
  /**
626
676
  * @typedef {Object} UsersUpdateEmailRequestParams
627
677
  * @property {string} userId User ID.
628
678
  * @property {string} email User email.
679
+ * @property {boolean} overrideForCli
629
680
  * @property {boolean} parseOutput
630
681
  * @property {libClient | undefined} sdk
631
682
  */
@@ -633,8 +684,9 @@ const usersDelete = async ({ userId, parseOutput = true, sdk = undefined}) => {
633
684
  /**
634
685
  * @param {UsersUpdateEmailRequestParams} params
635
686
  */
636
- const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undefined}) => {
637
- let client = !sdk ? await sdkForProject() : sdk;
687
+ const usersUpdateEmail = async ({userId,email,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
688
+ let client = !sdk ? await sdkForProject() :
689
+ sdk;
638
690
  let apiPath = '/users/{userId}/email'.replace('{userId}', userId);
639
691
  let payload = {};
640
692
  if (typeof email !== 'undefined') {
@@ -651,14 +703,56 @@ const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undef
651
703
  parse(response)
652
704
  success()
653
705
  }
654
-
706
+
707
+ return response;
708
+
709
+ }
710
+
711
+ /**
712
+ * @typedef {Object} UsersCreateJWTRequestParams
713
+ * @property {string} userId User ID.
714
+ * @property {string} sessionId Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session.
715
+ * @property {number} duration Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
716
+ * @property {boolean} overrideForCli
717
+ * @property {boolean} parseOutput
718
+ * @property {libClient | undefined} sdk
719
+ */
720
+
721
+ /**
722
+ * @param {UsersCreateJWTRequestParams} params
723
+ */
724
+ const usersCreateJWT = async ({userId,sessionId,duration,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
725
+ let client = !sdk ? await sdkForProject() :
726
+ sdk;
727
+ let apiPath = '/users/{userId}/jwts'.replace('{userId}', userId);
728
+ let payload = {};
729
+ if (typeof sessionId !== 'undefined') {
730
+ payload['sessionId'] = sessionId;
731
+ }
732
+ if (typeof duration !== 'undefined') {
733
+ payload['duration'] = duration;
734
+ }
735
+
736
+ let response = undefined;
737
+
738
+ response = await client.call('post', apiPath, {
739
+ 'content-type': 'application/json',
740
+ }, payload);
741
+
742
+ if (parseOutput) {
743
+ parse(response)
744
+ success()
745
+ }
746
+
655
747
  return response;
748
+
656
749
  }
657
750
 
658
751
  /**
659
752
  * @typedef {Object} UsersUpdateLabelsRequestParams
660
753
  * @property {string} userId User ID.
661
754
  * @property {string[]} labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
755
+ * @property {boolean} overrideForCli
662
756
  * @property {boolean} parseOutput
663
757
  * @property {libClient | undefined} sdk
664
758
  */
@@ -666,8 +760,9 @@ const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undef
666
760
  /**
667
761
  * @param {UsersUpdateLabelsRequestParams} params
668
762
  */
669
- const usersUpdateLabels = async ({ userId, labels, parseOutput = true, sdk = undefined}) => {
670
- let client = !sdk ? await sdkForProject() : sdk;
763
+ const usersUpdateLabels = async ({userId,labels,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
764
+ let client = !sdk ? await sdkForProject() :
765
+ sdk;
671
766
  let apiPath = '/users/{userId}/labels'.replace('{userId}', userId);
672
767
  let payload = {};
673
768
  labels = labels === true ? [] : labels;
@@ -685,14 +780,16 @@ const usersUpdateLabels = async ({ userId, labels, parseOutput = true, sdk = und
685
780
  parse(response)
686
781
  success()
687
782
  }
688
-
783
+
689
784
  return response;
785
+
690
786
  }
691
787
 
692
788
  /**
693
789
  * @typedef {Object} UsersListLogsRequestParams
694
790
  * @property {string} userId User ID.
695
791
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
792
+ * @property {boolean} overrideForCli
696
793
  * @property {boolean} parseOutput
697
794
  * @property {libClient | undefined} sdk
698
795
  */
@@ -700,8 +797,9 @@ const usersUpdateLabels = async ({ userId, labels, parseOutput = true, sdk = und
700
797
  /**
701
798
  * @param {UsersListLogsRequestParams} params
702
799
  */
703
- const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
704
- let client = !sdk ? await sdkForProject() : sdk;
800
+ const usersListLogs = async ({userId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
801
+ let client = !sdk ? await sdkForProject() :
802
+ sdk;
705
803
  let apiPath = '/users/{userId}/logs'.replace('{userId}', userId);
706
804
  let payload = {};
707
805
  if (typeof queries !== 'undefined') {
@@ -718,13 +816,15 @@ const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefi
718
816
  parse(response)
719
817
  success()
720
818
  }
721
-
819
+
722
820
  return response;
821
+
723
822
  }
724
823
 
725
824
  /**
726
825
  * @typedef {Object} UsersListMembershipsRequestParams
727
826
  * @property {string} userId User ID.
827
+ * @property {boolean} overrideForCli
728
828
  * @property {boolean} parseOutput
729
829
  * @property {libClient | undefined} sdk
730
830
  */
@@ -732,8 +832,9 @@ const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefi
732
832
  /**
733
833
  * @param {UsersListMembershipsRequestParams} params
734
834
  */
735
- const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefined}) => {
736
- let client = !sdk ? await sdkForProject() : sdk;
835
+ const usersListMemberships = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
836
+ let client = !sdk ? await sdkForProject() :
837
+ sdk;
737
838
  let apiPath = '/users/{userId}/memberships'.replace('{userId}', userId);
738
839
  let payload = {};
739
840
 
@@ -747,14 +848,16 @@ const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefine
747
848
  parse(response)
748
849
  success()
749
850
  }
750
-
851
+
751
852
  return response;
853
+
752
854
  }
753
855
 
754
856
  /**
755
857
  * @typedef {Object} UsersUpdateMfaRequestParams
756
858
  * @property {string} userId User ID.
757
859
  * @property {boolean} mfa Enable or disable MFA.
860
+ * @property {boolean} overrideForCli
758
861
  * @property {boolean} parseOutput
759
862
  * @property {libClient | undefined} sdk
760
863
  */
@@ -762,8 +865,9 @@ const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefine
762
865
  /**
763
866
  * @param {UsersUpdateMfaRequestParams} params
764
867
  */
765
- const usersUpdateMfa = async ({ userId, mfa, parseOutput = true, sdk = undefined}) => {
766
- let client = !sdk ? await sdkForProject() : sdk;
868
+ const usersUpdateMfa = async ({userId,mfa,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
869
+ let client = !sdk ? await sdkForProject() :
870
+ sdk;
767
871
  let apiPath = '/users/{userId}/mfa'.replace('{userId}', userId);
768
872
  let payload = {};
769
873
  if (typeof mfa !== 'undefined') {
@@ -780,14 +884,16 @@ const usersUpdateMfa = async ({ userId, mfa, parseOutput = true, sdk = undefined
780
884
  parse(response)
781
885
  success()
782
886
  }
783
-
887
+
784
888
  return response;
889
+
785
890
  }
786
891
 
787
892
  /**
788
893
  * @typedef {Object} UsersDeleteMfaAuthenticatorRequestParams
789
894
  * @property {string} userId User ID.
790
895
  * @property {AuthenticatorType} type Type of authenticator.
896
+ * @property {boolean} overrideForCli
791
897
  * @property {boolean} parseOutput
792
898
  * @property {libClient | undefined} sdk
793
899
  */
@@ -795,8 +901,9 @@ const usersUpdateMfa = async ({ userId, mfa, parseOutput = true, sdk = undefined
795
901
  /**
796
902
  * @param {UsersDeleteMfaAuthenticatorRequestParams} params
797
903
  */
798
- const usersDeleteMfaAuthenticator = async ({ userId, type, parseOutput = true, sdk = undefined}) => {
799
- let client = !sdk ? await sdkForProject() : sdk;
904
+ const usersDeleteMfaAuthenticator = async ({userId,type,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
905
+ let client = !sdk ? await sdkForProject() :
906
+ sdk;
800
907
  let apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type);
801
908
  let payload = {};
802
909
 
@@ -810,13 +917,15 @@ const usersDeleteMfaAuthenticator = async ({ userId, type, parseOutput = true, s
810
917
  parse(response)
811
918
  success()
812
919
  }
813
-
920
+
814
921
  return response;
922
+
815
923
  }
816
924
 
817
925
  /**
818
926
  * @typedef {Object} UsersListMfaFactorsRequestParams
819
927
  * @property {string} userId User ID.
928
+ * @property {boolean} overrideForCli
820
929
  * @property {boolean} parseOutput
821
930
  * @property {libClient | undefined} sdk
822
931
  */
@@ -824,8 +933,9 @@ const usersDeleteMfaAuthenticator = async ({ userId, type, parseOutput = true, s
824
933
  /**
825
934
  * @param {UsersListMfaFactorsRequestParams} params
826
935
  */
827
- const usersListMfaFactors = async ({ userId, parseOutput = true, sdk = undefined}) => {
828
- let client = !sdk ? await sdkForProject() : sdk;
936
+ const usersListMfaFactors = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
937
+ let client = !sdk ? await sdkForProject() :
938
+ sdk;
829
939
  let apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId);
830
940
  let payload = {};
831
941
 
@@ -839,13 +949,15 @@ const usersListMfaFactors = async ({ userId, parseOutput = true, sdk = undefined
839
949
  parse(response)
840
950
  success()
841
951
  }
842
-
952
+
843
953
  return response;
954
+
844
955
  }
845
956
 
846
957
  /**
847
958
  * @typedef {Object} UsersGetMfaRecoveryCodesRequestParams
848
959
  * @property {string} userId User ID.
960
+ * @property {boolean} overrideForCli
849
961
  * @property {boolean} parseOutput
850
962
  * @property {libClient | undefined} sdk
851
963
  */
@@ -853,8 +965,9 @@ const usersListMfaFactors = async ({ userId, parseOutput = true, sdk = undefined
853
965
  /**
854
966
  * @param {UsersGetMfaRecoveryCodesRequestParams} params
855
967
  */
856
- const usersGetMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = undefined}) => {
857
- let client = !sdk ? await sdkForProject() : sdk;
968
+ const usersGetMfaRecoveryCodes = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
969
+ let client = !sdk ? await sdkForProject() :
970
+ sdk;
858
971
  let apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
859
972
  let payload = {};
860
973
 
@@ -868,13 +981,15 @@ const usersGetMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = unde
868
981
  parse(response)
869
982
  success()
870
983
  }
871
-
984
+
872
985
  return response;
986
+
873
987
  }
874
988
 
875
989
  /**
876
990
  * @typedef {Object} UsersUpdateMfaRecoveryCodesRequestParams
877
991
  * @property {string} userId User ID.
992
+ * @property {boolean} overrideForCli
878
993
  * @property {boolean} parseOutput
879
994
  * @property {libClient | undefined} sdk
880
995
  */
@@ -882,8 +997,9 @@ const usersGetMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = unde
882
997
  /**
883
998
  * @param {UsersUpdateMfaRecoveryCodesRequestParams} params
884
999
  */
885
- const usersUpdateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = undefined}) => {
886
- let client = !sdk ? await sdkForProject() : sdk;
1000
+ const usersUpdateMfaRecoveryCodes = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1001
+ let client = !sdk ? await sdkForProject() :
1002
+ sdk;
887
1003
  let apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
888
1004
  let payload = {};
889
1005
 
@@ -897,13 +1013,15 @@ const usersUpdateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = u
897
1013
  parse(response)
898
1014
  success()
899
1015
  }
900
-
1016
+
901
1017
  return response;
1018
+
902
1019
  }
903
1020
 
904
1021
  /**
905
1022
  * @typedef {Object} UsersCreateMfaRecoveryCodesRequestParams
906
1023
  * @property {string} userId User ID.
1024
+ * @property {boolean} overrideForCli
907
1025
  * @property {boolean} parseOutput
908
1026
  * @property {libClient | undefined} sdk
909
1027
  */
@@ -911,8 +1029,9 @@ const usersUpdateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = u
911
1029
  /**
912
1030
  * @param {UsersCreateMfaRecoveryCodesRequestParams} params
913
1031
  */
914
- const usersCreateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = undefined}) => {
915
- let client = !sdk ? await sdkForProject() : sdk;
1032
+ const usersCreateMfaRecoveryCodes = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1033
+ let client = !sdk ? await sdkForProject() :
1034
+ sdk;
916
1035
  let apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
917
1036
  let payload = {};
918
1037
 
@@ -926,14 +1045,16 @@ const usersCreateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = u
926
1045
  parse(response)
927
1046
  success()
928
1047
  }
929
-
1048
+
930
1049
  return response;
1050
+
931
1051
  }
932
1052
 
933
1053
  /**
934
1054
  * @typedef {Object} UsersUpdateNameRequestParams
935
1055
  * @property {string} userId User ID.
936
1056
  * @property {string} name User name. Max length: 128 chars.
1057
+ * @property {boolean} overrideForCli
937
1058
  * @property {boolean} parseOutput
938
1059
  * @property {libClient | undefined} sdk
939
1060
  */
@@ -941,8 +1062,9 @@ const usersCreateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = u
941
1062
  /**
942
1063
  * @param {UsersUpdateNameRequestParams} params
943
1064
  */
944
- const usersUpdateName = async ({ userId, name, parseOutput = true, sdk = undefined}) => {
945
- let client = !sdk ? await sdkForProject() : sdk;
1065
+ const usersUpdateName = async ({userId,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1066
+ let client = !sdk ? await sdkForProject() :
1067
+ sdk;
946
1068
  let apiPath = '/users/{userId}/name'.replace('{userId}', userId);
947
1069
  let payload = {};
948
1070
  if (typeof name !== 'undefined') {
@@ -959,14 +1081,16 @@ const usersUpdateName = async ({ userId, name, parseOutput = true, sdk = undefin
959
1081
  parse(response)
960
1082
  success()
961
1083
  }
962
-
1084
+
963
1085
  return response;
1086
+
964
1087
  }
965
1088
 
966
1089
  /**
967
1090
  * @typedef {Object} UsersUpdatePasswordRequestParams
968
1091
  * @property {string} userId User ID.
969
1092
  * @property {string} password New user password. Must be at least 8 chars.
1093
+ * @property {boolean} overrideForCli
970
1094
  * @property {boolean} parseOutput
971
1095
  * @property {libClient | undefined} sdk
972
1096
  */
@@ -974,8 +1098,9 @@ const usersUpdateName = async ({ userId, name, parseOutput = true, sdk = undefin
974
1098
  /**
975
1099
  * @param {UsersUpdatePasswordRequestParams} params
976
1100
  */
977
- const usersUpdatePassword = async ({ userId, password, parseOutput = true, sdk = undefined}) => {
978
- let client = !sdk ? await sdkForProject() : sdk;
1101
+ const usersUpdatePassword = async ({userId,password,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1102
+ let client = !sdk ? await sdkForProject() :
1103
+ sdk;
979
1104
  let apiPath = '/users/{userId}/password'.replace('{userId}', userId);
980
1105
  let payload = {};
981
1106
  if (typeof password !== 'undefined') {
@@ -992,14 +1117,16 @@ const usersUpdatePassword = async ({ userId, password, parseOutput = true, sdk =
992
1117
  parse(response)
993
1118
  success()
994
1119
  }
995
-
1120
+
996
1121
  return response;
1122
+
997
1123
  }
998
1124
 
999
1125
  /**
1000
1126
  * @typedef {Object} UsersUpdatePhoneRequestParams
1001
1127
  * @property {string} userId User ID.
1002
1128
  * @property {string} number User phone number.
1129
+ * @property {boolean} overrideForCli
1003
1130
  * @property {boolean} parseOutput
1004
1131
  * @property {libClient | undefined} sdk
1005
1132
  */
@@ -1007,8 +1134,9 @@ const usersUpdatePassword = async ({ userId, password, parseOutput = true, sdk =
1007
1134
  /**
1008
1135
  * @param {UsersUpdatePhoneRequestParams} params
1009
1136
  */
1010
- const usersUpdatePhone = async ({ userId, number, parseOutput = true, sdk = undefined}) => {
1011
- let client = !sdk ? await sdkForProject() : sdk;
1137
+ const usersUpdatePhone = async ({userId,number,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1138
+ let client = !sdk ? await sdkForProject() :
1139
+ sdk;
1012
1140
  let apiPath = '/users/{userId}/phone'.replace('{userId}', userId);
1013
1141
  let payload = {};
1014
1142
  if (typeof number !== 'undefined') {
@@ -1025,13 +1153,15 @@ const usersUpdatePhone = async ({ userId, number, parseOutput = true, sdk = unde
1025
1153
  parse(response)
1026
1154
  success()
1027
1155
  }
1028
-
1156
+
1029
1157
  return response;
1158
+
1030
1159
  }
1031
1160
 
1032
1161
  /**
1033
1162
  * @typedef {Object} UsersGetPrefsRequestParams
1034
1163
  * @property {string} userId User ID.
1164
+ * @property {boolean} overrideForCli
1035
1165
  * @property {boolean} parseOutput
1036
1166
  * @property {libClient | undefined} sdk
1037
1167
  */
@@ -1039,8 +1169,9 @@ const usersUpdatePhone = async ({ userId, number, parseOutput = true, sdk = unde
1039
1169
  /**
1040
1170
  * @param {UsersGetPrefsRequestParams} params
1041
1171
  */
1042
- const usersGetPrefs = async ({ userId, parseOutput = true, sdk = undefined}) => {
1043
- let client = !sdk ? await sdkForProject() : sdk;
1172
+ const usersGetPrefs = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1173
+ let client = !sdk ? await sdkForProject() :
1174
+ sdk;
1044
1175
  let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
1045
1176
  let payload = {};
1046
1177
 
@@ -1054,14 +1185,16 @@ const usersGetPrefs = async ({ userId, parseOutput = true, sdk = undefined}) =>
1054
1185
  parse(response)
1055
1186
  success()
1056
1187
  }
1057
-
1188
+
1058
1189
  return response;
1190
+
1059
1191
  }
1060
1192
 
1061
1193
  /**
1062
1194
  * @typedef {Object} UsersUpdatePrefsRequestParams
1063
1195
  * @property {string} userId User ID.
1064
1196
  * @property {object} prefs Prefs key-value JSON object.
1197
+ * @property {boolean} overrideForCli
1065
1198
  * @property {boolean} parseOutput
1066
1199
  * @property {libClient | undefined} sdk
1067
1200
  */
@@ -1069,8 +1202,9 @@ const usersGetPrefs = async ({ userId, parseOutput = true, sdk = undefined}) =>
1069
1202
  /**
1070
1203
  * @param {UsersUpdatePrefsRequestParams} params
1071
1204
  */
1072
- const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undefined}) => {
1073
- let client = !sdk ? await sdkForProject() : sdk;
1205
+ const usersUpdatePrefs = async ({userId,prefs,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1206
+ let client = !sdk ? await sdkForProject() :
1207
+ sdk;
1074
1208
  let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
1075
1209
  let payload = {};
1076
1210
  if (typeof prefs !== 'undefined') {
@@ -1087,13 +1221,15 @@ const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undef
1087
1221
  parse(response)
1088
1222
  success()
1089
1223
  }
1090
-
1224
+
1091
1225
  return response;
1226
+
1092
1227
  }
1093
1228
 
1094
1229
  /**
1095
1230
  * @typedef {Object} UsersListSessionsRequestParams
1096
1231
  * @property {string} userId User ID.
1232
+ * @property {boolean} overrideForCli
1097
1233
  * @property {boolean} parseOutput
1098
1234
  * @property {libClient | undefined} sdk
1099
1235
  */
@@ -1101,8 +1237,9 @@ const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undef
1101
1237
  /**
1102
1238
  * @param {UsersListSessionsRequestParams} params
1103
1239
  */
1104
- const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
1105
- let client = !sdk ? await sdkForProject() : sdk;
1240
+ const usersListSessions = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1241
+ let client = !sdk ? await sdkForProject() :
1242
+ sdk;
1106
1243
  let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
1107
1244
  let payload = {};
1108
1245
 
@@ -1113,16 +1250,22 @@ const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined})
1113
1250
  }, payload);
1114
1251
 
1115
1252
  if (parseOutput) {
1116
- parse(response)
1117
- success()
1253
+ if(console) {
1254
+ showConsoleLink('users', 'listSessions', userId);
1255
+ } else {
1256
+ parse(response)
1257
+ success()
1258
+ }
1118
1259
  }
1119
-
1260
+
1120
1261
  return response;
1262
+
1121
1263
  }
1122
1264
 
1123
1265
  /**
1124
1266
  * @typedef {Object} UsersCreateSessionRequestParams
1125
1267
  * @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1268
+ * @property {boolean} overrideForCli
1126
1269
  * @property {boolean} parseOutput
1127
1270
  * @property {libClient | undefined} sdk
1128
1271
  */
@@ -1130,8 +1273,9 @@ const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined})
1130
1273
  /**
1131
1274
  * @param {UsersCreateSessionRequestParams} params
1132
1275
  */
1133
- const usersCreateSession = async ({ userId, parseOutput = true, sdk = undefined}) => {
1134
- let client = !sdk ? await sdkForProject() : sdk;
1276
+ const usersCreateSession = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1277
+ let client = !sdk ? await sdkForProject() :
1278
+ sdk;
1135
1279
  let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
1136
1280
  let payload = {};
1137
1281
 
@@ -1145,13 +1289,15 @@ const usersCreateSession = async ({ userId, parseOutput = true, sdk = undefined}
1145
1289
  parse(response)
1146
1290
  success()
1147
1291
  }
1148
-
1292
+
1149
1293
  return response;
1294
+
1150
1295
  }
1151
1296
 
1152
1297
  /**
1153
1298
  * @typedef {Object} UsersDeleteSessionsRequestParams
1154
1299
  * @property {string} userId User ID.
1300
+ * @property {boolean} overrideForCli
1155
1301
  * @property {boolean} parseOutput
1156
1302
  * @property {libClient | undefined} sdk
1157
1303
  */
@@ -1159,8 +1305,9 @@ const usersCreateSession = async ({ userId, parseOutput = true, sdk = undefined}
1159
1305
  /**
1160
1306
  * @param {UsersDeleteSessionsRequestParams} params
1161
1307
  */
1162
- const usersDeleteSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
1163
- let client = !sdk ? await sdkForProject() : sdk;
1308
+ const usersDeleteSessions = async ({userId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1309
+ let client = !sdk ? await sdkForProject() :
1310
+ sdk;
1164
1311
  let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
1165
1312
  let payload = {};
1166
1313
 
@@ -1174,14 +1321,16 @@ const usersDeleteSessions = async ({ userId, parseOutput = true, sdk = undefined
1174
1321
  parse(response)
1175
1322
  success()
1176
1323
  }
1177
-
1324
+
1178
1325
  return response;
1326
+
1179
1327
  }
1180
1328
 
1181
1329
  /**
1182
1330
  * @typedef {Object} UsersDeleteSessionRequestParams
1183
1331
  * @property {string} userId User ID.
1184
1332
  * @property {string} sessionId Session ID.
1333
+ * @property {boolean} overrideForCli
1185
1334
  * @property {boolean} parseOutput
1186
1335
  * @property {libClient | undefined} sdk
1187
1336
  */
@@ -1189,8 +1338,9 @@ const usersDeleteSessions = async ({ userId, parseOutput = true, sdk = undefined
1189
1338
  /**
1190
1339
  * @param {UsersDeleteSessionRequestParams} params
1191
1340
  */
1192
- const usersDeleteSession = async ({ userId, sessionId, parseOutput = true, sdk = undefined}) => {
1193
- let client = !sdk ? await sdkForProject() : sdk;
1341
+ const usersDeleteSession = async ({userId,sessionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1342
+ let client = !sdk ? await sdkForProject() :
1343
+ sdk;
1194
1344
  let apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
1195
1345
  let payload = {};
1196
1346
 
@@ -1204,14 +1354,16 @@ const usersDeleteSession = async ({ userId, sessionId, parseOutput = true, sdk =
1204
1354
  parse(response)
1205
1355
  success()
1206
1356
  }
1207
-
1357
+
1208
1358
  return response;
1359
+
1209
1360
  }
1210
1361
 
1211
1362
  /**
1212
1363
  * @typedef {Object} UsersUpdateStatusRequestParams
1213
1364
  * @property {string} userId User ID.
1214
1365
  * @property {boolean} status User Status. To activate the user pass 'true' and to block the user pass 'false'.
1366
+ * @property {boolean} overrideForCli
1215
1367
  * @property {boolean} parseOutput
1216
1368
  * @property {libClient | undefined} sdk
1217
1369
  */
@@ -1219,8 +1371,9 @@ const usersDeleteSession = async ({ userId, sessionId, parseOutput = true, sdk =
1219
1371
  /**
1220
1372
  * @param {UsersUpdateStatusRequestParams} params
1221
1373
  */
1222
- const usersUpdateStatus = async ({ userId, status, parseOutput = true, sdk = undefined}) => {
1223
- let client = !sdk ? await sdkForProject() : sdk;
1374
+ const usersUpdateStatus = async ({userId,status,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1375
+ let client = !sdk ? await sdkForProject() :
1376
+ sdk;
1224
1377
  let apiPath = '/users/{userId}/status'.replace('{userId}', userId);
1225
1378
  let payload = {};
1226
1379
  if (typeof status !== 'undefined') {
@@ -1237,14 +1390,16 @@ const usersUpdateStatus = async ({ userId, status, parseOutput = true, sdk = und
1237
1390
  parse(response)
1238
1391
  success()
1239
1392
  }
1240
-
1393
+
1241
1394
  return response;
1395
+
1242
1396
  }
1243
1397
 
1244
1398
  /**
1245
1399
  * @typedef {Object} UsersListTargetsRequestParams
1246
1400
  * @property {string} userId User ID.
1247
1401
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
1402
+ * @property {boolean} overrideForCli
1248
1403
  * @property {boolean} parseOutput
1249
1404
  * @property {libClient | undefined} sdk
1250
1405
  */
@@ -1252,8 +1407,9 @@ const usersUpdateStatus = async ({ userId, status, parseOutput = true, sdk = und
1252
1407
  /**
1253
1408
  * @param {UsersListTargetsRequestParams} params
1254
1409
  */
1255
- const usersListTargets = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
1256
- let client = !sdk ? await sdkForProject() : sdk;
1410
+ const usersListTargets = async ({userId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1411
+ let client = !sdk ? await sdkForProject() :
1412
+ sdk;
1257
1413
  let apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
1258
1414
  let payload = {};
1259
1415
  if (typeof queries !== 'undefined') {
@@ -1270,8 +1426,9 @@ const usersListTargets = async ({ userId, queries, parseOutput = true, sdk = und
1270
1426
  parse(response)
1271
1427
  success()
1272
1428
  }
1273
-
1429
+
1274
1430
  return response;
1431
+
1275
1432
  }
1276
1433
 
1277
1434
  /**
@@ -1282,6 +1439,7 @@ const usersListTargets = async ({ userId, queries, parseOutput = true, sdk = und
1282
1439
  * @property {string} identifier The target identifier (token, email, phone etc.)
1283
1440
  * @property {string} providerId Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
1284
1441
  * @property {string} name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
1442
+ * @property {boolean} overrideForCli
1285
1443
  * @property {boolean} parseOutput
1286
1444
  * @property {libClient | undefined} sdk
1287
1445
  */
@@ -1289,8 +1447,9 @@ const usersListTargets = async ({ userId, queries, parseOutput = true, sdk = und
1289
1447
  /**
1290
1448
  * @param {UsersCreateTargetRequestParams} params
1291
1449
  */
1292
- const usersCreateTarget = async ({ userId, targetId, providerType, identifier, providerId, name, parseOutput = true, sdk = undefined}) => {
1293
- let client = !sdk ? await sdkForProject() : sdk;
1450
+ const usersCreateTarget = async ({userId,targetId,providerType,identifier,providerId,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1451
+ let client = !sdk ? await sdkForProject() :
1452
+ sdk;
1294
1453
  let apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
1295
1454
  let payload = {};
1296
1455
  if (typeof targetId !== 'undefined') {
@@ -1319,14 +1478,16 @@ const usersCreateTarget = async ({ userId, targetId, providerType, identifier, p
1319
1478
  parse(response)
1320
1479
  success()
1321
1480
  }
1322
-
1481
+
1323
1482
  return response;
1483
+
1324
1484
  }
1325
1485
 
1326
1486
  /**
1327
1487
  * @typedef {Object} UsersGetTargetRequestParams
1328
1488
  * @property {string} userId User ID.
1329
1489
  * @property {string} targetId Target ID.
1490
+ * @property {boolean} overrideForCli
1330
1491
  * @property {boolean} parseOutput
1331
1492
  * @property {libClient | undefined} sdk
1332
1493
  */
@@ -1334,8 +1495,9 @@ const usersCreateTarget = async ({ userId, targetId, providerType, identifier, p
1334
1495
  /**
1335
1496
  * @param {UsersGetTargetRequestParams} params
1336
1497
  */
1337
- const usersGetTarget = async ({ userId, targetId, parseOutput = true, sdk = undefined}) => {
1338
- let client = !sdk ? await sdkForProject() : sdk;
1498
+ const usersGetTarget = async ({userId,targetId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1499
+ let client = !sdk ? await sdkForProject() :
1500
+ sdk;
1339
1501
  let apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1340
1502
  let payload = {};
1341
1503
 
@@ -1349,8 +1511,9 @@ const usersGetTarget = async ({ userId, targetId, parseOutput = true, sdk = unde
1349
1511
  parse(response)
1350
1512
  success()
1351
1513
  }
1352
-
1514
+
1353
1515
  return response;
1516
+
1354
1517
  }
1355
1518
 
1356
1519
  /**
@@ -1360,6 +1523,7 @@ const usersGetTarget = async ({ userId, targetId, parseOutput = true, sdk = unde
1360
1523
  * @property {string} identifier The target identifier (token, email, phone etc.)
1361
1524
  * @property {string} providerId Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
1362
1525
  * @property {string} name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
1526
+ * @property {boolean} overrideForCli
1363
1527
  * @property {boolean} parseOutput
1364
1528
  * @property {libClient | undefined} sdk
1365
1529
  */
@@ -1367,8 +1531,9 @@ const usersGetTarget = async ({ userId, targetId, parseOutput = true, sdk = unde
1367
1531
  /**
1368
1532
  * @param {UsersUpdateTargetRequestParams} params
1369
1533
  */
1370
- const usersUpdateTarget = async ({ userId, targetId, identifier, providerId, name, parseOutput = true, sdk = undefined}) => {
1371
- let client = !sdk ? await sdkForProject() : sdk;
1534
+ const usersUpdateTarget = async ({userId,targetId,identifier,providerId,name,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1535
+ let client = !sdk ? await sdkForProject() :
1536
+ sdk;
1372
1537
  let apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1373
1538
  let payload = {};
1374
1539
  if (typeof identifier !== 'undefined') {
@@ -1391,14 +1556,16 @@ const usersUpdateTarget = async ({ userId, targetId, identifier, providerId, nam
1391
1556
  parse(response)
1392
1557
  success()
1393
1558
  }
1394
-
1559
+
1395
1560
  return response;
1561
+
1396
1562
  }
1397
1563
 
1398
1564
  /**
1399
1565
  * @typedef {Object} UsersDeleteTargetRequestParams
1400
1566
  * @property {string} userId User ID.
1401
1567
  * @property {string} targetId Target ID.
1568
+ * @property {boolean} overrideForCli
1402
1569
  * @property {boolean} parseOutput
1403
1570
  * @property {libClient | undefined} sdk
1404
1571
  */
@@ -1406,8 +1573,9 @@ const usersUpdateTarget = async ({ userId, targetId, identifier, providerId, nam
1406
1573
  /**
1407
1574
  * @param {UsersDeleteTargetRequestParams} params
1408
1575
  */
1409
- const usersDeleteTarget = async ({ userId, targetId, parseOutput = true, sdk = undefined}) => {
1410
- let client = !sdk ? await sdkForProject() : sdk;
1576
+ const usersDeleteTarget = async ({userId,targetId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1577
+ let client = !sdk ? await sdkForProject() :
1578
+ sdk;
1411
1579
  let apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1412
1580
  let payload = {};
1413
1581
 
@@ -1421,8 +1589,9 @@ const usersDeleteTarget = async ({ userId, targetId, parseOutput = true, sdk = u
1421
1589
  parse(response)
1422
1590
  success()
1423
1591
  }
1424
-
1592
+
1425
1593
  return response;
1594
+
1426
1595
  }
1427
1596
 
1428
1597
  /**
@@ -1430,6 +1599,7 @@ const usersDeleteTarget = async ({ userId, targetId, parseOutput = true, sdk = u
1430
1599
  * @property {string} userId User ID.
1431
1600
  * @property {number} length Token length in characters. The default length is 6 characters
1432
1601
  * @property {number} expire Token expiration period in seconds. The default expiration is 15 minutes.
1602
+ * @property {boolean} overrideForCli
1433
1603
  * @property {boolean} parseOutput
1434
1604
  * @property {libClient | undefined} sdk
1435
1605
  */
@@ -1437,8 +1607,9 @@ const usersDeleteTarget = async ({ userId, targetId, parseOutput = true, sdk = u
1437
1607
  /**
1438
1608
  * @param {UsersCreateTokenRequestParams} params
1439
1609
  */
1440
- const usersCreateToken = async ({ userId, length, expire, parseOutput = true, sdk = undefined}) => {
1441
- let client = !sdk ? await sdkForProject() : sdk;
1610
+ const usersCreateToken = async ({userId,length,expire,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1611
+ let client = !sdk ? await sdkForProject() :
1612
+ sdk;
1442
1613
  let apiPath = '/users/{userId}/tokens'.replace('{userId}', userId);
1443
1614
  let payload = {};
1444
1615
  if (typeof length !== 'undefined') {
@@ -1458,14 +1629,16 @@ const usersCreateToken = async ({ userId, length, expire, parseOutput = true, sd
1458
1629
  parse(response)
1459
1630
  success()
1460
1631
  }
1461
-
1632
+
1462
1633
  return response;
1634
+
1463
1635
  }
1464
1636
 
1465
1637
  /**
1466
1638
  * @typedef {Object} UsersUpdateEmailVerificationRequestParams
1467
1639
  * @property {string} userId User ID.
1468
1640
  * @property {boolean} emailVerification User email verification status.
1641
+ * @property {boolean} overrideForCli
1469
1642
  * @property {boolean} parseOutput
1470
1643
  * @property {libClient | undefined} sdk
1471
1644
  */
@@ -1473,8 +1646,9 @@ const usersCreateToken = async ({ userId, length, expire, parseOutput = true, sd
1473
1646
  /**
1474
1647
  * @param {UsersUpdateEmailVerificationRequestParams} params
1475
1648
  */
1476
- const usersUpdateEmailVerification = async ({ userId, emailVerification, parseOutput = true, sdk = undefined}) => {
1477
- let client = !sdk ? await sdkForProject() : sdk;
1649
+ const usersUpdateEmailVerification = async ({userId,emailVerification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1650
+ let client = !sdk ? await sdkForProject() :
1651
+ sdk;
1478
1652
  let apiPath = '/users/{userId}/verification'.replace('{userId}', userId);
1479
1653
  let payload = {};
1480
1654
  if (typeof emailVerification !== 'undefined') {
@@ -1491,14 +1665,16 @@ const usersUpdateEmailVerification = async ({ userId, emailVerification, parseOu
1491
1665
  parse(response)
1492
1666
  success()
1493
1667
  }
1494
-
1668
+
1495
1669
  return response;
1670
+
1496
1671
  }
1497
1672
 
1498
1673
  /**
1499
1674
  * @typedef {Object} UsersUpdatePhoneVerificationRequestParams
1500
1675
  * @property {string} userId User ID.
1501
1676
  * @property {boolean} phoneVerification User phone verification status.
1677
+ * @property {boolean} overrideForCli
1502
1678
  * @property {boolean} parseOutput
1503
1679
  * @property {libClient | undefined} sdk
1504
1680
  */
@@ -1506,8 +1682,9 @@ const usersUpdateEmailVerification = async ({ userId, emailVerification, parseOu
1506
1682
  /**
1507
1683
  * @param {UsersUpdatePhoneVerificationRequestParams} params
1508
1684
  */
1509
- const usersUpdatePhoneVerification = async ({ userId, phoneVerification, parseOutput = true, sdk = undefined}) => {
1510
- let client = !sdk ? await sdkForProject() : sdk;
1685
+ const usersUpdatePhoneVerification = async ({userId,phoneVerification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1686
+ let client = !sdk ? await sdkForProject() :
1687
+ sdk;
1511
1688
  let apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId);
1512
1689
  let payload = {};
1513
1690
  if (typeof phoneVerification !== 'undefined') {
@@ -1524,8 +1701,9 @@ const usersUpdatePhoneVerification = async ({ userId, phoneVerification, parseOu
1524
1701
  parse(response)
1525
1702
  success()
1526
1703
  }
1527
-
1704
+
1528
1705
  return response;
1706
+
1529
1707
  }
1530
1708
 
1531
1709
  users
@@ -1533,6 +1711,7 @@ users
1533
1711
  .description(`Get a list of all the project's users. You can use the query params to filter your results.`)
1534
1712
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels`)
1535
1713
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1714
+ .option(`--console`, `Get the resource console url`)
1536
1715
  .action(actionRunner(usersList))
1537
1716
 
1538
1717
  users
@@ -1640,6 +1819,7 @@ users
1640
1819
  .command(`get`)
1641
1820
  .description(`Get a user by its unique ID.`)
1642
1821
  .requiredOption(`--userId <userId>`, `User ID.`)
1822
+ .option(`--console`, `Get the resource console url`)
1643
1823
  .action(actionRunner(usersGet))
1644
1824
 
1645
1825
  users
@@ -1655,6 +1835,14 @@ users
1655
1835
  .requiredOption(`--email <email>`, `User email.`)
1656
1836
  .action(actionRunner(usersUpdateEmail))
1657
1837
 
1838
+ users
1839
+ .command(`createJWT`)
1840
+ .description(`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.`)
1841
+ .requiredOption(`--userId <userId>`, `User ID.`)
1842
+ .option(`--sessionId <sessionId>`, `Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session.`)
1843
+ .option(`--duration <duration>`, `Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.`, parseInteger)
1844
+ .action(actionRunner(usersCreateJWT))
1845
+
1658
1846
  users
1659
1847
  .command(`updateLabels`)
1660
1848
  .description(`Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user'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.`)
@@ -1751,6 +1939,7 @@ users
1751
1939
  .command(`listSessions`)
1752
1940
  .description(`Get the user sessions list by its unique ID.`)
1753
1941
  .requiredOption(`--userId <userId>`, `User ID.`)
1942
+ .option(`--console`, `Get the resource console url`)
1754
1943
  .action(actionRunner(usersListSessions))
1755
1944
 
1756
1945
  users
@@ -1860,6 +2049,7 @@ module.exports = {
1860
2049
  usersGet,
1861
2050
  usersDelete,
1862
2051
  usersUpdateEmail,
2052
+ usersCreateJWT,
1863
2053
  usersUpdateLabels,
1864
2054
  usersListLogs,
1865
2055
  usersListMemberships,
@@ -1887,4 +2077,4 @@ module.exports = {
1887
2077
  usersCreateToken,
1888
2078
  usersUpdateEmailVerification,
1889
2079
  usersUpdatePhoneVerification
1890
- };
2080
+ };