appwrite-cli 1.1.1 → 2.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 (60) hide show
  1. package/Formula/appwrite.rb +1 -1
  2. package/LICENSE.md +2 -2
  3. package/README.md +4 -4
  4. package/docs/examples/account/create-phone-session.md +1 -1
  5. package/docs/examples/account/create.md +1 -1
  6. package/docs/examples/account/update-password.md +1 -1
  7. package/docs/examples/account/update-phone.md +1 -1
  8. package/docs/examples/console/variables.md +1 -0
  9. package/docs/examples/databases/create-relationship-attribute.md +9 -0
  10. package/docs/examples/databases/get-document.md +2 -1
  11. package/docs/examples/databases/update-boolean-attribute.md +6 -0
  12. package/docs/examples/databases/update-datetime-attribute.md +6 -0
  13. package/docs/examples/databases/update-email-attribute.md +6 -0
  14. package/docs/examples/databases/update-enum-attribute.md +7 -0
  15. package/docs/examples/databases/update-float-attribute.md +8 -0
  16. package/docs/examples/databases/update-integer-attribute.md +8 -0
  17. package/docs/examples/databases/update-ip-attribute.md +6 -0
  18. package/docs/examples/databases/update-relationship-attribute.md +5 -0
  19. package/docs/examples/databases/update-string-attribute.md +6 -0
  20. package/docs/examples/databases/update-url-attribute.md +6 -0
  21. package/docs/examples/functions/{retry-build.md → create-build.md} +1 -1
  22. package/docs/examples/functions/create.md +1 -1
  23. package/docs/examples/functions/update.md +1 -1
  24. package/docs/examples/graphql/mutation.md +2 -0
  25. package/docs/examples/graphql/query.md +2 -0
  26. package/docs/examples/projects/create.md +1 -0
  27. package/docs/examples/projects/update-auth-duration.md +3 -0
  28. package/docs/examples/projects/update-auth-password-dictionary.md +3 -0
  29. package/docs/examples/projects/update-auth-password-history.md +3 -0
  30. package/docs/examples/projects/update-auth-sessions-limit.md +3 -0
  31. package/docs/examples/projects/update-o-auth2.md +1 -0
  32. package/docs/examples/teams/create-membership.md +3 -1
  33. package/docs/examples/teams/get-prefs.md +2 -0
  34. package/docs/examples/teams/{update.md → update-name.md} +1 -1
  35. package/docs/examples/teams/update-prefs.md +3 -0
  36. package/docs/examples/users/update-password.md +1 -1
  37. package/docs/examples/users/update-phone.md +1 -1
  38. package/index.js +16 -1
  39. package/install.ps1 +2 -2
  40. package/install.sh +1 -1
  41. package/lib/client.js +7 -7
  42. package/lib/commands/account.js +46 -11
  43. package/lib/commands/avatars.js +3 -1
  44. package/lib/commands/console.js +44 -0
  45. package/lib/commands/databases.js +735 -109
  46. package/lib/commands/deploy.js +350 -141
  47. package/lib/commands/functions.js +44 -16
  48. package/lib/commands/generic.js +15 -3
  49. package/lib/commands/graphql.js +85 -0
  50. package/lib/commands/health.js +3 -1
  51. package/lib/commands/init.js +224 -162
  52. package/lib/commands/locale.js +3 -1
  53. package/lib/commands/projects.js +223 -9
  54. package/lib/commands/storage.js +43 -13
  55. package/lib/commands/teams.js +107 -19
  56. package/lib/commands/users.js +62 -11
  57. package/lib/config.js +122 -5
  58. package/lib/parser.js +7 -2
  59. package/lib/questions.js +311 -257
  60. package/package.json +1 -1
@@ -10,7 +10,9 @@ const { sdkForProject, sdkForConsole } = require('../sdks')
10
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
11
11
  const { localConfig, globalConfig } = require("../config");
12
12
 
13
- const databases = new Command("databases").description(commandDescriptions['databases'])
13
+ const databases = new Command("databases").description(commandDescriptions['databases']).configureHelp({
14
+ helpWidth: process.stdout.columns || 80
15
+ })
14
16
 
15
17
  const databasesList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
16
18
  /* @param {string[]} queries */
