appwrite-cli 2.0.2 → 3.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 (102) hide show
  1. package/README.md +11 -6
  2. package/docs/examples/account/delete-identity.md +2 -0
  3. package/docs/examples/account/list-identities.md +2 -0
  4. package/docs/examples/assistant/chat.md +2 -0
  5. package/docs/examples/databases/create-collection.md +1 -0
  6. package/docs/examples/databases/create-string-attribute.md +1 -0
  7. package/docs/examples/databases/create.md +2 -1
  8. package/docs/examples/databases/list-attributes.md +2 -1
  9. package/docs/examples/databases/list-indexes.md +2 -1
  10. package/docs/examples/databases/update.md +2 -1
  11. package/docs/examples/functions/create-deployment.md +3 -2
  12. package/docs/examples/functions/create-execution.md +3 -0
  13. package/docs/examples/functions/create.md +12 -0
  14. package/docs/examples/functions/download-deployment.md +3 -0
  15. package/docs/examples/functions/update.md +9 -0
  16. package/docs/examples/health/get-pub-sub.md +1 -0
  17. package/docs/examples/health/get-queue.md +1 -0
  18. package/docs/examples/locale/list-codes.md +1 -0
  19. package/docs/examples/migrations/create-appwrite-migration.md +5 -0
  20. package/docs/examples/migrations/create-firebase-migration.md +3 -0
  21. package/docs/examples/migrations/create-firebase-o-auth-migration.md +3 -0
  22. package/docs/examples/migrations/create-n-host-migration.md +9 -0
  23. package/docs/examples/migrations/create-supabase-migration.md +8 -0
  24. package/docs/examples/migrations/delete-firebase-auth.md +1 -0
  25. package/docs/examples/migrations/delete.md +2 -0
  26. package/docs/examples/migrations/get-appwrite-report.md +5 -0
  27. package/docs/examples/migrations/get-firebase-report-o-auth.md +3 -0
  28. package/docs/examples/migrations/get-firebase-report.md +3 -0
  29. package/docs/examples/migrations/get-n-host-report.md +9 -0
  30. package/docs/examples/migrations/get-supabase-report.md +8 -0
  31. package/docs/examples/migrations/get.md +2 -0
  32. package/docs/examples/migrations/list-firebase-projects.md +1 -0
  33. package/docs/examples/migrations/list.md +3 -0
  34. package/docs/examples/migrations/retry.md +2 -0
  35. package/docs/examples/project/create-variable.md +3 -0
  36. package/docs/examples/project/delete-variable.md +2 -0
  37. package/docs/examples/project/get-usage.md +2 -0
  38. package/docs/examples/project/get-variable.md +2 -0
  39. package/docs/examples/project/list-variables.md +1 -0
  40. package/docs/examples/project/update-variable.md +4 -0
  41. package/docs/examples/projects/create.md +1 -1
  42. package/docs/examples/projects/delete-email-template.md +4 -0
  43. package/docs/examples/projects/delete-sms-template.md +4 -0
  44. package/docs/examples/projects/delete.md +1 -2
  45. package/docs/examples/projects/get-email-template.md +4 -0
  46. package/docs/examples/projects/get-sms-template.md +4 -0
  47. package/docs/examples/projects/update-email-template.md +9 -0
  48. package/docs/examples/projects/update-personal-data-check.md +3 -0
  49. package/docs/examples/projects/update-service-status-all.md +3 -0
  50. package/docs/examples/projects/update-sms-template.md +5 -0
  51. package/docs/examples/projects/update-smtp-configuration.md +11 -0
  52. package/docs/examples/projects/update-team.md +3 -0
  53. package/docs/examples/proxy/create-rule.md +4 -0
  54. package/docs/examples/proxy/delete-rule.md +2 -0
  55. package/docs/examples/proxy/get-rule.md +2 -0
  56. package/docs/examples/proxy/list-rules.md +3 -0
  57. package/docs/examples/proxy/update-rule-verification.md +2 -0
  58. package/docs/examples/storage/update-file.md +1 -0
  59. package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +1 -1
  60. package/docs/examples/users/delete-identity.md +2 -0
  61. package/docs/examples/users/list-identities.md +3 -0
  62. package/docs/examples/users/update-labels.md +3 -0
  63. package/docs/examples/vcs/create-repository-detection.md +4 -0
  64. package/docs/examples/vcs/create-repository.md +4 -0
  65. package/docs/examples/vcs/delete-installation.md +2 -0
  66. package/docs/examples/vcs/get-installation.md +2 -0
  67. package/docs/examples/vcs/get-repository.md +3 -0
  68. package/docs/examples/vcs/list-installations.md +3 -0
  69. package/docs/examples/vcs/list-repositories.md +3 -0
  70. package/docs/examples/vcs/list-repository-branches.md +3 -0
  71. package/docs/examples/vcs/update-external-deployments.md +4 -0
  72. package/index.js +10 -0
  73. package/install.ps1 +2 -2
  74. package/install.sh +1 -1
  75. package/lib/client.js +3 -3
  76. package/lib/commands/account.js +122 -67
  77. package/lib/commands/assistant.js +53 -0
  78. package/lib/commands/avatars.js +21 -21
  79. package/lib/commands/console.js +2 -2
  80. package/lib/commands/databases.js +146 -104
  81. package/lib/commands/functions.js +277 -70
  82. package/lib/commands/generic.js +1 -0
  83. package/lib/commands/graphql.js +4 -4
  84. package/lib/commands/health.js +68 -22
  85. package/lib/commands/locale.js +37 -14
  86. package/lib/commands/migrations.js +708 -0
  87. package/lib/commands/project.js +204 -0
  88. package/lib/commands/projects.js +459 -196
  89. package/lib/commands/proxy.js +177 -0
  90. package/lib/commands/storage.js +47 -40
  91. package/lib/commands/teams.js +33 -33
  92. package/lib/commands/users.js +147 -52
  93. package/lib/commands/vcs.js +305 -0
  94. package/lib/config.js +1 -2
  95. package/lib/parser.js +2 -2
  96. package/package.json +1 -1
  97. package/scoop/appwrite.json +30 -0
  98. package/docs/examples/projects/create-domain.md +0 -3
  99. package/docs/examples/projects/delete-domain.md +0 -3
  100. package/docs/examples/projects/get-domain.md +0 -3
  101. package/docs/examples/projects/list-domains.md +0 -2
  102. package/docs/examples/projects/update-domain-verification.md +0 -3