@@ -48,10 +50,12 @@ const databasesCreate = async ({ databaseId, name, parseOutput = true, sdk = und
48
50
  let payload = {};
49
51
 
50
52
  /** Body Params */
53
+
51
54
  if (typeof databaseId !== 'undefined') {
52
55
  payload['databaseId'] = databaseId;
53
56
  }
54
57
 
58
+
55
59
  if (typeof name !== 'undefined') {
56
60
  payload['name'] = name;
57
61
  }
@@ -118,6 +122,7 @@ const databasesUpdate = async ({ databaseId, name, parseOutput = true, sdk = und
118
122
  let payload = {};
119
123
 
120
124
  /** Body Params */
125
+
121
126
  if (typeof name !== 'undefined') {
122
127
  payload['name'] = name;
123
128
  }
@@ -192,18 +197,23 @@ const databasesCreateCollection = async ({ databaseId, collectionId, name, permi
192
197
  let payload = {};
193
198
 
194
199
  /** Body Params */
200
+
195
201
  if (typeof collectionId !== 'undefined') {
196
202
  payload['collectionId'] = collectionId;
197
203
  }
198
204
 
205
+
199
206
  if (typeof name !== 'undefined') {
200
207
  payload['name'] = name;
201
208
  }
202
209
 
210
+ permissions = permissions === true ? [] : permissions;
211
+
203
212
  if (typeof permissions !== 'undefined') {
204
213
  payload['permissions'] = permissions;
205
214
  }
206
215
 
216
+
207
217
  if (typeof documentSecurity !== 'undefined') {
208
218
  payload['documentSecurity'] = documentSecurity;
209
219
  }
@@ -252,18 +262,23 @@ const databasesUpdateCollection = async ({ databaseId, collectionId, name, permi
252
262
  let payload = {};
253
263
 
254
264
  /** Body Params */
265
+
255
266
  if (typeof name !== 'undefined') {
256
267
  payload['name'] = name;
257
268
  }
258
269
 
270
+ permissions = permissions === true ? [] : permissions;
271
+
259
272
  if (typeof permissions !== 'undefined') {
260
273
  payload['permissions'] = permissions;
261
274
  }
262
275
 
276
+
263
277
  if (typeof documentSecurity !== 'undefined') {
264
278
  payload['documentSecurity'] = documentSecurity;
265
279
  }
266
280
 
281
+
267
282
  if (typeof enabled !== 'undefined') {
268
283
  payload['enabled'] = enabled;
269
284
  }
@@ -331,18 +346,467 @@ const databasesCreateBooleanAttribute = async ({ databaseId, collectionId, key,
331
346
  let payload = {};
332
347
 
333
348
  /** Body Params */
349
+
350
+ if (typeof key !== 'undefined') {
351
+ payload['key'] = key;
352
+ }
353
+
354
+
355
+ if (typeof required !== 'undefined') {
356
+ payload['required'] = required;
357
+ }
358
+
359
+
360
+ if (typeof xdefault !== 'undefined') {
361
+ payload['default'] = xdefault;
362
+ }
363
+
364
+
365
+ if (typeof array !== 'undefined') {
366
+ payload['array'] = array;
367
+ }
368
+
369
+ let response = undefined;
370
+ response = await client.call('post', path, {
371
+ 'content-type': 'application/json',
372
+ }, payload);
373
+
374
+ if (parseOutput) {
375
+ parse(response)
376
+ success()
377
+ }
378
+ return response;
379
+ }
380
+
381
+ const databasesUpdateBooleanAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
382
+ /* @param {string} databaseId */
383
+ /* @param {string} collectionId */
384
+ /* @param {string} key */
385
+ /* @param {boolean} required */
386
+ /* @param {boolean} xdefault */
387
+
388
+ let client = !sdk ? await sdkForProject() : sdk;
389
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
390
+ let payload = {};
391
+
392
+ /** Body Params */
393
+
394
+ if (typeof required !== 'undefined') {
395
+ payload['required'] = required;
396
+ }
397
+
398
+
399
+ if (typeof xdefault !== 'undefined') {
400
+ payload['default'] = xdefault;
401
+ }
402
+
403
+ let response = undefined;
404
+ response = await client.call('patch', path, {
405
+ 'content-type': 'application/json',
406
+ }, payload);
407
+
408
+ if (parseOutput) {
409
+ parse(response)
410
+ success()
411
+ }
412
+ return response;
413
+ }
414
+
415
+ const databasesCreateDatetimeAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
416
+ /* @param {string} databaseId */
417
+ /* @param {string} collectionId */
418
+ /* @param {string} key */
419
+ /* @param {boolean} required */
420
+ /* @param {string} xdefault */
421
+ /* @param {boolean} array */
422
+
423
+ let client = !sdk ? await sdkForProject() : sdk;
424
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
425
+ let payload = {};
426
+
427
+ /** Body Params */
428
+
429
+ if (typeof key !== 'undefined') {
430
+ payload['key'] = key;
431
+ }
432
+
433
+
434
+ if (typeof required !== 'undefined') {
435
+ payload['required'] = required;
436
+ }
437
+
438
+
439
+ if (typeof xdefault !== 'undefined') {
440
+ payload['default'] = xdefault;
441
+ }
442
+
443
+
444
+ if (typeof array !== 'undefined') {
445
+ payload['array'] = array;
446
+ }
447
+
448
+ let response = undefined;
449
+ response = await client.call('post', path, {
450
+ 'content-type': 'application/json',
451
+ }, payload);
452
+
453
+ if (parseOutput) {
454
+ parse(response)
455
+ success()
456
+ }
457
+ return response;
458
+ }
459
+
460
+ const databasesUpdateDatetimeAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
461
+ /* @param {string} databaseId */
462
+ /* @param {string} collectionId */
463
+ /* @param {string} key */
464
+ /* @param {boolean} required */
465
+ /* @param {string} xdefault */
466
+
467
+ let client = !sdk ? await sdkForProject() : sdk;
468
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
469
+ let payload = {};
470
+
471
+ /** Body Params */
472
+
473
+ if (typeof required !== 'undefined') {
474
+ payload['required'] = required;
475
+ }
476
+
477
+
478
+ if (typeof xdefault !== 'undefined') {
479
+ payload['default'] = xdefault;
480
+ }
481
+
482
+ let response = undefined;
483
+ response = await client.call('patch', path, {
484
+ 'content-type': 'application/json',
485
+ }, payload);
486
+
487
+ if (parseOutput) {
488
+ parse(response)
489
+ success()
490
+ }
491
+ return response;
492
+ }
493
+
494
+ const databasesCreateEmailAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
495
+ /* @param {string} databaseId */
496
+ /* @param {string} collectionId */
497
+ /* @param {string} key */
498
+ /* @param {boolean} required */
499
+ /* @param {string} xdefault */
500
+ /* @param {boolean} array */
501
+
502
+ let client = !sdk ? await sdkForProject() : sdk;
503
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
504
+ let payload = {};
505
+
506
+ /** Body Params */
507
+
334
508
  if (typeof key !== 'undefined') {
335
509
  payload['key'] = key;
336
510
  }
337
511
 
512
+
513
+ if (typeof required !== 'undefined') {
514
+ payload['required'] = required;
515
+ }
516
+
517
+
518
+ if (typeof xdefault !== 'undefined') {
519
+ payload['default'] = xdefault;
520
+ }
521
+
522
+
523
+ if (typeof array !== 'undefined') {
524
+ payload['array'] = array;
525
+ }
526
+
527
+ let response = undefined;
528
+ response = await client.call('post', path, {
529
+ 'content-type': 'application/json',
530
+ }, payload);
531
+
532
+ if (parseOutput) {
533
+ parse(response)
534
+ success()
535
+ }
536
+ return response;
537
+ }
538
+
539
+ const databasesUpdateEmailAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
540
+ /* @param {string} databaseId */
541
+ /* @param {string} collectionId */
542
+ /* @param {string} key */
543
+ /* @param {boolean} required */
544
+ /* @param {string} xdefault */
545
+
546
+ let client = !sdk ? await sdkForProject() : sdk;
547
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
548
+ let payload = {};
549
+
550
+ /** Body Params */
551
+
338
552
  if (typeof required !== 'undefined') {
339
553
  payload['required'] = required;
340
554
  }
341
555
 
556
+
557
+ if (typeof xdefault !== 'undefined') {
558
+ payload['default'] = xdefault;
559
+ }
560
+
561
+ let response = undefined;
562
+ response = await client.call('patch', path, {
563
+ 'content-type': 'application/json',
564
+ }, payload);
565
+
566
+ if (parseOutput) {
567
+ parse(response)
568
+ success()
569
+ }
570
+ return response;
571
+ }
572
+
573
+ const databasesCreateEnumAttribute = async ({ databaseId, collectionId, key, elements, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
574
+ /* @param {string} databaseId */
575
+ /* @param {string} collectionId */
576
+ /* @param {string} key */
577
+ /* @param {string[]} elements */
578
+ /* @param {boolean} required */
579
+ /* @param {string} xdefault */
580
+ /* @param {boolean} array */
581
+
582
+ let client = !sdk ? await sdkForProject() : sdk;
583
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
584
+ let payload = {};
585
+
586
+ /** Body Params */
587
+
588
+ if (typeof key !== 'undefined') {
589
+ payload['key'] = key;
590
+ }
591
+
592
+ elements = elements === true ? [] : elements;
593
+
594
+ if (typeof elements !== 'undefined') {
595
+ payload['elements'] = elements;
596
+ }
597
+
598
+
599
+ if (typeof required !== 'undefined') {
600
+ payload['required'] = required;
601
+ }
602
+
603
+
604
+ if (typeof xdefault !== 'undefined') {
605
+ payload['default'] = xdefault;
606
+ }
607
+
608
+
609
+ if (typeof array !== 'undefined') {
610
+ payload['array'] = array;
611
+ }
612
+
613
+ let response = undefined;
614
+ response = await client.call('post', path, {
615
+ 'content-type': 'application/json',
616
+ }, payload);
617
+
618
+ if (parseOutput) {
619
+ parse(response)
620
+ success()
621
+ }
622
+ return response;
623
+ }
624
+
625
+ const databasesUpdateEnumAttribute = async ({ databaseId, collectionId, key, elements, required, xdefault, parseOutput = true, sdk = undefined}) => {
626
+ /* @param {string} databaseId */
627
+ /* @param {string} collectionId */
628
+ /* @param {string} key */
629
+ /* @param {string[]} elements */
630
+ /* @param {boolean} required */
631
+ /* @param {string} xdefault */
632
+
633
+ let client = !sdk ? await sdkForProject() : sdk;
634
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
635
+ let payload = {};
636
+
637
+ /** Body Params */
638
+ elements = elements === true ? [] : elements;
639
+
640
+ if (typeof elements !== 'undefined') {
641
+ payload['elements'] = elements;
642
+ }
643
+
644
+
645
+ if (typeof required !== 'undefined') {
646
+ payload['required'] = required;
647
+ }
648
+
649
+
650
+ if (typeof xdefault !== 'undefined') {
651
+ payload['default'] = xdefault;
652
+ }
653
+
654
+ let response = undefined;
655
+ response = await client.call('patch', path, {
656
+ 'content-type': 'application/json',
657
+ }, payload);
658
+
659
+ if (parseOutput) {
660
+ parse(response)
661
+ success()
662
+ }
663
+ return response;
664
+ }
665
+
666
+ const databasesCreateFloatAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
667
+ /* @param {string} databaseId */
668
+ /* @param {string} collectionId */
669
+ /* @param {string} key */
670
+ /* @param {boolean} required */
671
+ /* @param {number} min */
672
+ /* @param {number} max */
673
+ /* @param {number} xdefault */
674
+ /* @param {boolean} array */
675
+
676
+ let client = !sdk ? await sdkForProject() : sdk;
677
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
678
+ let payload = {};
679
+
680
+ /** Body Params */
681
+
682
+ if (typeof key !== 'undefined') {
683
+ payload['key'] = key;
684
+ }
685
+
686
+
687
+ if (typeof required !== 'undefined') {
688
+ payload['required'] = required;
689
+ }
690
+
691
+
692
+ if (typeof min !== 'undefined') {
693
+ payload['min'] = min;
694
+ }
695
+
696
+
697
+ if (typeof max !== 'undefined') {
698
+ payload['max'] = max;
699
+ }
700
+
701
+
702
+ if (typeof xdefault !== 'undefined') {
703
+ payload['default'] = xdefault;
704
+ }
705
+
706
+
707
+ if (typeof array !== 'undefined') {
708
+ payload['array'] = array;
709
+ }
710
+
711
+ let response = undefined;
712
+ response = await client.call('post', path, {
713
+ 'content-type': 'application/json',
714
+ }, payload);
715
+
716
+ if (parseOutput) {
717
+ parse(response)
718
+ success()
719
+ }
720
+ return response;
721
+ }
722
+
723
+ const databasesUpdateFloatAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, parseOutput = true, sdk = undefined}) => {
724
+ /* @param {string} databaseId */
725
+ /* @param {string} collectionId */
726
+ /* @param {string} key */
727
+ /* @param {boolean} required */
728
+ /* @param {number} min */
729
+ /* @param {number} max */
730
+ /* @param {number} xdefault */
731
+
732
+ let client = !sdk ? await sdkForProject() : sdk;
733
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
734
+ let payload = {};
735
+
736
+ /** Body Params */
737
+
738
+ if (typeof required !== 'undefined') {
739
+ payload['required'] = required;
740
+ }
741
+
742
+
743
+ if (typeof min !== 'undefined') {
744
+ payload['min'] = min;
745
+ }
746
+
747
+
748
+ if (typeof max !== 'undefined') {
749
+ payload['max'] = max;
750
+ }
751
+
752
+
753
+ if (typeof xdefault !== 'undefined') {
754
+ payload['default'] = xdefault;
755
+ }
756
+
757
+ let response = undefined;
758
+ response = await client.call('patch', path, {
759
+ 'content-type': 'application/json',
760
+ }, payload);
761
+
762
+ if (parseOutput) {
763
+ parse(response)
764
+ success()
765
+ }
766
+ return response;
767
+ }
768
+
769
+ const databasesCreateIntegerAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
770
+ /* @param {string} databaseId */
771
+ /* @param {string} collectionId */
772
+ /* @param {string} key */
773
+ /* @param {boolean} required */
774
+ /* @param {number} min */
775
+ /* @param {number} max */
776
+ /* @param {number} xdefault */
777
+ /* @param {boolean} array */
778
+
779
+ let client = !sdk ? await sdkForProject() : sdk;
780
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
781
+ let payload = {};
782
+
783
+ /** Body Params */
784
+
785
+ if (typeof key !== 'undefined') {
786
+ payload['key'] = key;
787
+ }
788
+
789
+
790
+ if (typeof required !== 'undefined') {
791
+ payload['required'] = required;
792
+ }
793
+
794
+
795
+ if (typeof min !== 'undefined') {
796
+ payload['min'] = min;
797
+ }
798
+
799
+
800
+ if (typeof max !== 'undefined') {
801
+ payload['max'] = max;
802
+ }
803
+
804
+
342
805
  if (typeof xdefault !== 'undefined') {
343
806
  payload['default'] = xdefault;
344
807
  }
345
808
 
809
+
346
810
  if (typeof array !== 'undefined') {
347
811
  payload['array'] = array;
348
812
  }
@@ -359,37 +823,42 @@ const databasesCreateBooleanAttribute = async ({ databaseId, collectionId, key,
359
823
  return response;
360
824
  }
361
825
 
362
- const databasesCreateDatetimeAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
826
+ const databasesUpdateIntegerAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, parseOutput = true, sdk = undefined}) => {
363
827
  /* @param {string} databaseId */
364
828
  /* @param {string} collectionId */
365
829
  /* @param {string} key */
366
830
  /* @param {boolean} required */
367
- /* @param {string} xdefault */
368
- /* @param {boolean} array */
831
+ /* @param {number} min */
832
+ /* @param {number} max */
833
+ /* @param {number} xdefault */
369
834
 
370
835
  let client = !sdk ? await sdkForProject() : sdk;
371
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
836
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
372
837
  let payload = {};
373
838
 
374
839
  /** Body Params */
375
- if (typeof key !== 'undefined') {
376
- payload['key'] = key;
377
- }
378
840
 
379
841
  if (typeof required !== 'undefined') {
380
842
  payload['required'] = required;
381
843
  }
382
844
 
383
- if (typeof xdefault !== 'undefined') {
384
- payload['default'] = xdefault;
845
+
846
+ if (typeof min !== 'undefined') {
847
+ payload['min'] = min;
385
848
  }
386
849
 
387
- if (typeof array !== 'undefined') {
388
- payload['array'] = array;
850
+
851
+ if (typeof max !== 'undefined') {
852
+ payload['max'] = max;
853
+ }
854
+
855
+
856
+ if (typeof xdefault !== 'undefined') {
857
+ payload['default'] = xdefault;
389
858
  }
390
859
 
391
860
  let response = undefined;
392
- response = await client.call('post', path, {
861
+ response = await client.call('patch', path, {
393
862
  'content-type': 'application/json',
394
863
  }, payload);
395
864
 
@@ -400,7 +869,7 @@ const databasesCreateDatetimeAttribute = async ({ databaseId, collectionId, key,
400
869
  return response;
401
870
  }
402
871
 
403
- const databasesCreateEmailAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
872
+ const databasesCreateIpAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
404
873
  /* @param {string} databaseId */
405
874
  /* @param {string} collectionId */
406
875
  /* @param {string} key */
@@ -409,22 +878,26 @@ const databasesCreateEmailAttribute = async ({ databaseId, collectionId, key, re
409
878
  /* @param {boolean} array */
410
879
 
411
880
  let client = !sdk ? await sdkForProject() : sdk;
412
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
881
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
413
882
  let payload = {};
414
883
 
415
884
  /** Body Params */
885
+
416
886
  if (typeof key !== 'undefined') {
417
887
  payload['key'] = key;
418
888
  }
419
889
 
890
+
420
891
  if (typeof required !== 'undefined') {
421
892
  payload['required'] = required;
422
893
  }
423
894
 
895
+
424
896
  if (typeof xdefault !== 'undefined') {
425
897
  payload['default'] = xdefault;
426
898
  }
427
899
 
900
+
428
901
  if (typeof array !== 'undefined') {
429
902
  payload['array'] = array;
430
903
  }
@@ -441,42 +914,30 @@ const databasesCreateEmailAttribute = async ({ databaseId, collectionId, key, re
441
914
  return response;
442
915
  }
443
916
 
444
- const databasesCreateEnumAttribute = async ({ databaseId, collectionId, key, elements, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
917
+ const databasesUpdateIpAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
445
918
  /* @param {string} databaseId */
446
919
  /* @param {string} collectionId */
447
920
  /* @param {string} key */
448
- /* @param {string[]} elements */
449
921
  /* @param {boolean} required */
450
922
  /* @param {string} xdefault */
451
- /* @param {boolean} array */
452
923
 
453
924
  let client = !sdk ? await sdkForProject() : sdk;
454
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
925
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
455
926
  let payload = {};
456
927
 
457
928
  /** Body Params */
458
- if (typeof key !== 'undefined') {
459
- payload['key'] = key;
460
- }
461
-
462
- if (typeof elements !== 'undefined') {
463
- payload['elements'] = elements;
464
- }
465
929
 
466
930
  if (typeof required !== 'undefined') {
467
931
  payload['required'] = required;
468
932
  }
469
933
 
934
+
470
935
  if (typeof xdefault !== 'undefined') {
471
936
  payload['default'] = xdefault;
472
937
  }
473
938
 
474
- if (typeof array !== 'undefined') {
475
- payload['array'] = array;
476
- }
477
-
478
939
  let response = undefined;
479
- response = await client.call('post', path, {
940
+ response = await client.call('patch', path, {
480
941
  'content-type': 'application/json',
481
942
  }, payload);
482
943
 
@@ -487,43 +948,49 @@ const databasesCreateEnumAttribute = async ({ databaseId, collectionId, key, ele
487
948
  return response;
488
949
  }
489
950
 
490
- const databasesCreateFloatAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
951
+ const databasesCreateRelationshipAttribute = async ({ databaseId, collectionId, relatedCollectionId, type, twoWay, key, twoWayKey, onDelete, parseOutput = true, sdk = undefined}) => {
491
952
  /* @param {string} databaseId */
492
953
  /* @param {string} collectionId */
954
+ /* @param {string} relatedCollectionId */
955
+ /* @param {string} type */
956
+ /* @param {boolean} twoWay */
493
957
  /* @param {string} key */
494
- /* @param {boolean} required */
495
- /* @param {number} min */
496
- /* @param {number} max */
497
- /* @param {number} xdefault */
498
- /* @param {boolean} array */
958
+ /* @param {string} twoWayKey */
959
+ /* @param {string} onDelete */
499
960
 
500
961
  let client = !sdk ? await sdkForProject() : sdk;
501
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
962
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
502
963
  let payload = {};
503
964
 
504
965
  /** Body Params */
505
- if (typeof key !== 'undefined') {
506
- payload['key'] = key;
966
+
967
+ if (typeof relatedCollectionId !== 'undefined') {
968
+ payload['relatedCollectionId'] = relatedCollectionId;
507
969
  }
508
970
 
509
- if (typeof required !== 'undefined') {
510
- payload['required'] = required;
971
+
972
+ if (typeof type !== 'undefined') {
973
+ payload['type'] = type;
511
974
  }
512
975
 
513
- if (typeof min !== 'undefined') {
514
- payload['min'] = min;
976
+
977
+ if (typeof twoWay !== 'undefined') {
978
+ payload['twoWay'] = twoWay;
515
979
  }
516
980
 
517
- if (typeof max !== 'undefined') {
518
- payload['max'] = max;
981
+
982
+ if (typeof key !== 'undefined') {
983
+ payload['key'] = key;
519
984
  }
520
985
 
521
- if (typeof xdefault !== 'undefined') {
522
- payload['default'] = xdefault;
986
+
987
+ if (typeof twoWayKey !== 'undefined') {
988
+ payload['twoWayKey'] = twoWayKey;
523
989
  }
524
990
 
525
- if (typeof array !== 'undefined') {
526
- payload['array'] = array;
991
+
992
+ if (typeof onDelete !== 'undefined') {
993
+ payload['onDelete'] = onDelete;
527
994
  }
528
995
 
529
996
  let response = undefined;
@@ -538,41 +1005,41 @@ const databasesCreateFloatAttribute = async ({ databaseId, collectionId, key, re
538
1005
  return response;
539
1006
  }
540
1007
 
541
- const databasesCreateIntegerAttribute = async ({ databaseId, collectionId, key, required, min, max, xdefault, array, parseOutput = true, sdk = undefined}) => {
1008
+ const databasesCreateStringAttribute = async ({ databaseId, collectionId, key, size, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
542
1009
  /* @param {string} databaseId */
543
1010
  /* @param {string} collectionId */
544
1011
  /* @param {string} key */
1012
+ /* @param {number} size */
545
1013
  /* @param {boolean} required */
546
- /* @param {number} min */
547
- /* @param {number} max */
548
- /* @param {number} xdefault */
1014
+ /* @param {string} xdefault */
549
1015
  /* @param {boolean} array */
550
1016
 
551
1017
  let client = !sdk ? await sdkForProject() : sdk;
552
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1018
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
553
1019
  let payload = {};
554
1020
 
555
1021
  /** Body Params */
1022
+
556
1023
  if (typeof key !== 'undefined') {
557
1024
  payload['key'] = key;
558
1025
  }
559
1026
 
560
- if (typeof required !== 'undefined') {
561
- payload['required'] = required;
562
- }
563
1027
 
564
- if (typeof min !== 'undefined') {
565
- payload['min'] = min;
1028
+ if (typeof size !== 'undefined') {
1029
+ payload['size'] = size;
566
1030
  }
567
1031
 
568
- if (typeof max !== 'undefined') {
569
- payload['max'] = max;
1032
+
1033
+ if (typeof required !== 'undefined') {
1034
+ payload['required'] = required;
570
1035
  }
571
1036
 
1037
+
572
1038
  if (typeof xdefault !== 'undefined') {
573
1039
  payload['default'] = xdefault;
574
1040
  }
575
1041
 
1042
+
576
1043
  if (typeof array !== 'undefined') {
577
1044
  payload['array'] = array;
578
1045
  }
@@ -589,37 +1056,30 @@ const databasesCreateIntegerAttribute = async ({ databaseId, collectionId, key,
589
1056
  return response;
590
1057
  }
591
1058
 
592
- const databasesCreateIpAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
1059
+ const databasesUpdateStringAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
593
1060
  /* @param {string} databaseId */
594
1061
  /* @param {string} collectionId */
595
1062
  /* @param {string} key */
596
1063
  /* @param {boolean} required */
597
1064
  /* @param {string} xdefault */
598
- /* @param {boolean} array */
599
1065
 
600
1066
  let client = !sdk ? await sdkForProject() : sdk;
601
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1067
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
602
1068
  let payload = {};
603
1069
 
604
1070
  /** Body Params */
605
- if (typeof key !== 'undefined') {
606
- payload['key'] = key;
607
- }
608
1071
 
609
1072
  if (typeof required !== 'undefined') {
610
1073
  payload['required'] = required;
611
1074
  }
612
1075
 
1076
+
613
1077
  if (typeof xdefault !== 'undefined') {
614
1078
  payload['default'] = xdefault;
615
1079
  }
616
1080
 
617
- if (typeof array !== 'undefined') {
618
- payload['array'] = array;
619
- }
620
-
621
1081
  let response = undefined;
622
- response = await client.call('post', path, {
1082
+ response = await client.call('patch', path, {
623
1083
  'content-type': 'application/json',
624
1084
  }, payload);
625
1085
 
@@ -630,36 +1090,35 @@ const databasesCreateIpAttribute = async ({ databaseId, collectionId, key, requi
630
1090
  return response;
631
1091
  }
632
1092
 
633
- const databasesCreateStringAttribute = async ({ databaseId, collectionId, key, size, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
1093
+ const databasesCreateUrlAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
634
1094
  /* @param {string} databaseId */
635
1095
  /* @param {string} collectionId */
636
1096
  /* @param {string} key */
637
- /* @param {number} size */
638
1097
  /* @param {boolean} required */
639
1098
  /* @param {string} xdefault */
640
1099
  /* @param {boolean} array */
641
1100
 
642
1101
  let client = !sdk ? await sdkForProject() : sdk;
643
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1102
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
644
1103
  let payload = {};
645
1104
 
646
1105
  /** Body Params */
1106
+
647
1107
  if (typeof key !== 'undefined') {
648
1108
  payload['key'] = key;
649
1109
  }
650
1110
 
651
- if (typeof size !== 'undefined') {
652
- payload['size'] = size;
653
- }
654
1111
 
655
1112
  if (typeof required !== 'undefined') {
656
1113
  payload['required'] = required;
657
1114
  }
658
1115
 
1116
+
659
1117
  if (typeof xdefault !== 'undefined') {
660
1118
  payload['default'] = xdefault;
661
1119
  }
662
1120
 
1121
+
663
1122
  if (typeof array !== 'undefined') {
664
1123
  payload['array'] = array;
665
1124
  }
@@ -676,37 +1135,30 @@ const databasesCreateStringAttribute = async ({ databaseId, collectionId, key, s
676
1135
  return response;
677
1136
  }
678
1137
 
679
- const databasesCreateUrlAttribute = async ({ databaseId, collectionId, key, required, xdefault, array, parseOutput = true, sdk = undefined}) => {
1138
+ const databasesUpdateUrlAttribute = async ({ databaseId, collectionId, key, required, xdefault, parseOutput = true, sdk = undefined}) => {
680
1139
  /* @param {string} databaseId */
681
1140
  /* @param {string} collectionId */
682
1141
  /* @param {string} key */
683
1142
  /* @param {boolean} required */
684
1143
  /* @param {string} xdefault */
685
- /* @param {boolean} array */
686
1144
 
687
1145
  let client = !sdk ? await sdkForProject() : sdk;
688
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1146
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
689
1147
  let payload = {};
690
1148
 
691
1149
  /** Body Params */
692
- if (typeof key !== 'undefined') {
693
- payload['key'] = key;
694
- }
695
1150
 
696
1151
  if (typeof required !== 'undefined') {
697
1152
  payload['required'] = required;
698
1153
  }
699
1154
 
1155
+
700
1156
  if (typeof xdefault !== 'undefined') {
701
1157
  payload['default'] = xdefault;
702
1158
  }
703
1159
 
704
- if (typeof array !== 'undefined') {
705
- payload['array'] = array;
706
- }
707
-
708
1160
  let response = undefined;
709
- response = await client.call('post', path, {
1161
+ response = await client.call('patch', path, {
710
1162
  'content-type': 'application/json',
711
1163
  }, payload);
712
1164
 
@@ -757,6 +1209,34 @@ const databasesDeleteAttribute = async ({ databaseId, collectionId, key, parseOu
757
1209
  return response;
758
1210
  }
759
1211
 
1212
+ const databasesUpdateRelationshipAttribute = async ({ databaseId, collectionId, key, onDelete, parseOutput = true, sdk = undefined}) => {
1213
+ /* @param {string} databaseId */
1214
+ /* @param {string} collectionId */
1215
+ /* @param {string} key */
1216
+ /* @param {string} onDelete */
1217
+
1218
+ let client = !sdk ? await sdkForProject() : sdk;
1219
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1220
+ let payload = {};
1221
+
1222
+ /** Body Params */
1223
+
1224
+ if (typeof onDelete !== 'undefined') {
1225
+ payload['onDelete'] = onDelete;
1226
+ }
1227
+
1228
+ let response = undefined;
1229
+ response = await client.call('patch', path, {
1230
+ 'content-type': 'application/json',
1231
+ }, payload);
1232
+
1233
+ if (parseOutput) {
1234
+ parse(response)
1235
+ success()
1236
+ }
1237
+ return response;
1238
+ }
1239
+
760
1240
  const databasesListDocuments = async ({ databaseId, collectionId, queries, parseOutput = true, sdk = undefined}) => {
761
1241
  /* @param {string} databaseId */
762
1242
  /* @param {string} collectionId */
@@ -794,6 +1274,7 @@ const databasesCreateDocument = async ({ databaseId, collectionId, documentId, d
794
1274
  let payload = {};
795
1275
 
796
1276
  /** Body Params */
1277
+
797
1278
  if (typeof documentId !== 'undefined') {
798
1279
  payload['documentId'] = documentId;
799
1280
  }
@@ -802,6 +1283,8 @@ const databasesCreateDocument = async ({ databaseId, collectionId, documentId, d
802
1283
  payload['data'] = JSON.parse(data);
803
1284
  }
804
1285
 
1286
+ permissions = permissions === true ? [] : permissions;
1287
+
805
1288
  if (typeof permissions !== 'undefined') {
806
1289
  payload['permissions'] = permissions;
807
1290
  }
@@ -818,14 +1301,20 @@ const databasesCreateDocument = async ({ databaseId, collectionId, documentId, d
818
1301
  return response;
819
1302
  }
820
1303
 
821
- const databasesGetDocument = async ({ databaseId, collectionId, documentId, parseOutput = true, sdk = undefined}) => {
1304
+ const databasesGetDocument = async ({ databaseId, collectionId, documentId, queries, parseOutput = true, sdk = undefined}) => {
822
1305
  /* @param {string} databaseId */
823
1306
  /* @param {string} collectionId */
824
1307
  /* @param {string} documentId */
1308
+ /* @param {string[]} queries */
825
1309
 
826
1310
  let client = !sdk ? await sdkForProject() : sdk;
827
1311
  let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
828
1312
  let payload = {};
1313
+
1314
+ /** Query Params */
1315
+ if (typeof queries !== 'undefined') {
1316
+ payload['queries'] = queries;
1317
+ }
829
1318
  let response = undefined;
830
1319
  response = await client.call('get', path, {
831
1320
  'content-type': 'application/json',
@@ -854,6 +1343,8 @@ const databasesUpdateDocument = async ({ databaseId, collectionId, documentId, d
854
1343
  payload['data'] = JSON.parse(data);
855
1344
  }
856
1345
 
1346
+ permissions = permissions === true ? [] : permissions;
1347
+
857
1348
  if (typeof permissions !== 'undefined') {
858
1349
  payload['permissions'] = permissions;
859
1350
  }
@@ -948,18 +1439,24 @@ const databasesCreateIndex = async ({ databaseId, collectionId, key, type, attri
948
1439
  let payload = {};
949
1440
 
950
1441
  /** Body Params */
1442
+
951
1443
  if (typeof key !== 'undefined') {
952
1444
  payload['key'] = key;
953
1445
  }
954
1446
 
1447
+
955
1448
  if (typeof type !== 'undefined') {
956
1449
  payload['type'] = type;
957
1450
  }
958
1451
 
1452
+ attributes = attributes === true ? [] : attributes;
1453
+
959
1454
  if (typeof attributes !== 'undefined') {
960
1455
  payload['attributes'] = attributes;
961
1456
  }
962
1457
 
1458
+ orders = orders === true ? [] : orders;
1459
+
963
1460
  if (typeof orders !== 'undefined') {
964
1461
  payload['orders'] = orders;
965
1462
  }
@@ -1118,14 +1615,14 @@ const databasesGetDatabaseUsage = async ({ databaseId, range, parseOutput = true
1118
1615
  databases
1119
1616
  .command(`list`)
1120
1617
  .description(`Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.`)
1121
- .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name`)
1618
+ .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`)
1122
1619
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1123
1620
  .action(actionRunner(databasesList))
1124
1621
 
1125
1622
  databases
1126
1623
  .command(`create`)
1127
1624
  .description(`Create a new Database. `)
1128
- .requiredOption(`--databaseId <databaseId>`, `Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.`)
1625
+ .requiredOption(`--databaseId <databaseId>`, `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.`)
1129
1626
  .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
1130
1627
  .action(actionRunner(databasesCreate))
1131
1628
 
@@ -1145,7 +1642,7 @@ databases
1145
1642
  .command(`update`)
1146
1643
  .description(`Update a database by its unique ID.`)
1147
1644
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1148
- .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
1645
+ .requiredOption(`--name <name>`, `Database name. Max length: 128 chars.`)
1149
1646
  .action(actionRunner(databasesUpdate))
1150
1647
 
1151
1648
  databases
@@ -1158,7 +1655,7 @@ databases
1158
1655
  .command(`listCollections`)
1159
1656
  .description(`Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.`)
1160
1657
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1161
- .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity`)
1658
+ .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, enabled, documentSecurity`)
1162
1659
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1163
1660
  .action(actionRunner(databasesListCollections))
1164
1661
 
@@ -1166,9 +1663,9 @@ databases
1166
1663
  .command(`createCollection`)
1167
1664
  .description(`Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
1168
1665
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1169
- .requiredOption(`--collectionId <collectionId>`, `Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.`)
1666
+ .requiredOption(`--collectionId <collectionId>`, `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.`)
1170
1667
  .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
1171
- .option(`--permissions <permissions...>`, `An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).`)
1668
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions).`)
1172
1669
  .option(`--documentSecurity <documentSecurity>`, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).`, parseBool)
1173
1670
  .action(actionRunner(databasesCreateCollection))
1174
1671
 
@@ -1185,7 +1682,7 @@ databases
1185
1682
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1186
1683
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1187
1684
  .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
1188
- .option(`--permissions <permissions...>`, `An array of permission strings. By default the current permission are inherited. [Learn more about permissions](/docs/permissions).`)
1685
+ .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).`)
1189
1686
  .option(`--documentSecurity <documentSecurity>`, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).`, parseBool)
1190
1687
  .option(`--enabled <enabled>`, `Is collection enabled?`, parseBool)
1191
1688
  .action(actionRunner(databasesUpdateCollection))
@@ -1215,6 +1712,16 @@ databases
1215
1712
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1216
1713
  .action(actionRunner(databasesCreateBooleanAttribute))
1217
1714
 
1715
+ databases
1716
+ .command(`updateBooleanAttribute`)
1717
+ .description(``)
1718
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1719
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1720
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1721
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1722
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseBool)
1723
+ .action(actionRunner(databasesUpdateBooleanAttribute))
1724
+
1218
1725
  databases
1219
1726
  .command(`createDatetimeAttribute`)
1220
1727
  .description(``)
@@ -1226,6 +1733,16 @@ databases
1226
1733
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1227
1734
  .action(actionRunner(databasesCreateDatetimeAttribute))
1228
1735
 
1736
+ databases
1737
+ .command(`updateDatetimeAttribute`)
1738
+ .description(``)
1739
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1740
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1741
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1742
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1743
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1744
+ .action(actionRunner(databasesUpdateDatetimeAttribute))
1745
+
1229
1746
  databases
1230
1747
  .command(`createEmailAttribute`)
1231
1748
  .description(`Create an email attribute. `)
@@ -1237,18 +1754,39 @@ databases
1237
1754
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1238
1755
  .action(actionRunner(databasesCreateEmailAttribute))
1239
1756
 
1757
+ databases
1758
+ .command(`updateEmailAttribute`)
1759
+ .description(`Update an email attribute. Changing the 'default' value will not update already existing documents. `)
1760
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1761
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1762
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1763
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1764
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1765
+ .action(actionRunner(databasesUpdateEmailAttribute))
1766
+
1240
1767
  databases
1241
1768
  .command(`createEnumAttribute`)
1242
1769
  .description(``)
1243
1770
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1244
1771
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1245
1772
  .requiredOption(`--key <key>`, `Attribute Key.`)
1246
- .requiredOption(`--elements <elements...>`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.`)
1773
+ .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.`)
1247
1774
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1248
1775
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1249
1776
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1250
1777
  .action(actionRunner(databasesCreateEnumAttribute))
1251
1778
 
1779
+ databases
1780
+ .command(`updateEnumAttribute`)
1781
+ .description(`Update an enum attribute. Changing the 'default' value will not update already existing documents. `)
1782
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1783
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1784
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1785
+ .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 4096 characters long.`)
1786
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1787
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1788
+ .action(actionRunner(databasesUpdateEnumAttribute))
1789
+
1252
1790
  databases
1253
1791
  .command(`createFloatAttribute`)
1254
1792
  .description(`Create a float attribute. Optionally, minimum and maximum values can be provided. `)
@@ -1262,6 +1800,18 @@ databases
1262
1800
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1263
1801
  .action(actionRunner(databasesCreateFloatAttribute))
1264
1802
 
1803
+ databases
1804
+ .command(`updateFloatAttribute`)
1805
+ .description(`Update a float attribute. Changing the 'default' value will not update already existing documents. `)
1806
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1807
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1808
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1809
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1810
+ .requiredOption(`--min <min>`, `Minimum value to enforce on new documents`, parseInteger)
1811
+ .requiredOption(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
1812
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
1813
+ .action(actionRunner(databasesUpdateFloatAttribute))
1814
+
1265
1815
  databases
1266
1816
  .command(`createIntegerAttribute`)
1267
1817
  .description(`Create an integer attribute. Optionally, minimum and maximum values can be provided. `)
@@ -1275,6 +1825,18 @@ databases
1275
1825
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1276
1826
  .action(actionRunner(databasesCreateIntegerAttribute))
1277
1827
 
1828
+ databases
1829
+ .command(`updateIntegerAttribute`)
1830
+ .description(`Update an integer attribute. Changing the 'default' value will not update already existing documents. `)
1831
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1832
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1833
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1834
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1835
+ .requiredOption(`--min <min>`, `Minimum value to enforce on new documents`, parseInteger)
1836
+ .requiredOption(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
1837
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
1838
+ .action(actionRunner(databasesUpdateIntegerAttribute))
1839
+
1278
1840
  databases
1279
1841
  .command(`createIpAttribute`)
1280
1842
  .description(`Create IP address attribute. `)
@@ -1286,6 +1848,29 @@ databases
1286
1848
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1287
1849
  .action(actionRunner(databasesCreateIpAttribute))
1288
1850
 
1851
+ databases
1852
+ .command(`updateIpAttribute`)
1853
+ .description(`Update an ip attribute. Changing the 'default' value will not update already existing documents. `)
1854
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1855
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1856
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1857
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1858
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1859
+ .action(actionRunner(databasesUpdateIpAttribute))
1860
+
1861
+ databases
1862
+ .command(`createRelationshipAttribute`)
1863
+ .description(`Create relationship attribute. [Learn more about relationship attributes](docs/databases-relationships#relationship-attributes). `)
1864
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1865
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1866
+ .requiredOption(`--relatedCollectionId <relatedCollectionId>`, `Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1867
+ .requiredOption(`--type <type>`, `Relation type`)
1868
+ .option(`--twoWay <twoWay>`, `Is Two Way?`, parseBool)
1869
+ .option(`--key <key>`, `Attribute Key.`)
1870
+ .option(`--twoWayKey <twoWayKey>`, `Two Way Attribute Key.`)
1871
+ .option(`--onDelete <onDelete>`, `Constraints option`)
1872
+ .action(actionRunner(databasesCreateRelationshipAttribute))
1873
+
1289
1874
  databases
1290
1875
  .command(`createStringAttribute`)
1291
1876
  .description(`Create a string attribute. `)
@@ -1298,6 +1883,16 @@ databases
1298
1883
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1299
1884
  .action(actionRunner(databasesCreateStringAttribute))
1300
1885
 
1886
+ databases
1887
+ .command(`updateStringAttribute`)
1888
+ .description(`Update a string attribute. Changing the 'default' value will not update already existing documents. `)
1889
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1890
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1891
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1892
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1893
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1894
+ .action(actionRunner(databasesUpdateStringAttribute))
1895
+
1301
1896
  databases
1302
1897
  .command(`createUrlAttribute`)
1303
1898
  .description(`Create a URL attribute. `)
@@ -1309,6 +1904,16 @@ databases
1309
1904
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
1310
1905
  .action(actionRunner(databasesCreateUrlAttribute))
1311
1906
 
1907
+ databases
1908
+ .command(`updateUrlAttribute`)
1909
+ .description(`Update an url attribute. Changing the 'default' value will not update already existing documents. `)
1910
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1911
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1912
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1913
+ .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1914
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1915
+ .action(actionRunner(databasesUpdateUrlAttribute))
1916
+
1312
1917
  databases
1313
1918
  .command(`getAttribute`)
1314
1919
  .description(``)
@@ -1325,12 +1930,21 @@ databases
1325
1930
  .requiredOption(`--key <key>`, `Attribute Key.`)
1326
1931
  .action(actionRunner(databasesDeleteAttribute))
1327
1932
 
1933
+ databases
1934
+ .command(`updateRelationshipAttribute`)
1935
+ .description(`Update relationship attribute. [Learn more about relationship attributes](docs/databases-relationships#relationship-attributes). `)
1936
+ .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1937
+ .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1938
+ .requiredOption(`--key <key>`, `Attribute Key.`)
1939
+ .option(`--onDelete <onDelete>`, `Constraints option`)
1940
+ .action(actionRunner(databasesUpdateRelationshipAttribute))
1941
+
1328
1942
  databases
1329
1943
  .command(`listDocuments`)
1330
- .description(`Get a list of all the user's documents in a given collection. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of documents belonging to the provided collectionId. [Learn more about different API modes](/docs/admin).`)
1944
+ .description(`Get a list of all the user's documents in a given collection. You can use the query params to filter your results.`)
1331
1945
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1332
1946
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1333
- .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.`)
1947
+ .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.`)
1334
1948
  .action(actionRunner(databasesListDocuments))
1335
1949
 
1336
1950
  databases
@@ -1338,9 +1952,9 @@ databases
1338
1952
  .description(`Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
1339
1953
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1340
1954
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`)
1341
- .requiredOption(`--documentId <documentId>`, `Document ID. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.`)
1955
+ .requiredOption(`--documentId <documentId>`, `Document 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.`)
1342
1956
  .requiredOption(`--data <data>`, `Document data as JSON object.`)
1343
- .option(`--permissions <permissions...>`, `An array of permissions strings. By default the current user is granted with all permissions. [Learn more about permissions](/docs/permissions).`)
1957
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions).`)
1344
1958
  .action(actionRunner(databasesCreateDocument))
1345
1959
 
1346
1960
  databases
@@ -1349,6 +1963,7 @@ databases
1349
1963
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1350
1964
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1351
1965
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1966
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only method allowed is select.`)
1352
1967
  .action(actionRunner(databasesGetDocument))
1353
1968
 
1354
1969
  databases
@@ -1358,7 +1973,7 @@ databases
1358
1973
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1359
1974
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1360
1975
  .option(`--data <data>`, `Document data as JSON object. Include only attribute and value pairs to be updated.`)
1361
- .option(`--permissions <permissions...>`, `An array of permissions strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).`)
1976
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).`)
1362
1977
  .action(actionRunner(databasesUpdateDocument))
1363
1978
 
1364
1979
  databases
@@ -1375,7 +1990,7 @@ databases
1375
1990
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1376
1991
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1377
1992
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1378
- .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset`)
1993
+ .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`)
1379
1994
  .action(actionRunner(databasesListDocumentLogs))
1380
1995
 
1381
1996
  databases
@@ -1392,8 +2007,8 @@ databases
1392
2007
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
1393
2008
  .requiredOption(`--key <key>`, `Index Key.`)
1394
2009
  .requiredOption(`--type <type>`, `Index type.`)
1395
- .requiredOption(`--attributes <attributes...>`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`)
1396
- .option(`--orders <orders...>`, `Array of index orders. Maximum of 100 orders are allowed.`)
2010
+ .requiredOption(`--attributes [attributes...]`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`)
2011
+ .option(`--orders [orders...]`, `Array of index orders. Maximum of 100 orders are allowed.`)
1397
2012
  .action(actionRunner(databasesCreateIndex))
1398
2013
 
1399
2014
  databases
@@ -1417,7 +2032,7 @@ databases
1417
2032
  .description(`Get the collection activity logs list by its unique ID.`)
1418
2033
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1419
2034
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1420
- .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset`)
2035
+ .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`)
1421
2036
  .action(actionRunner(databasesListCollectionLogs))
1422
2037
 
1423
2038
  databases
@@ -1432,7 +2047,7 @@ databases
1432
2047
  .command(`listLogs`)
1433
2048
  .description(`Get the database activity logs list by its unique ID.`)
1434
2049
  .requiredOption(`--databaseId <databaseId>`, `Database ID.`)
1435
- .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset`)
2050
+ .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`)
1436
2051
  .action(actionRunner(databasesListLogs))
1437
2052
 
1438
2053
  databases
@@ -1458,16 +2073,27 @@ module.exports = {
1458
2073
  databasesDeleteCollection,
1459
2074
  databasesListAttributes,
1460
2075
  databasesCreateBooleanAttribute,
2076
+ databasesUpdateBooleanAttribute,
1461
2077
  databasesCreateDatetimeAttribute,
2078
+ databasesUpdateDatetimeAttribute,
1462
2079
  databasesCreateEmailAttribute,
2080
+ databasesUpdateEmailAttribute,
1463
2081
  databasesCreateEnumAttribute,
2082
+ databasesUpdateEnumAttribute,
1464
2083
  databasesCreateFloatAttribute,
2084
+ databasesUpdateFloatAttribute,
1465
2085
  databasesCreateIntegerAttribute,
2086
+ databasesUpdateIntegerAttribute,
1466
2087
  databasesCreateIpAttribute,
2088
+ databasesUpdateIpAttribute,
2089
+ databasesCreateRelationshipAttribute,
1467
2090
  databasesCreateStringAttribute,
2091
+ databasesUpdateStringAttribute,
1468
2092
  databasesCreateUrlAttribute,
2093
+ databasesUpdateUrlAttribute,
1469
2094
  databasesGetAttribute,
1470
2095
  databasesDeleteAttribute,
2096
+ databasesUpdateRelationshipAttribute,
1471
2097
  databasesListDocuments,
1472
2098
  databasesCreateDocument,
1473
2099
  databasesGetDocument,