@@ -17,10 +17,10 @@ const account = new Command("account").description(commandDescriptions['account'
17
17
  const accountGet = async ({ parseOutput = true, sdk = undefined}) => {
18
18
 
19
19
  let client = !sdk ? await sdkForProject() : sdk;
20
- let path = '/account';
20
+ let apiPath = '/account';
21
21
  let payload = {};
22
22
  let response = undefined;
23
- response = await client.call('get', path, {
23
+ response = await client.call('get', apiPath, {
24
24
  'content-type': 'application/json',
25
25
  }, payload);
26
26
 
@@ -38,7 +38,7 @@ const accountCreate = async ({ userId, email, password, name, parseOutput = true
38
38
  /* @param {string} name */
39
39
 
40
40
  let client = !sdk ? await sdkForProject() : sdk;
41
- let path = '/account';
41
+ let apiPath = '/account';
42
42
  let payload = {};
43
43
 
44
44
  /** Body Params */
@@ -63,7 +63,7 @@ const accountCreate = async ({ userId, email, password, name, parseOutput = true
63
63
  }
64
64
 
65
65
  let response = undefined;
66
- response = await client.call('post', path, {
66
+ response = await client.call('post', apiPath, {
67
67
  'content-type': 'application/json',
68
68
  }, payload);
69
69
 
@@ -79,7 +79,7 @@ const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = u
79
79
  /* @param {string} password */
80
80
 
81
81
  let client = !sdk ? await sdkForProject() : sdk;
82
- let path = '/account/email';
82
+ let apiPath = '/account/email';
83
83
  let payload = {};
84
84
 
85
85
  /** Body Params */
@@ -94,7 +94,48 @@ const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = u
94
94
  }
95
95
 
96
96
  let response = undefined;
97
- response = await client.call('patch', path, {
97
+ response = await client.call('patch', apiPath, {
98
+ 'content-type': 'application/json',
99
+ }, payload);
100
+
101
+ if (parseOutput) {
102
+ parse(response)
103
+ success()
104
+ }
105
+ return response;
106
+ }
107
+
108
+ const accountListIdentities = async ({ queries, parseOutput = true, sdk = undefined}) => {
109
+ /* @param {string} queries */
110
+
111
+ let client = !sdk ? await sdkForProject() : sdk;
112
+ let apiPath = '/account/identities';
113
+ let payload = {};
114
+
115
+ /** Query Params */
116
+ if (typeof queries !== 'undefined') {
117
+ payload['queries'] = queries;
118
+ }
119
+ let response = undefined;
120
+ response = await client.call('get', apiPath, {
121
+ 'content-type': 'application/json',
122
+ }, payload);
123
+
124
+ if (parseOutput) {
125
+ parse(response)
126
+ success()
127
+ }
128
+ return response;
129
+ }
130
+
131
+ const accountDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undefined}) => {
132
+ /* @param {string} identityId */
133
+
134
+ let client = !sdk ? await sdkForProject() : sdk;
135
+ let apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
136
+ let payload = {};
137
+ let response = undefined;
138
+ response = await client.call('delete', apiPath, {
98
139
  'content-type': 'application/json',
99
140
  }, payload);
100
141
 
@@ -108,10 +149,10 @@ const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = u
108
149
  const accountCreateJWT = async ({ parseOutput = true, sdk = undefined}) => {
109
150
 
110
151
  let client = !sdk ? await sdkForProject() : sdk;
111
- let path = '/account/jwt';
152
+ let apiPath = '/account/jwt';
112
153
  let payload = {};
113
154
  let response = undefined;
114
- response = await client.call('post', path, {
155
+ response = await client.call('post', apiPath, {
115
156
  'content-type': 'application/json',
116
157
  }, payload);
117
158
 
@@ -126,7 +167,7 @@ const accountListLogs = async ({ queries, parseOutput = true, sdk = undefined})
126
167
  /* @param {string[]} queries */
127
168
 
128
169
  let client = !sdk ? await sdkForProject() : sdk;
129
- let path = '/account/logs';
170
+ let apiPath = '/account/logs';
130
171
  let payload = {};
131
172
 
132
173
  /** Query Params */
@@ -134,7 +175,7 @@ const accountListLogs = async ({ queries, parseOutput = true, sdk = undefined})
134
175
  payload['queries'] = queries;
135
176
  }
136
177
  let response = undefined;
137
- response = await client.call('get', path, {
178
+ response = await client.call('get', apiPath, {
138
179
  'content-type': 'application/json',
139
180
  }, payload);
140
181
 
@@ -149,7 +190,7 @@ const accountUpdateName = async ({ name, parseOutput = true, sdk = undefined}) =
149
190
  /* @param {string} name */
150
191
 
151
192
  let client = !sdk ? await sdkForProject() : sdk;
152
- let path = '/account/name';
193
+ let apiPath = '/account/name';
153
194
  let payload = {};
154
195
 
155
196
  /** Body Params */
@@ -159,7 +200,7 @@ const accountUpdateName = async ({ name, parseOutput = true, sdk = undefined}) =
159
200
  }
160
201
 
161
202
  let response = undefined;
162
- response = await client.call('patch', path, {
203
+ response = await client.call('patch', apiPath, {
163
204
  'content-type': 'application/json',
164
205
  }, payload);
165
206
 
@@ -175,7 +216,7 @@ const accountUpdatePassword = async ({ password, oldPassword, parseOutput = true
175
216
  /* @param {string} oldPassword */
176
217
 
177
218
  let client = !sdk ? await sdkForProject() : sdk;
178
- let path = '/account/password';
219
+ let apiPath = '/account/password';
179
220
  let payload = {};
180
221
 
181
222
  /** Body Params */
@@ -190,7 +231,7 @@ const accountUpdatePassword = async ({ password, oldPassword, parseOutput = true
190
231
  }
191
232
 
192
233
  let response = undefined;
193
- response = await client.call('patch', path, {
234
+ response = await client.call('patch', apiPath, {
194
235
  'content-type': 'application/json',
195
236
  }, payload);
196
237
 
@@ -206,7 +247,7 @@ const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = u
206
247
  /* @param {string} password */
207
248
 
208
249
  let client = !sdk ? await sdkForProject() : sdk;
209
- let path = '/account/phone';
250
+ let apiPath = '/account/phone';
210
251
  let payload = {};
211
252
 
212
253
  /** Body Params */
@@ -221,7 +262,7 @@ const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = u
221
262
  }
222
263
 
223
264
  let response = undefined;
224
- response = await client.call('patch', path, {
265
+ response = await client.call('patch', apiPath, {
225
266
  'content-type': 'application/json',
226
267
  }, payload);
227
268
 
@@ -235,10 +276,10 @@ const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = u
235
276
  const accountGetPrefs = async ({ parseOutput = true, sdk = undefined}) => {
236
277
 
237
278
  let client = !sdk ? await sdkForProject() : sdk;
238
- let path = '/account/prefs';
279
+ let apiPath = '/account/prefs';
239
280
  let payload = {};
240
281
  let response = undefined;
241
- response = await client.call('get', path, {
282
+ response = await client.call('get', apiPath, {
242
283
  'content-type': 'application/json',
243
284
  }, payload);
244
285
 
@@ -253,7 +294,7 @@ const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined})
253
294
  /* @param {object} prefs */
254
295
 
255
296
  let client = !sdk ? await sdkForProject() : sdk;
256
- let path = '/account/prefs';
297
+ let apiPath = '/account/prefs';
257
298
  let payload = {};
258
299
 
259
300
  /** Body Params */
@@ -262,7 +303,7 @@ const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined})
262
303
  }
263
304
 
264
305
  let response = undefined;
265
- response = await client.call('patch', path, {
306
+ response = await client.call('patch', apiPath, {
266
307
  'content-type': 'application/json',
267
308
  }, payload);
268
309
 
@@ -278,7 +319,7 @@ const accountCreateRecovery = async ({ email, url, parseOutput = true, sdk = und
278
319
  /* @param {string} url */
279
320
 
280
321
  let client = !sdk ? await sdkForProject() : sdk;
281
- let path = '/account/recovery';
322
+ let apiPath = '/account/recovery';
282
323
  let payload = {};
283
324
 
284
325
  /** Body Params */
@@ -293,7 +334,7 @@ const accountCreateRecovery = async ({ email, url, parseOutput = true, sdk = und
293
334
  }
294
335
 
295
336
  let response = undefined;
296
- response = await client.call('post', path, {
337
+ response = await client.call('post', apiPath, {
297
338
  'content-type': 'application/json',
298
339
  }, payload);
299
340
 
@@ -311,7 +352,7 @@ const accountUpdateRecovery = async ({ userId, secret, password, passwordAgain,
311
352
  /* @param {string} passwordAgain */
312
353
 
313
354
  let client = !sdk ? await sdkForProject() : sdk;
314
- let path = '/account/recovery';
355
+ let apiPath = '/account/recovery';
315
356
  let payload = {};
316
357
 
317
358
  /** Body Params */
@@ -336,7 +377,7 @@ const accountUpdateRecovery = async ({ userId, secret, password, passwordAgain,
336
377
  }
337
378
 
338
379
  let response = undefined;
339
- response = await client.call('put', path, {
380
+ response = await client.call('put', apiPath, {
340
381
  'content-type': 'application/json',
341
382
  }, payload);
342
383
 
@@ -350,10 +391,10 @@ const accountUpdateRecovery = async ({ userId, secret, password, passwordAgain,
350
391
  const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
351
392
 
352
393
  let client = !sdk ? await sdkForProject() : sdk;
353
- let path = '/account/sessions';
394
+ let apiPath = '/account/sessions';
354
395
  let payload = {};
355
396
  let response = undefined;
356
- response = await client.call('get', path, {
397
+ response = await client.call('get', apiPath, {
357
398
  'content-type': 'application/json',
358
399
  }, payload);
359
400
 
@@ -367,10 +408,10 @@ const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
367
408
  const accountDeleteSessions = async ({ parseOutput = true, sdk = undefined}) => {
368
409
 
369
410
  let client = !sdk ? await sdkForProject() : sdk;
370
- let path = '/account/sessions';
411
+ let apiPath = '/account/sessions';
371
412
  let payload = {};
372
413
  let response = undefined;
373
- response = await client.call('delete', path, {
414
+ response = await client.call('delete', apiPath, {
374
415
  'content-type': 'application/json',
375
416
  }, payload);
376
417
 
@@ -384,10 +425,10 @@ const accountDeleteSessions = async ({ parseOutput = true, sdk = undefined}) =>
384
425
  const accountCreateAnonymousSession = async ({ parseOutput = true, sdk = undefined}) => {
385
426
 
386
427
  let client = !sdk ? await sdkForProject() : sdk;
387
- let path = '/account/sessions/anonymous';
428
+ let apiPath = '/account/sessions/anonymous';
388
429
  let payload = {};
389
430
  let response = undefined;
390
- response = await client.call('post', path, {
431
+ response = await client.call('post', apiPath, {
391
432
  'content-type': 'application/json',
392
433
  }, payload);
393
434
 
@@ -403,7 +444,7 @@ const accountCreateEmailSession = async ({ email, password, parseOutput = true,
403
444
  /* @param {string} password */
404
445
 
405
446
  let client = !sdk ? await sdkForProject() : sdk;
406
- let path = '/account/sessions/email';
447
+ let apiPath = '/account/sessions/email';
407
448
  let payload = {};
408
449
 
409
450
  /** Body Params */
@@ -418,7 +459,7 @@ const accountCreateEmailSession = async ({ email, password, parseOutput = true,
418
459
  }
419
460
 
420
461
  let response = undefined;
421
- response = await client.call('post', path, {
462
+ response = await client.call('post', apiPath, {
422
463
  'content-type': 'application/json',
423
464
  }, payload);
424
465
 
@@ -435,7 +476,7 @@ const accountCreateMagicURLSession = async ({ userId, email, url, parseOutput =
435
476
  /* @param {string} url */
436
477
 
437
478
  let client = !sdk ? await sdkForProject() : sdk;
438
- let path = '/account/sessions/magic-url';
479
+ let apiPath = '/account/sessions/magic-url';
439
480
  let payload = {};
440
481
 
441
482
  /** Body Params */
@@ -455,7 +496,7 @@ const accountCreateMagicURLSession = async ({ userId, email, url, parseOutput =
455
496
  }
456
497
 
457
498
  let response = undefined;
458
- response = await client.call('post', path, {
499
+ response = await client.call('post', apiPath, {
459
500
  'content-type': 'application/json',
460
501
  }, payload);
461
502
 
@@ -471,7 +512,7 @@ const accountUpdateMagicURLSession = async ({ userId, secret, parseOutput = true
471
512
  /* @param {string} secret */
472
513
 
473
514
  let client = !sdk ? await sdkForProject() : sdk;
474
- let path = '/account/sessions/magic-url';
515
+ let apiPath = '/account/sessions/magic-url';
475
516
  let payload = {};
476
517
 
477
518
  /** Body Params */
@@ -486,7 +527,7 @@ const accountUpdateMagicURLSession = async ({ userId, secret, parseOutput = true
486
527
  }
487
528
 
488
529
  let response = undefined;
489
- response = await client.call('put', path, {
530
+ response = await client.call('put', apiPath, {
490
531
  'content-type': 'application/json',
491
532
  }, payload);
492
533
 
@@ -504,7 +545,7 @@ const accountCreateOAuth2Session = async ({ provider, success, failure, scopes,
504
545
  /* @param {string[]} scopes */
505
546
 
506
547
  let client = !sdk ? await sdkForProject() : sdk;
507
- let path = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
548
+ let apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
508
549
  let payload = {};
509
550
 
510
551
  /** Query Params */
@@ -518,7 +559,7 @@ const accountCreateOAuth2Session = async ({ provider, success, failure, scopes,
518
559
  payload['scopes'] = scopes;
519
560
  }
520
561
  let response = undefined;
521
- response = await client.call('get', path, {
562
+ response = await client.call('get', apiPath, {
522
563
  'content-type': 'application/json',
523
564
  }, payload);
524
565
 
@@ -534,7 +575,7 @@ const accountCreatePhoneSession = async ({ userId, phone, parseOutput = true, sd
534
575
  /* @param {string} phone */
535
576
 
536
577
  let client = !sdk ? await sdkForProject() : sdk;
537
- let path = '/account/sessions/phone';
578
+ let apiPath = '/account/sessions/phone';
538
579
  let payload = {};
539
580
 
540
581
  /** Body Params */
@@ -549,7 +590,7 @@ const accountCreatePhoneSession = async ({ userId, phone, parseOutput = true, sd
549
590
  }
550
591
 
551
592
  let response = undefined;
552
- response = await client.call('post', path, {
593
+ response = await client.call('post', apiPath, {
553
594
  'content-type': 'application/json',
554
595
  }, payload);
555
596
 
@@ -565,7 +606,7 @@ const accountUpdatePhoneSession = async ({ userId, secret, parseOutput = true, s
565
606
  /* @param {string} secret */
566
607
 
567
608
  let client = !sdk ? await sdkForProject() : sdk;
568
- let path = '/account/sessions/phone';
609
+ let apiPath = '/account/sessions/phone';
569
610
  let payload = {};
570
611
 
571
612
  /** Body Params */
@@ -580,7 +621,7 @@ const accountUpdatePhoneSession = async ({ userId, secret, parseOutput = true, s
580
621
  }
581
622
 
582
623
  let response = undefined;
583
- response = await client.call('put', path, {
624
+ response = await client.call('put', apiPath, {
584
625
  'content-type': 'application/json',
585
626
  }, payload);
586
627
 
@@ -595,10 +636,10 @@ const accountGetSession = async ({ sessionId, parseOutput = true, sdk = undefine
595
636
  /* @param {string} sessionId */
596
637
 
597
638
  let client = !sdk ? await sdkForProject() : sdk;
598
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
639
+ let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
599
640
  let payload = {};
600
641
  let response = undefined;
601
- response = await client.call('get', path, {
642
+ response = await client.call('get', apiPath, {
602
643
  'content-type': 'application/json',
603
644
  }, payload);
604
645
 
@@ -613,10 +654,10 @@ const accountUpdateSession = async ({ sessionId, parseOutput = true, sdk = undef
613
654
  /* @param {string} sessionId */
614
655
 
615
656
  let client = !sdk ? await sdkForProject() : sdk;
616
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
657
+ let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
617
658
  let payload = {};
618
659
  let response = undefined;
619
- response = await client.call('patch', path, {
660
+ response = await client.call('patch', apiPath, {
620
661
  'content-type': 'application/json',
621
662
  }, payload);
622
663
 
@@ -631,10 +672,10 @@ const accountDeleteSession = async ({ sessionId, parseOutput = true, sdk = undef
631
672
  /* @param {string} sessionId */
632
673
 
633
674
  let client = !sdk ? await sdkForProject() : sdk;
634
- let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
675
+ let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
635
676
  let payload = {};
636
677
  let response = undefined;
637
- response = await client.call('delete', path, {
678
+ response = await client.call('delete', apiPath, {
638
679
  'content-type': 'application/json',
639
680
  }, payload);
640
681
 
@@ -648,10 +689,10 @@ const accountDeleteSession = async ({ sessionId, parseOutput = true, sdk = undef
648
689
  const accountUpdateStatus = async ({ parseOutput = true, sdk = undefined}) => {
649
690
 
650
691
  let client = !sdk ? await sdkForProject() : sdk;
651
- let path = '/account/status';
692
+ let apiPath = '/account/status';
652
693
  let payload = {};
653
694
  let response = undefined;
654
- response = await client.call('patch', path, {
695
+ response = await client.call('patch', apiPath, {
655
696
  'content-type': 'application/json',
656
697
  }, payload);
657
698
 
@@ -666,7 +707,7 @@ const accountCreateVerification = async ({ url, parseOutput = true, sdk = undefi
666
707
  /* @param {string} url */
667
708
 
668
709
  let client = !sdk ? await sdkForProject() : sdk;
669
- let path = '/account/verification';
710
+ let apiPath = '/account/verification';
670
711
  let payload = {};
671
712
 
672
713
  /** Body Params */
@@ -676,7 +717,7 @@ const accountCreateVerification = async ({ url, parseOutput = true, sdk = undefi
676
717
  }
677
718
 
678
719
  let response = undefined;
679
- response = await client.call('post', path, {
720
+ response = await client.call('post', apiPath, {
680
721
  'content-type': 'application/json',
681
722
  }, payload);
682
723
 
@@ -692,7 +733,7 @@ const accountUpdateVerification = async ({ userId, secret, parseOutput = true, s
692
733
  /* @param {string} secret */
693
734
 
694
735
  let client = !sdk ? await sdkForProject() : sdk;
695
- let path = '/account/verification';
736
+ let apiPath = '/account/verification';
696
737
  let payload = {};
697
738
 
698
739
  /** Body Params */
@@ -707,7 +748,7 @@ const accountUpdateVerification = async ({ userId, secret, parseOutput = true, s
707
748
  }
708
749
 
709
750
  let response = undefined;
710
- response = await client.call('put', path, {
751
+ response = await client.call('put', apiPath, {
711
752
  'content-type': 'application/json',
712
753
  }, payload);
713
754
 
@@ -721,10 +762,10 @@ const accountUpdateVerification = async ({ userId, secret, parseOutput = true, s
721
762
  const accountCreatePhoneVerification = async ({ parseOutput = true, sdk = undefined}) => {
722
763
 
723
764
  let client = !sdk ? await sdkForProject() : sdk;
724
- let path = '/account/verification/phone';
765
+ let apiPath = '/account/verification/phone';
725
766
  let payload = {};
726
767
  let response = undefined;
727
- response = await client.call('post', path, {
768
+ response = await client.call('post', apiPath, {
728
769
  'content-type': 'application/json',
729
770
  }, payload);
730
771
 
@@ -740,7 +781,7 @@ const accountUpdatePhoneVerification = async ({ userId, secret, parseOutput = tr
740
781
  /* @param {string} secret */
741
782
 
742
783
  let client = !sdk ? await sdkForProject() : sdk;
743
- let path = '/account/verification/phone';
784
+ let apiPath = '/account/verification/phone';
744
785
  let payload = {};
745
786
 
746
787
  /** Body Params */
@@ -755,7 +796,7 @@ const accountUpdatePhoneVerification = async ({ userId, secret, parseOutput = tr
755
796
  }
756
797
 
757
798
  let response = undefined;
758
- response = await client.call('put', path, {
799
+ response = await client.call('put', apiPath, {
759
800
  'content-type': 'application/json',
760
801
  }, payload);
761
802
 
@@ -769,7 +810,7 @@ const accountUpdatePhoneVerification = async ({ userId, secret, parseOutput = tr
769
810
 
770
811
  account
771
812
  .command(`get`)
772
- .description(`Get currently logged in user data as JSON object.`)
813
+ .description(`Get the currently logged in user.`)
773
814
  .action(actionRunner(accountGet))
774
815
 
775
816
  account
@@ -788,6 +829,18 @@ account
788
829
  .requiredOption(`--password <password>`, `User password. Must be at least 8 chars.`)
789
830
  .action(actionRunner(accountUpdateEmail))
790
831
 
832
+ account
833
+ .command(`listIdentities`)
834
+ .description(`Get the list of identities for the currently logged in user.`)
835
+ .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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry`)
836
+ .action(actionRunner(accountListIdentities))
837
+
838
+ account
839
+ .command(`deleteIdentity`)
840
+ .description(`Delete an identity by its unique ID.`)
841
+ .requiredOption(`--identityId <identityId>`, `Identity ID.`)
842
+ .action(actionRunner(accountDeleteIdentity))
843
+
791
844
  account
792
845
  .command(`createJWT`)
793
846
  .description(`Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.`)
@@ -795,7 +848,7 @@ account
795
848
 
796
849
  account
797
850
  .command(`listLogs`)
798
- .description(`Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.`)
851
+ .description(`Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.`)
799
852
  .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). Only supported methods are limit and offset`)
800
853
  .action(actionRunner(accountListLogs))
801
854
 
@@ -821,7 +874,7 @@ account
821
874
 
822
875
  account
823
876
  .command(`getPrefs`)
824
- .description(`Get currently logged in user preferences as a key-value object.`)
877
+ .description(`Get the preferences as a key-value object for the currently logged in user.`)
825
878
  .action(actionRunner(accountGetPrefs))
826
879
 
827
880
  account
@@ -848,7 +901,7 @@ account
848
901
 
849
902
  account
850
903
  .command(`listSessions`)
851
- .description(`Get currently logged in user list of active sessions across different devices.`)
904
+ .description(`Get the list of active sessions across different devices for the currently logged in user.`)
852
905
  .action(actionRunner(accountListSessions))
853
906
 
854
907
  account
@@ -870,7 +923,7 @@ account
870
923
 
871
924
  account
872
925
  .command(`createMagicURLSession`)
873
- .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits).`)
926
+ .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits). `)
874
927
  .requiredOption(`--userId <userId>`, `Unique 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.`)
875
928
  .requiredOption(`--email <email>`, `User email.`)
876
929
  .option(`--url <url>`, `URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
@@ -886,9 +939,9 @@ account
886
939
  account
887
940
  .command(`createOAuth2Session`)
888
941
  .description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](/docs/authentication-security#limits). `)
889
- .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom.`)
890
- .option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
891
- .option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
942
+ .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom.`)
943
+ .option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
944
+ .option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
892
945
  .option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`)
893
946
  .action(actionRunner(accountCreateOAuth2Session))
894
947
 
@@ -920,7 +973,7 @@ account
920
973
 
921
974
  account
922
975
  .command(`deleteSession`)
923
- .description(`Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the Session ID argument, only the unique session ID provided is deleted. `)
976
+ .description(`Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](/docs/client/account#accountDeleteSessions) instead.`)
924
977
  .requiredOption(`--sessionId <sessionId>`, `Session ID. Use the string 'current' to delete the current device session.`)
925
978
  .action(actionRunner(accountDeleteSession))
926
979
 
@@ -960,6 +1013,8 @@ module.exports = {
960
1013
  accountGet,
961
1014
  accountCreate,
962
1015
  accountUpdateEmail,
1016
+ accountListIdentities,
1017
+ accountDeleteIdentity,
963
1018
  accountCreateJWT,
964
1019
  accountListLogs,
965
1020
  accountUpdateName,
@@ -0,0 +1,53 @@
1
+ const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
5
+ const { promisify } = require('util');
6
+ const libClient = require('../client.js');
7
+ const { getAllFiles } = require('../utils.js');
8
+ const { Command } = require('commander');
9
+ const { sdkForProject, sdkForConsole } = require('../sdks')
10
+ const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
11
+ const { localConfig, globalConfig } = require("../config");
12
+
13
+ const assistant = new Command("assistant").description(commandDescriptions['assistant']).configureHelp({
14
+ helpWidth: process.stdout.columns || 80
15
+ })
16
+
17
+ const assistantChat = async ({ prompt, parseOutput = true, sdk = undefined}) => {
18
+ /* @param {string} prompt */
19
+
20
+ let client = !sdk ? await sdkForProject() : sdk;
21
+ let apiPath = '/console/assistant';
22
+ let payload = {};
23
+
24
+ /** Body Params */
25
+
26
+ if (typeof prompt !== 'undefined') {
27
+ payload['prompt'] = prompt;
28
+ }
29
+
30
+ let response = undefined;
31
+ response = await client.call('post', apiPath, {
32
+ 'content-type': 'application/json',
33
+ }, payload);
34
+
35
+ if (parseOutput) {
36
+ parse(response)
37
+ success()
38
+ }
39
+ return response;
40
+ }
41
+
42
+
43
+ assistant
44
+ .command(`chat`)
45
+ .description(``)
46
+ .requiredOption(`--prompt <prompt>`, `Prompt. A string containing questions asked to the AI assistant.`)
47
+ .action(actionRunner(assistantChat))
48
+
49
+
50
+ module.exports = {
51
+ assistant,
52
+ assistantChat
53
+ };